tods-competition-factory 1.8.22 → 1.8.23
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 +34 -22
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +21 -16
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +11 -6
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +216 -203
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +480 -463
- 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 +2 -2
package/dist/forge/generate.mjs
CHANGED
|
@@ -2071,7 +2071,7 @@ function findVenue({
|
|
|
2071
2071
|
if (!venue && tournamentRecords) {
|
|
2072
2072
|
const linkedTournamentIds = getLinkedTournamentIds({
|
|
2073
2073
|
tournamentRecords
|
|
2074
|
-
}).linkedTournamentIds
|
|
2074
|
+
}).linkedTournamentIds ?? [];
|
|
2075
2075
|
const relevantIds = linkedTournamentIds[tournamentRecord.tournamentId];
|
|
2076
2076
|
for (const tournamentId of relevantIds) {
|
|
2077
2077
|
const record = tournamentRecords[tournamentId];
|
|
@@ -2630,7 +2630,7 @@ function getPairedParticipant({
|
|
|
2630
2630
|
result: { error: MISSING_PARTICIPANT_IDS },
|
|
2631
2631
|
stack
|
|
2632
2632
|
});
|
|
2633
|
-
tournamentParticipants = tournamentParticipants
|
|
2633
|
+
tournamentParticipants = tournamentParticipants ?? tournamentRecord?.participants ?? [];
|
|
2634
2634
|
const existingPairedParticipants = tournamentParticipants.filter(
|
|
2635
2635
|
(participant) => participant.participantType === PAIR && intersection(participantIds, participant.individualParticipantIds).length === participantIds.length && participant.individualParticipantIds.length === participantIds.length
|
|
2636
2636
|
);
|
|
@@ -4354,7 +4354,7 @@ function getRoundContextProfile({
|
|
|
4354
4354
|
...(drawDefinition?.structures ?? []).filter((structure2) => structure2.stage === QUALIFYING).map(({ stageSequence }) => stageSequence ?? 1),
|
|
4355
4355
|
0
|
|
4356
4356
|
) : 0;
|
|
4357
|
-
const preQualifyingSequence = qualifyingStageSequences ? qualifyingStageSequences - (structure.stageSequence
|
|
4357
|
+
const preQualifyingSequence = qualifyingStageSequences ? qualifyingStageSequences - (structure.stageSequence ?? 1) || "" : "";
|
|
4358
4358
|
const preQualifyingAffix = preQualifyingSequence ? roundNamingPolicy?.affixes?.preQualifying || defaultRoundNamingPolicy.affixes.preQualifying || "" : "";
|
|
4359
4359
|
const roundNamingMap = roundNamingPolicy?.roundNamingMap || defaultRoundNamingPolicy.roundNamingMap || {};
|
|
4360
4360
|
const abbreviatedRoundNamingMap = roundNamingPolicy?.abbreviatedRoundNamingMap || defaultRoundNamingPolicy.abbreviatedRoundNamingMap || {};
|
|
@@ -4652,7 +4652,13 @@ function getAllStructureMatchUps({
|
|
|
4652
4652
|
matchUps
|
|
4653
4653
|
}));
|
|
4654
4654
|
}
|
|
4655
|
-
return {
|
|
4655
|
+
return {
|
|
4656
|
+
collectionPositionMatchUps,
|
|
4657
|
+
roundMatchUps,
|
|
4658
|
+
roundProfile,
|
|
4659
|
+
matchUpsMap,
|
|
4660
|
+
matchUps
|
|
4661
|
+
};
|
|
4656
4662
|
function addMatchUpContext({
|
|
4657
4663
|
scheduleVisibilityFilters: scheduleVisibilityFilters2,
|
|
4658
4664
|
sourceDrawPositionRanges,
|
|
@@ -9198,7 +9204,7 @@ function getContainedStructures({
|
|
|
9198
9204
|
const containerStructures = {};
|
|
9199
9205
|
const structureContainers = drawDefinitions.map((dd) => dd?.structures?.filter((structure) => structure?.structures)).flat().filter(Boolean);
|
|
9200
9206
|
for (const structureContainer of structureContainers) {
|
|
9201
|
-
const { structures, structureId } = structureContainer
|
|
9207
|
+
const { structures, structureId } = structureContainer ?? {};
|
|
9202
9208
|
structures && structureId && (containedStructures[structureId] = structures?.map(
|
|
9203
9209
|
(structure) => structure.structureId
|
|
9204
9210
|
)) && structures.forEach(
|
|
@@ -13333,6 +13339,7 @@ function automatedPlayoffPositioning(params) {
|
|
|
13333
13339
|
|
|
13334
13340
|
function getStructureRoundProfile({
|
|
13335
13341
|
drawDefinition,
|
|
13342
|
+
matchUpsMap,
|
|
13336
13343
|
structureId
|
|
13337
13344
|
}) {
|
|
13338
13345
|
const result = findStructure({
|
|
@@ -13340,9 +13347,12 @@ function getStructureRoundProfile({
|
|
|
13340
13347
|
structureId
|
|
13341
13348
|
});
|
|
13342
13349
|
if (result.error)
|
|
13343
|
-
return result;
|
|
13344
|
-
const { matchUps } = getAllStructureMatchUps({
|
|
13345
|
-
|
|
13350
|
+
return decorateResult({ result });
|
|
13351
|
+
const { matchUps } = getAllStructureMatchUps({
|
|
13352
|
+
structure: result.structure,
|
|
13353
|
+
matchUpsMap
|
|
13354
|
+
});
|
|
13355
|
+
return { ...getRoundMatchUps({ matchUps }), matchUps, matchUpsMap };
|
|
13346
13356
|
}
|
|
13347
13357
|
|
|
13348
13358
|
function getFinishingPositionSourceRoundsMap({
|
|
@@ -13393,16 +13403,18 @@ function roundValueRanges(values) {
|
|
|
13393
13403
|
|
|
13394
13404
|
function getPositionsPlayedOff({
|
|
13395
13405
|
drawDefinition,
|
|
13396
|
-
structureIds
|
|
13406
|
+
structureIds,
|
|
13407
|
+
matchUpsMap
|
|
13397
13408
|
}) {
|
|
13398
13409
|
if (structureIds && !Array.isArray(structureIds))
|
|
13399
13410
|
return { error: INVALID_VALUES, context: { structureIds } };
|
|
13400
13411
|
if (!drawDefinition)
|
|
13401
13412
|
return { error: MISSING_DRAW_DEFINITION };
|
|
13402
|
-
structureIds = structureIds
|
|
13413
|
+
structureIds = structureIds ?? (drawDefinition.structures ?? []).filter((structure) => structure.stage !== QUALIFYING).map(({ structureId }) => structureId);
|
|
13403
13414
|
const allFinishingPositionRanges = structureIds.map((structureId) => {
|
|
13404
13415
|
const { roundProfile } = getStructureRoundProfile({
|
|
13405
13416
|
drawDefinition,
|
|
13417
|
+
matchUpsMap,
|
|
13406
13418
|
structureId
|
|
13407
13419
|
});
|
|
13408
13420
|
const values = roundProfile && Object.values(roundProfile);
|
|
@@ -13497,18 +13509,19 @@ function getPlayoffRoundsRanges({ playoffSourceRounds, roundProfile }) {
|
|
|
13497
13509
|
function getAvailablePlayoffProfiles({ drawDefinition, structureId }) {
|
|
13498
13510
|
if (!drawDefinition)
|
|
13499
13511
|
return { error: MISSING_DRAW_DEFINITION };
|
|
13500
|
-
const {
|
|
13512
|
+
const { matchUps, matchUpsMap } = allDrawMatchUps({
|
|
13513
|
+
inContext: true,
|
|
13501
13514
|
drawDefinition
|
|
13502
13515
|
});
|
|
13516
|
+
const { positionsNotPlayedOff, positionsPlayedOff } = getPositionsPlayedOff({
|
|
13517
|
+
drawDefinition,
|
|
13518
|
+
matchUpsMap
|
|
13519
|
+
});
|
|
13503
13520
|
const { structures } = getDrawStructures({ drawDefinition });
|
|
13504
13521
|
const filteredStructures = structures.filter(
|
|
13505
13522
|
(structure) => !structureId && structure.stage !== VOLUNTARY_CONSOLATION || structure.structureId === structureId
|
|
13506
13523
|
);
|
|
13507
13524
|
const available = {};
|
|
13508
|
-
const matchUps = allDrawMatchUps({
|
|
13509
|
-
inContext: true,
|
|
13510
|
-
drawDefinition
|
|
13511
|
-
}).matchUps;
|
|
13512
13525
|
for (const structure of filteredStructures) {
|
|
13513
13526
|
const structureId2 = structure?.structureId;
|
|
13514
13527
|
const result = availablePlayoffProfiles({
|
|
@@ -13982,7 +13995,7 @@ function treeMatchUps({
|
|
|
13982
13995
|
uuids
|
|
13983
13996
|
}));
|
|
13984
13997
|
roundNumber++;
|
|
13985
|
-
roundLimit = roundLimit
|
|
13998
|
+
roundLimit = roundLimit ?? qualifyingRoundNumber;
|
|
13986
13999
|
while (roundNodes.length > 1) {
|
|
13987
14000
|
if (qualifyingPositions && roundNodes.length === qualifyingPositions) {
|
|
13988
14001
|
roundLimit = roundNumber - 1;
|
|
@@ -14010,7 +14023,7 @@ function treeMatchUps({
|
|
|
14010
14023
|
roundLimit = roundNumber - 1;
|
|
14011
14024
|
} else {
|
|
14012
14025
|
matchUps = matchUps.filter(
|
|
14013
|
-
(matchUp) => roundLimit && (matchUp.roundNumber
|
|
14026
|
+
(matchUp) => roundLimit && (matchUp.roundNumber ?? 0) <= roundLimit
|
|
14014
14027
|
);
|
|
14015
14028
|
}
|
|
14016
14029
|
return { drawSize, matchUps, roundsCount, roundLimit };
|
|
@@ -19096,7 +19109,7 @@ function filterParticipants({
|
|
|
19096
19109
|
);
|
|
19097
19110
|
if (event.eventType === SINGLES)
|
|
19098
19111
|
return enteredParticipantIds;
|
|
19099
|
-
const individualParticipantIds = (tournamentRecord?.participants
|
|
19112
|
+
const individualParticipantIds = (tournamentRecord?.participants ?? []).filter(
|
|
19100
19113
|
(participant) => enteredParticipantIds.includes(participant.participantId)
|
|
19101
19114
|
).map((participant) => participant.individualParticipantIds).flat(1);
|
|
19102
19115
|
return enteredParticipantIds.concat(...individualParticipantIds);
|
|
@@ -20695,7 +20708,6 @@ function generateQualifyingStructures({
|
|
|
20695
20708
|
roundTarget,
|
|
20696
20709
|
linkType
|
|
20697
20710
|
});
|
|
20698
|
-
targetRoundQualifiersCount = 0;
|
|
20699
20711
|
roundTarget += 1;
|
|
20700
20712
|
}
|
|
20701
20713
|
return {
|
|
@@ -23000,7 +23012,7 @@ function getScaledEntries({
|
|
|
23000
23012
|
}) {
|
|
23001
23013
|
if (!tournamentRecord)
|
|
23002
23014
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
23003
|
-
entries = entries
|
|
23015
|
+
entries = entries ?? event?.entries ?? [];
|
|
23004
23016
|
const stageEntries = entries.filter(
|
|
23005
23017
|
(entry) => (!stage || !entry.entryStage || entry.entryStage === stage) && (!stageSequence || !entry.entryStageSequence || entry.entryStageSequence === stageSequence) && STRUCTURE_SELECTED_STATUSES.includes(entry.entryStatus)
|
|
23006
23018
|
);
|
|
@@ -23871,7 +23883,7 @@ function generateFlightProfile(params) {
|
|
|
23871
23883
|
} = params;
|
|
23872
23884
|
if (!event)
|
|
23873
23885
|
return { error: MISSING_EVENT };
|
|
23874
|
-
const eventEntries = event.entries
|
|
23886
|
+
const eventEntries = event.entries ?? [];
|
|
23875
23887
|
const { flightProfile } = getFlightProfile({ event });
|
|
23876
23888
|
if (flightProfile && attachFlightProfile$1 && !deleteExisting) {
|
|
23877
23889
|
return { error: EXISTING_PROFILE };
|
|
@@ -23920,7 +23932,7 @@ function generateFlightProfile(params) {
|
|
|
23920
23932
|
const flightNumber = index + 1;
|
|
23921
23933
|
return {
|
|
23922
23934
|
flightNumber,
|
|
23923
|
-
drawId: uuids?.pop()
|
|
23935
|
+
drawId: uuids?.pop() ?? UUID(),
|
|
23924
23936
|
drawEntries: getDrawEntries(splitEntries[index]),
|
|
23925
23937
|
drawName: drawNames?.length && drawNames[index] || `${drawNameRoot} ${flightNumber}`
|
|
23926
23938
|
};
|