tods-competition-factory 1.7.0 → 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 +22 -9
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +6 -2
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +15 -9
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +76 -23
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +91 -52
- 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 +14 -13
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
|
|
@@ -16225,11 +16225,15 @@ function isValid(matchUpFormat) {
|
|
|
16225
16225
|
if (typeof matchUpFormat !== "string")
|
|
16226
16226
|
return false;
|
|
16227
16227
|
const parsedFormat = parse(matchUpFormat);
|
|
16228
|
-
const setParts = matchUpFormat.match(
|
|
16228
|
+
const setParts = matchUpFormat.match(
|
|
16229
|
+
/-S:([1-9])+\/TB([0-9]{1,2})@?([1-9]?)*/
|
|
16230
|
+
);
|
|
16229
16231
|
const setsTo = setParts?.[1];
|
|
16230
16232
|
const tiebreakTo = setParts?.[2];
|
|
16231
16233
|
const tiebreakAt = setParts?.[3];
|
|
16232
|
-
const finalSetParts = matchUpFormat.match(
|
|
16234
|
+
const finalSetParts = matchUpFormat.match(
|
|
16235
|
+
/-F:([1-9])+\/TB([0-9]{1,2})@?([1-9]?)*/
|
|
16236
|
+
);
|
|
16233
16237
|
const finalSetTo = finalSetParts?.[1];
|
|
16234
16238
|
const finalSetTiebreakTo = finalSetParts?.[2];
|
|
16235
16239
|
const finalTiebreakAt = finalSetParts?.[3];
|
|
@@ -16338,15 +16342,17 @@ function validateTieFormat(params) {
|
|
|
16338
16342
|
function validateCollectionDefinition({
|
|
16339
16343
|
collectionDefinition,
|
|
16340
16344
|
checkCollectionIds,
|
|
16345
|
+
checkGender = true,
|
|
16341
16346
|
referenceGender,
|
|
16342
|
-
|
|
16347
|
+
event
|
|
16343
16348
|
}) {
|
|
16349
|
+
referenceGender = referenceGender ?? event?.gender;
|
|
16344
16350
|
const errors = [];
|
|
16345
16351
|
if (typeof collectionDefinition !== "object") {
|
|
16346
16352
|
errors.push(
|
|
16347
16353
|
`collectionDefinition must be an object: ${collectionDefinition}`
|
|
16348
16354
|
);
|
|
16349
|
-
return { errors };
|
|
16355
|
+
return { errors, error: INVALID_OBJECT };
|
|
16350
16356
|
}
|
|
16351
16357
|
const {
|
|
16352
16358
|
collectionValueProfiles,
|
|
@@ -16405,7 +16411,7 @@ function validateCollectionDefinition({
|
|
|
16405
16411
|
errors.push(`Invalid gender: ${gender}`);
|
|
16406
16412
|
}
|
|
16407
16413
|
if (errors.length)
|
|
16408
|
-
return { errors };
|
|
16414
|
+
return { errors, error: INVALID_OBJECT };
|
|
16409
16415
|
return { valid: true };
|
|
16410
16416
|
}
|
|
16411
16417
|
function checkTieFormat(tieFormat) {
|
|
@@ -19708,6 +19714,13 @@ function generateAdHocMatchUps({
|
|
|
19708
19714
|
structureId = drawDefinition.structures?.[0]?.structureId;
|
|
19709
19715
|
if (typeof structureId !== "string")
|
|
19710
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
|
+
}
|
|
19711
19724
|
if (participantIdPairings && !Array.isArray(participantIdPairings) || matchUpsCount && !isConvertableInteger(matchUpsCount) || matchUpIds && !Array.isArray(matchUpIds) || !participantIdPairings && !matchUpsCount) {
|
|
19712
19725
|
return { error: INVALID_VALUES, info: "matchUpsCount or pairings error" };
|
|
19713
19726
|
}
|