tods-competition-factory 1.8.20 → 1.8.21
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 +26 -10
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +4 -3
- package/dist/forge/query.mjs +26 -10
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +28 -12
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +54 -17
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +76 -30
- 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
|
@@ -2382,7 +2382,7 @@ const matchUpFormatCode = {
|
|
|
2382
2382
|
};
|
|
2383
2383
|
|
|
2384
2384
|
function factoryVersion() {
|
|
2385
|
-
return "1.8.
|
|
2385
|
+
return "1.8.21";
|
|
2386
2386
|
}
|
|
2387
2387
|
|
|
2388
2388
|
function getObjectTieFormat(obj) {
|
|
@@ -5260,8 +5260,8 @@ function unlinkTournament({
|
|
|
5260
5260
|
tournamentIds.every((currentTournamentId) => {
|
|
5261
5261
|
const tournamentRecord = tournamentRecords[currentTournamentId];
|
|
5262
5262
|
const { extension } = findTournamentExtension({
|
|
5263
|
-
|
|
5264
|
-
|
|
5263
|
+
name: LINKED_TOURNAMENTS,
|
|
5264
|
+
tournamentRecord
|
|
5265
5265
|
});
|
|
5266
5266
|
if (!extension)
|
|
5267
5267
|
return true;
|
|
@@ -7778,6 +7778,9 @@ const POLICY_ROUND_NAMING_DEFAULT = {
|
|
|
7778
7778
|
namingConventions: {
|
|
7779
7779
|
round: "Round"
|
|
7780
7780
|
},
|
|
7781
|
+
qualifyingFinishMap: {
|
|
7782
|
+
1: "Final"
|
|
7783
|
+
},
|
|
7781
7784
|
abbreviatedRoundNamingMap: {
|
|
7782
7785
|
// key is matchUpsCount for the round
|
|
7783
7786
|
1: "F",
|
|
@@ -7791,7 +7794,8 @@ const POLICY_ROUND_NAMING_DEFAULT = {
|
|
|
7791
7794
|
},
|
|
7792
7795
|
affixes: {
|
|
7793
7796
|
roundNumber: "R",
|
|
7794
|
-
preFeedRound: "Q"
|
|
7797
|
+
preFeedRound: "Q",
|
|
7798
|
+
preQualifying: "P"
|
|
7795
7799
|
},
|
|
7796
7800
|
stageConstants: {
|
|
7797
7801
|
[MAIN]: "",
|
|
@@ -7804,6 +7808,7 @@ const POLICY_ROUND_NAMING_DEFAULT = {
|
|
|
7804
7808
|
|
|
7805
7809
|
function getRoundContextProfile({
|
|
7806
7810
|
roundNamingPolicy,
|
|
7811
|
+
drawDefinition,
|
|
7807
7812
|
structure,
|
|
7808
7813
|
matchUps
|
|
7809
7814
|
}) {
|
|
@@ -7814,21 +7819,31 @@ function getRoundContextProfile({
|
|
|
7814
7819
|
const isRoundRobin = structure.structures;
|
|
7815
7820
|
const roundNamingProfile = {};
|
|
7816
7821
|
const defaultRoundNamingPolicy = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING];
|
|
7822
|
+
const isQualifying = structure.stage === QUALIFYING;
|
|
7823
|
+
const qualifyingFinishgMap = isQualifying && (roundNamingPolicy?.qualifyingFinishMap || defaultRoundNamingPolicy?.qualifyingFinishMap || {});
|
|
7824
|
+
const qualifyingStageSequences = isQualifying ? Math.max(
|
|
7825
|
+
...(drawDefinition?.structures ?? []).filter((structure2) => structure2.stage === QUALIFYING).map(({ stageSequence }) => stageSequence ?? 1),
|
|
7826
|
+
0
|
|
7827
|
+
) : 0;
|
|
7828
|
+
const preQualifyingSequence = qualifyingStageSequences ? qualifyingStageSequences - (structure.stageSequence || 1) || "" : "";
|
|
7829
|
+
const preQualifyingAffix = preQualifyingSequence ? roundNamingPolicy?.affixes?.preQualifying || defaultRoundNamingPolicy.affixes.preQualifying || "" : "";
|
|
7817
7830
|
const roundNamingMap = roundNamingPolicy?.roundNamingMap || defaultRoundNamingPolicy.roundNamingMap || {};
|
|
7818
7831
|
const abbreviatedRoundNamingMap = roundNamingPolicy?.abbreviatedRoundNamingMap || defaultRoundNamingPolicy.abbreviatedRoundNamingMap || {};
|
|
7819
|
-
const
|
|
7820
|
-
const roundNumberAffix =
|
|
7832
|
+
const preFeedAffix = roundNamingPolicy?.affixes?.preFeedRound || defaultRoundNamingPolicy.affixes.preFeedRound;
|
|
7833
|
+
const roundNumberAffix = roundNamingPolicy?.affixes?.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
|
|
7821
7834
|
const namingConventions = roundNamingPolicy?.namingConventions || defaultRoundNamingPolicy.namingConventions;
|
|
7822
7835
|
const roundNameFallback = namingConventions.round;
|
|
7823
|
-
const stageInitial = stage && stage !== MAIN
|
|
7824
|
-
const stageConstants = roundNamingPolicy?.stageConstants;
|
|
7825
|
-
const
|
|
7836
|
+
const stageInitial = stage && stage !== MAIN ? stage[0] : "";
|
|
7837
|
+
const stageConstants = roundNamingPolicy?.stageConstants || defaultRoundNamingPolicy.stageConstants;
|
|
7838
|
+
const stageIndicator = stage && stageConstants?.[stage] || stageInitial;
|
|
7839
|
+
const stageConstant = `${preQualifyingAffix}${stageIndicator}${preQualifyingSequence}`;
|
|
7826
7840
|
const roundProfileKeys = roundProfile ? Object.keys(roundProfile) : [];
|
|
7841
|
+
const qualifyingAffix = isQualifying && stageConstants?.[QUALIFYING] ? `${stageConstants?.[QUALIFYING]}-` : "";
|
|
7827
7842
|
if (isRoundRobin || isAdHocStructure || isLuckyStructure) {
|
|
7828
7843
|
Object.assign(
|
|
7829
7844
|
roundNamingProfile,
|
|
7830
7845
|
...roundProfileKeys.map((key) => {
|
|
7831
|
-
const roundName = `${roundNameFallback} ${key}`;
|
|
7846
|
+
const roundName = `${qualifyingAffix}${roundNameFallback} ${key}`;
|
|
7832
7847
|
const abbreviatedRoundName = `${roundNumberAffix}${key}`;
|
|
7833
7848
|
return { [key]: { roundName, abbreviatedRoundName } };
|
|
7834
7849
|
})
|
|
@@ -7841,15 +7856,15 @@ function getRoundContextProfile({
|
|
|
7841
7856
|
return;
|
|
7842
7857
|
const { matchUpsCount, preFeedRound } = roundProfile[round];
|
|
7843
7858
|
const participantsCount = matchUpsCount * 2;
|
|
7844
|
-
const sizedRoundName = roundNamingMap[matchUpsCount] || `${
|
|
7845
|
-
const suffix = preFeedRound ? `-${
|
|
7859
|
+
const sizedRoundName = qualifyingFinishgMap?.[roundProfile?.[round].finishingRound] || qualifyingFinishgMap && `${roundNumberAffix}${participantsCount}` || roundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
|
|
7860
|
+
const suffix = preFeedRound ? `-${preFeedAffix}` : "";
|
|
7846
7861
|
const profileRoundName = `${sizedRoundName}${suffix}`;
|
|
7847
7862
|
const roundName = [
|
|
7848
7863
|
stageConstant,
|
|
7849
7864
|
structureAbbreviation,
|
|
7850
7865
|
profileRoundName
|
|
7851
7866
|
].filter(Boolean).join("-");
|
|
7852
|
-
const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${
|
|
7867
|
+
const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
|
|
7853
7868
|
const profileAbbreviation = `${sizedAbbreviation}${suffix}`;
|
|
7854
7869
|
const abbreviatedRoundName = [
|
|
7855
7870
|
stageConstant,
|
|
@@ -8033,6 +8048,7 @@ function getAllStructureMatchUps({
|
|
|
8033
8048
|
const roundNamingPolicy = appliedPolicies?.[POLICY_TYPE_ROUND_NAMING];
|
|
8034
8049
|
const result = getRoundContextProfile({
|
|
8035
8050
|
roundNamingPolicy,
|
|
8051
|
+
drawDefinition,
|
|
8036
8052
|
structure,
|
|
8037
8053
|
matchUps
|
|
8038
8054
|
});
|
|
@@ -43414,7 +43430,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
43414
43430
|
let chainModified;
|
|
43415
43431
|
while (!chainModified && nextStructureId) {
|
|
43416
43432
|
targetStructure.stageSequence = nextStageSequence;
|
|
43417
|
-
const targetTargetStructureId = drawDefinition.links
|
|
43433
|
+
const targetTargetStructureId = drawDefinition.links?.find(
|
|
43418
43434
|
(link2) => link2.source.structureId === nextStructureId
|
|
43419
43435
|
)?.target?.structureId;
|
|
43420
43436
|
nextStructureId = targetTargetStructureId;
|
|
@@ -48563,7 +48579,8 @@ const entryGovernor = {
|
|
|
48563
48579
|
};
|
|
48564
48580
|
|
|
48565
48581
|
const linkGovernor = {
|
|
48566
|
-
generateQualifyingLink
|
|
48582
|
+
generateQualifyingLink,
|
|
48583
|
+
getStructureLinks
|
|
48567
48584
|
};
|
|
48568
48585
|
|
|
48569
48586
|
const definitionTemplate = () => ({
|
|
@@ -54047,8 +54064,8 @@ function analyzeDraws({ tournamentRecord }) {
|
|
|
54047
54064
|
({ inactiveStructure }) => !inactiveStructure
|
|
54048
54065
|
).length;
|
|
54049
54066
|
const { links } = getStructureLinks({
|
|
54050
|
-
|
|
54051
|
-
|
|
54067
|
+
structureId: mainStructure.structureId,
|
|
54068
|
+
drawDefinition
|
|
54052
54069
|
});
|
|
54053
54070
|
const isMatchPlay = ensureInt(mainStructure.activeRounds[0]) === 1 && mainStructure.activeRounds.length === 1 && activeStructuresCount === 1;
|
|
54054
54071
|
const inactiveDraw = structuresData?.every(
|
|
@@ -59401,6 +59418,25 @@ function generateDrawDefinition(params) {
|
|
|
59401
59418
|
};
|
|
59402
59419
|
}
|
|
59403
59420
|
|
|
59421
|
+
function isValidForQualifying({ structureId, drawDefinition }) {
|
|
59422
|
+
if (!drawDefinition)
|
|
59423
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
59424
|
+
if (!isString(structureId))
|
|
59425
|
+
return { error: INVALID_VALUES };
|
|
59426
|
+
const result = getStructureLinks({
|
|
59427
|
+
drawDefinition,
|
|
59428
|
+
structureId
|
|
59429
|
+
});
|
|
59430
|
+
if (result.error)
|
|
59431
|
+
return result;
|
|
59432
|
+
const targetFeedProfiles = result.links.target.flatMap((t) => t.target.feedProfile).filter(Boolean);
|
|
59433
|
+
const valid = !!intersection(
|
|
59434
|
+
[BOTTOM_UP, TOP_DOWN, RANDOM],
|
|
59435
|
+
targetFeedProfiles
|
|
59436
|
+
).length;
|
|
59437
|
+
return { ...SUCCESS, valid };
|
|
59438
|
+
}
|
|
59439
|
+
|
|
59404
59440
|
function renameStructures(params) {
|
|
59405
59441
|
return renameStructures$1(params);
|
|
59406
59442
|
}
|
|
@@ -59598,6 +59634,7 @@ const eventGovernor = {
|
|
|
59598
59634
|
attachQualifyingStructure,
|
|
59599
59635
|
attachPlayoffStructures,
|
|
59600
59636
|
addQualifyingStructure,
|
|
59637
|
+
isValidForQualifying,
|
|
59601
59638
|
setStructureOrder,
|
|
59602
59639
|
attachStructures,
|
|
59603
59640
|
renameStructures,
|