tods-competition-factory 1.6.28 → 1.6.29
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/README.md +3 -3
- package/dist/forge/generate.d.ts +2 -1
- package/dist/forge/generate.mjs +18 -9
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/index.mjs +19 -10
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +43 -25
- 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 +1 -1
package/dist/index.mjs
CHANGED
|
@@ -329,7 +329,7 @@ const matchUpFormatCode = {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
function factoryVersion() {
|
|
332
|
-
return "1.6.
|
|
332
|
+
return "1.6.29";
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
function getObjectTieFormat(obj) {
|
|
@@ -40001,9 +40001,9 @@ function processPlayoffGroups({
|
|
|
40001
40001
|
for (const playoffGroup of playoffGroups) {
|
|
40002
40002
|
const finishingPositions = playoffGroup.finishingPositions;
|
|
40003
40003
|
const positionsPlayedOff = positionRangeMap && finishingPositions.map((p) => positionRangeMap[p]?.finishingPositions).flat();
|
|
40004
|
-
const playoffDrawType = playoffGroup.drawType || SINGLE_ELIMINATION;
|
|
40005
40004
|
const participantsInDraw = groupCount * finishingPositions.length;
|
|
40006
40005
|
const drawSize = nextPowerOf2(participantsInDraw);
|
|
40006
|
+
const playoffDrawType = drawSize === 2 && SINGLE_ELIMINATION || playoffGroup.drawType || SINGLE_ELIMINATION;
|
|
40007
40007
|
if (positionsPlayedOff) {
|
|
40008
40008
|
finishingPositionOffset = Math.min(...positionsPlayedOff) - 1;
|
|
40009
40009
|
}
|
|
@@ -40570,9 +40570,9 @@ function getGenerators(params) {
|
|
|
40570
40570
|
function generateDrawStructuresAndLinks$1(params) {
|
|
40571
40571
|
const {
|
|
40572
40572
|
enforceMinimumDrawSize = true,
|
|
40573
|
-
|
|
40574
|
-
drawTypeCoercion,
|
|
40573
|
+
drawTypeCoercion = true,
|
|
40575
40574
|
// coerce to SINGLE_ELIMINATION for drawSize: 2
|
|
40575
|
+
overwriteExisting,
|
|
40576
40576
|
appliedPolicies,
|
|
40577
40577
|
staggeredEntry,
|
|
40578
40578
|
// optional - specifies main structure FEED_IN for drawTypes CURTIS_CONSOLATION, FEED_IN_CHAMPIONSHIPS, FMLC
|
|
@@ -40583,7 +40583,7 @@ function generateDrawStructuresAndLinks$1(params) {
|
|
|
40583
40583
|
uuids
|
|
40584
40584
|
} = params || {};
|
|
40585
40585
|
const stack = "generateDrawStructuresAndLinks";
|
|
40586
|
-
let drawType = params.drawType
|
|
40586
|
+
let drawType = drawTypeCoercion && params.drawSize === 2 && DrawTypeEnum.SingleElimination || params.drawType || DrawTypeEnum.SingleElimination;
|
|
40587
40587
|
const structures = [], links = [];
|
|
40588
40588
|
const matchUpType = params?.matchUpType ?? SINGLES$1;
|
|
40589
40589
|
const existingQualifyingStructures = drawDefinition?.structures?.filter(
|
|
@@ -54732,9 +54732,12 @@ function addEventEntryPairs({
|
|
|
54732
54732
|
|
|
54733
54733
|
function checkValidEntries({
|
|
54734
54734
|
enforceGender = true,
|
|
54735
|
+
consideredEntries,
|
|
54736
|
+
tournamentRecord,
|
|
54735
54737
|
participants,
|
|
54736
54738
|
event
|
|
54737
54739
|
}) {
|
|
54740
|
+
participants = participants || tournamentRecord?.participants;
|
|
54738
54741
|
if (!participants)
|
|
54739
54742
|
return { error: MISSING_PARTICIPANTS };
|
|
54740
54743
|
if (!Array.isArray(participants))
|
|
@@ -54745,7 +54748,7 @@ function checkValidEntries({
|
|
|
54745
54748
|
const participantType = eventType === TEAM_EVENT && TEAM || eventType === DOUBLES_EVENT && PAIR || INDIVIDUAL;
|
|
54746
54749
|
const entryStatusMap = Object.assign(
|
|
54747
54750
|
{},
|
|
54748
|
-
...(event.entries || []).map((entry) => ({
|
|
54751
|
+
...(consideredEntries || event.entries || []).map((entry) => ({
|
|
54749
54752
|
[entry.participantId]: entry.entryStatus
|
|
54750
54753
|
}))
|
|
54751
54754
|
);
|
|
@@ -57338,9 +57341,9 @@ function prepareStage(params) {
|
|
|
57338
57341
|
function generateDrawDefinition(params) {
|
|
57339
57342
|
const stack = "generateDrawDefinition";
|
|
57340
57343
|
const {
|
|
57341
|
-
drawType = DrawTypeEnum.SingleElimination,
|
|
57342
57344
|
considerEventEntries = true,
|
|
57343
57345
|
// in the absence of drawSize and drawEntries, look to event.entries
|
|
57346
|
+
drawTypeCoercion = true,
|
|
57344
57347
|
ignoreAllowedDrawTypes,
|
|
57345
57348
|
voluntaryConsolation,
|
|
57346
57349
|
hydrateCollections,
|
|
@@ -57354,6 +57357,7 @@ function generateDrawDefinition(params) {
|
|
|
57354
57357
|
placeByes,
|
|
57355
57358
|
event
|
|
57356
57359
|
} = params;
|
|
57360
|
+
const drawType = drawTypeCoercion && params.drawSize === 2 && DrawTypeEnum.SingleElimination || params.drawType || DrawTypeEnum.SingleElimination;
|
|
57357
57361
|
const { tournamentParticipants: participants } = getTournamentParticipants({
|
|
57358
57362
|
tournamentRecord,
|
|
57359
57363
|
inContext: true
|
|
@@ -57363,9 +57367,6 @@ function generateDrawDefinition(params) {
|
|
|
57363
57367
|
event
|
|
57364
57368
|
}).appliedPolicies ?? {};
|
|
57365
57369
|
const enforceGender = params.enforceGender ?? policyDefinitions?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender ?? appliedPolicies?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender;
|
|
57366
|
-
const validEntriesResult = event && participants && checkValidEntries({ event, participants, enforceGender });
|
|
57367
|
-
if (validEntriesResult?.error)
|
|
57368
|
-
return decorateResult({ result: validEntriesResult, stack });
|
|
57369
57370
|
const allowedDrawTypes = !ignoreAllowedDrawTypes && tournamentRecord && getAllowedDrawTypes({
|
|
57370
57371
|
tournamentRecord,
|
|
57371
57372
|
categoryType: event?.category?.categoryType,
|
|
@@ -57378,6 +57379,14 @@ function generateDrawDefinition(params) {
|
|
|
57378
57379
|
(entry) => entry.entryStatus && [...STRUCTURE_ENTERED_TYPES, QUALIFIER].includes(entry.entryStatus)
|
|
57379
57380
|
) ?? [];
|
|
57380
57381
|
const consideredEntries = (qualifyingOnly && [] || drawEntries || (considerEventEntries ? eventEntries : [])).filter(({ entryStage }) => !entryStage || entryStage === MAIN);
|
|
57382
|
+
const validEntriesResult = event && participants && checkValidEntries({
|
|
57383
|
+
consideredEntries,
|
|
57384
|
+
enforceGender,
|
|
57385
|
+
participants,
|
|
57386
|
+
event
|
|
57387
|
+
});
|
|
57388
|
+
if (validEntriesResult?.error)
|
|
57389
|
+
return decorateResult({ result: validEntriesResult, stack });
|
|
57381
57390
|
const derivedDrawSize = !params.drawSize && consideredEntries.length && ![
|
|
57382
57391
|
AD_HOC,
|
|
57383
57392
|
DOUBLE_ELIMINATION,
|