tods-competition-factory 1.7.1 → 1.7.2
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 +16 -7
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/transform.mjs +9 -7
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +69 -20
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +89 -50
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +3 -3
package/dist/forge/generate.mjs
CHANGED
|
@@ -10760,7 +10760,7 @@ function assignMatchUpDrawPosition({
|
|
|
10760
10760
|
inContext: true,
|
|
10761
10761
|
drawDefinition,
|
|
10762
10762
|
matchUpsMap
|
|
10763
|
-
}).matchUps
|
|
10763
|
+
}).matchUps ?? [];
|
|
10764
10764
|
}
|
|
10765
10765
|
const inContextMatchUp = inContextDrawMatchUps.find(
|
|
10766
10766
|
(m) => m.matchUpId === matchUpId
|
|
@@ -10774,7 +10774,7 @@ function assignMatchUpDrawPosition({
|
|
|
10774
10774
|
const matchUp = matchUpsMap?.drawMatchUps?.find(
|
|
10775
10775
|
(matchUp2) => matchUp2.matchUpId === matchUpId
|
|
10776
10776
|
);
|
|
10777
|
-
const drawPositions = matchUp?.drawPositions
|
|
10777
|
+
const drawPositions = matchUp?.drawPositions ?? [];
|
|
10778
10778
|
const { positionAdded, positionAssigned, updatedDrawPositions } = getUpdatedDrawPositions({ drawPosition, drawPositions });
|
|
10779
10779
|
const { positionAssignments } = getPositionAssignments({
|
|
10780
10780
|
drawDefinition,
|
|
@@ -10791,7 +10791,7 @@ function assignMatchUpDrawPosition({
|
|
|
10791
10791
|
inContext: true,
|
|
10792
10792
|
drawDefinition,
|
|
10793
10793
|
matchUpsMap
|
|
10794
|
-
}).matchUps
|
|
10794
|
+
}).matchUps ?? [];
|
|
10795
10795
|
const exitWinningSide = isDoubleExitExit && getExitWinningSide({
|
|
10796
10796
|
inContextDrawMatchUps,
|
|
10797
10797
|
drawPosition,
|
|
@@ -10879,7 +10879,7 @@ function assignMatchUpDrawPosition({
|
|
|
10879
10879
|
const inContextTargetMatchUp = inContextDrawMatchUps?.find(
|
|
10880
10880
|
({ matchUpId: matchUpId2 }) => matchUpId2 === matchUp.matchUpId
|
|
10881
10881
|
);
|
|
10882
|
-
const sides = inContextTargetMatchUp?.sides
|
|
10882
|
+
const sides = inContextTargetMatchUp?.sides ?? [];
|
|
10883
10883
|
const drawPositionSideIndex = sides.reduce(
|
|
10884
10884
|
(index, side, i) => side.drawPosition === drawPosition ? i : index,
|
|
10885
10885
|
void 0
|
|
@@ -16342,15 +16342,17 @@ function validateTieFormat(params) {
|
|
|
16342
16342
|
function validateCollectionDefinition({
|
|
16343
16343
|
collectionDefinition,
|
|
16344
16344
|
checkCollectionIds,
|
|
16345
|
+
checkGender = true,
|
|
16345
16346
|
referenceGender,
|
|
16346
|
-
|
|
16347
|
+
event
|
|
16347
16348
|
}) {
|
|
16349
|
+
referenceGender = referenceGender ?? event?.gender;
|
|
16348
16350
|
const errors = [];
|
|
16349
16351
|
if (typeof collectionDefinition !== "object") {
|
|
16350
16352
|
errors.push(
|
|
16351
16353
|
`collectionDefinition must be an object: ${collectionDefinition}`
|
|
16352
16354
|
);
|
|
16353
|
-
return { errors };
|
|
16355
|
+
return { errors, error: INVALID_OBJECT };
|
|
16354
16356
|
}
|
|
16355
16357
|
const {
|
|
16356
16358
|
collectionValueProfiles,
|
|
@@ -16409,7 +16411,7 @@ function validateCollectionDefinition({
|
|
|
16409
16411
|
errors.push(`Invalid gender: ${gender}`);
|
|
16410
16412
|
}
|
|
16411
16413
|
if (errors.length)
|
|
16412
|
-
return { errors };
|
|
16414
|
+
return { errors, error: INVALID_OBJECT };
|
|
16413
16415
|
return { valid: true };
|
|
16414
16416
|
}
|
|
16415
16417
|
function checkTieFormat(tieFormat) {
|
|
@@ -19712,6 +19714,13 @@ function generateAdHocMatchUps({
|
|
|
19712
19714
|
structureId = drawDefinition.structures?.[0]?.structureId;
|
|
19713
19715
|
if (typeof structureId !== "string")
|
|
19714
19716
|
return { error: MISSING_STRUCTURE_ID };
|
|
19717
|
+
if (newRound && !matchUpsCount) {
|
|
19718
|
+
const selectedEntries = drawDefinition?.entries?.filter((entry) => {
|
|
19719
|
+
const entryStatus = entry.entryStatus;
|
|
19720
|
+
return STRUCTURE_SELECTED_STATUSES.includes(entryStatus);
|
|
19721
|
+
}) ?? [];
|
|
19722
|
+
matchUpsCount = Math.floor(selectedEntries?.length / 2) || 1;
|
|
19723
|
+
}
|
|
19715
19724
|
if (participantIdPairings && !Array.isArray(participantIdPairings) || matchUpsCount && !isConvertableInteger(matchUpsCount) || matchUpIds && !Array.isArray(matchUpIds) || !participantIdPairings && !matchUpsCount) {
|
|
19716
19725
|
return { error: INVALID_VALUES, info: "matchUpsCount or pairings error" };
|
|
19717
19726
|
}
|