tods-competition-factory 1.7.1 → 1.7.3
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 +32 -14
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +1 -1
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +10 -8
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +92 -32
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +117 -64
- 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/transform.mjs
CHANGED
|
@@ -1762,15 +1762,17 @@ function validateTieFormat(params) {
|
|
|
1762
1762
|
function validateCollectionDefinition({
|
|
1763
1763
|
collectionDefinition,
|
|
1764
1764
|
checkCollectionIds,
|
|
1765
|
+
checkGender = true,
|
|
1765
1766
|
referenceGender,
|
|
1766
|
-
|
|
1767
|
+
event
|
|
1767
1768
|
}) {
|
|
1769
|
+
referenceGender = referenceGender ?? event?.gender;
|
|
1768
1770
|
const errors = [];
|
|
1769
1771
|
if (typeof collectionDefinition !== "object") {
|
|
1770
1772
|
errors.push(
|
|
1771
1773
|
`collectionDefinition must be an object: ${collectionDefinition}`
|
|
1772
1774
|
);
|
|
1773
|
-
return { errors };
|
|
1775
|
+
return { errors, error: INVALID_OBJECT };
|
|
1774
1776
|
}
|
|
1775
1777
|
const {
|
|
1776
1778
|
collectionValueProfiles,
|
|
@@ -1829,7 +1831,7 @@ function validateCollectionDefinition({
|
|
|
1829
1831
|
errors.push(`Invalid gender: ${gender}`);
|
|
1830
1832
|
}
|
|
1831
1833
|
if (errors.length)
|
|
1832
|
-
return { errors };
|
|
1834
|
+
return { errors, error: INVALID_OBJECT };
|
|
1833
1835
|
return { valid: true };
|
|
1834
1836
|
}
|
|
1835
1837
|
function validateCollectionValueProfile({
|
|
@@ -4443,7 +4445,7 @@ function getRoundMatchUps({
|
|
|
4443
4445
|
roundProfile[roundNumber].finishingRound = finishingRoundMap[roundNumber]?.finishingRound;
|
|
4444
4446
|
roundProfile[roundNumber].roundName = finishingRoundMap[roundNumber]?.roundName;
|
|
4445
4447
|
roundProfile[roundNumber].abbreviatedRoundName = finishingRoundMap[roundNumber]?.abbreviatedRoundName;
|
|
4446
|
-
roundProfile[roundNumber].finishingPositionRange = roundMatchUps[roundNumber][0]
|
|
4448
|
+
roundProfile[roundNumber].finishingPositionRange = roundMatchUps[roundNumber]?.[0]?.finishingPositionRange;
|
|
4447
4449
|
if (roundNumber === 1 || !roundProfile[roundNumber - 1]) {
|
|
4448
4450
|
const orderedDrawPositions = currentRoundDrawPositions.sort(numericSort);
|
|
4449
4451
|
const pairedDrawPositions = chunkArray(orderedDrawPositions, 2);
|
|
@@ -12227,7 +12229,7 @@ function assignMatchUpDrawPosition({
|
|
|
12227
12229
|
inContext: true,
|
|
12228
12230
|
drawDefinition,
|
|
12229
12231
|
matchUpsMap
|
|
12230
|
-
}).matchUps
|
|
12232
|
+
}).matchUps ?? [];
|
|
12231
12233
|
}
|
|
12232
12234
|
const inContextMatchUp = inContextDrawMatchUps.find(
|
|
12233
12235
|
(m) => m.matchUpId === matchUpId
|
|
@@ -12241,7 +12243,7 @@ function assignMatchUpDrawPosition({
|
|
|
12241
12243
|
const matchUp = matchUpsMap?.drawMatchUps?.find(
|
|
12242
12244
|
(matchUp2) => matchUp2.matchUpId === matchUpId
|
|
12243
12245
|
);
|
|
12244
|
-
const drawPositions = matchUp?.drawPositions
|
|
12246
|
+
const drawPositions = matchUp?.drawPositions ?? [];
|
|
12245
12247
|
const { positionAdded, positionAssigned, updatedDrawPositions } = getUpdatedDrawPositions({ drawPosition, drawPositions });
|
|
12246
12248
|
const { positionAssignments } = getPositionAssignments({
|
|
12247
12249
|
drawDefinition,
|
|
@@ -12258,7 +12260,7 @@ function assignMatchUpDrawPosition({
|
|
|
12258
12260
|
inContext: true,
|
|
12259
12261
|
drawDefinition,
|
|
12260
12262
|
matchUpsMap
|
|
12261
|
-
}).matchUps
|
|
12263
|
+
}).matchUps ?? [];
|
|
12262
12264
|
const exitWinningSide = isDoubleExitExit && getExitWinningSide({
|
|
12263
12265
|
inContextDrawMatchUps,
|
|
12264
12266
|
drawPosition,
|
|
@@ -12346,7 +12348,7 @@ function assignMatchUpDrawPosition({
|
|
|
12346
12348
|
const inContextTargetMatchUp = inContextDrawMatchUps?.find(
|
|
12347
12349
|
({ matchUpId: matchUpId2 }) => matchUpId2 === matchUp.matchUpId
|
|
12348
12350
|
);
|
|
12349
|
-
const sides = inContextTargetMatchUp?.sides
|
|
12351
|
+
const sides = inContextTargetMatchUp?.sides ?? [];
|
|
12350
12352
|
const drawPositionSideIndex = sides.reduce(
|
|
12351
12353
|
(index, side, i) => side.drawPosition === drawPosition ? i : index,
|
|
12352
12354
|
void 0
|