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