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/forge/query.d.ts
CHANGED
|
@@ -2043,11 +2043,12 @@ declare function getOrderedDrawPositions({ drawPositions, roundProfile, roundNum
|
|
|
2043
2043
|
};
|
|
2044
2044
|
|
|
2045
2045
|
type GetRoundContextProfileArgs = {
|
|
2046
|
+
drawDefinition?: DrawDefinition;
|
|
2046
2047
|
matchUps: HydratedMatchUp[];
|
|
2047
2048
|
roundNamingPolicy: any;
|
|
2048
2049
|
structure: Structure;
|
|
2049
2050
|
};
|
|
2050
|
-
declare function getRoundContextProfile({ roundNamingPolicy, structure, matchUps, }: GetRoundContextProfileArgs): ResultType & {
|
|
2051
|
+
declare function getRoundContextProfile({ roundNamingPolicy, drawDefinition, structure, matchUps, }: GetRoundContextProfileArgs): ResultType & {
|
|
2051
2052
|
roundNamingProfile?: {
|
|
2052
2053
|
[key: string]: {
|
|
2053
2054
|
roundName: string;
|
|
@@ -2117,11 +2118,11 @@ type GetRoundMatchUpsArgs = {
|
|
|
2117
2118
|
interpolate?: boolean;
|
|
2118
2119
|
};
|
|
2119
2120
|
type RoundMatchUpsResult = {
|
|
2120
|
-
roundsNotPowerOf2?: boolean;
|
|
2121
2121
|
roundMatchUps?: HydratedMatchUp[];
|
|
2122
2122
|
hasNoRoundPositions?: boolean;
|
|
2123
|
-
|
|
2123
|
+
roundsNotPowerOf2?: boolean;
|
|
2124
2124
|
maxMatchUpsCount?: number;
|
|
2125
|
+
roundProfile?: RoundProfile;
|
|
2125
2126
|
roundNumbers?: number[];
|
|
2126
2127
|
error?: ErrorType;
|
|
2127
2128
|
};
|
package/dist/forge/query.mjs
CHANGED
|
@@ -6763,6 +6763,9 @@ const POLICY_ROUND_NAMING_DEFAULT = {
|
|
|
6763
6763
|
namingConventions: {
|
|
6764
6764
|
round: "Round"
|
|
6765
6765
|
},
|
|
6766
|
+
qualifyingFinishMap: {
|
|
6767
|
+
1: "Final"
|
|
6768
|
+
},
|
|
6766
6769
|
abbreviatedRoundNamingMap: {
|
|
6767
6770
|
// key is matchUpsCount for the round
|
|
6768
6771
|
1: "F",
|
|
@@ -6776,7 +6779,8 @@ const POLICY_ROUND_NAMING_DEFAULT = {
|
|
|
6776
6779
|
},
|
|
6777
6780
|
affixes: {
|
|
6778
6781
|
roundNumber: "R",
|
|
6779
|
-
preFeedRound: "Q"
|
|
6782
|
+
preFeedRound: "Q",
|
|
6783
|
+
preQualifying: "P"
|
|
6780
6784
|
},
|
|
6781
6785
|
stageConstants: {
|
|
6782
6786
|
[MAIN]: "",
|
|
@@ -6789,6 +6793,7 @@ const POLICY_ROUND_NAMING_DEFAULT = {
|
|
|
6789
6793
|
|
|
6790
6794
|
function getRoundContextProfile({
|
|
6791
6795
|
roundNamingPolicy,
|
|
6796
|
+
drawDefinition,
|
|
6792
6797
|
structure,
|
|
6793
6798
|
matchUps
|
|
6794
6799
|
}) {
|
|
@@ -6799,21 +6804,31 @@ function getRoundContextProfile({
|
|
|
6799
6804
|
const isRoundRobin = structure.structures;
|
|
6800
6805
|
const roundNamingProfile = {};
|
|
6801
6806
|
const defaultRoundNamingPolicy = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING];
|
|
6807
|
+
const isQualifying = structure.stage === QUALIFYING;
|
|
6808
|
+
const qualifyingFinishgMap = isQualifying && (roundNamingPolicy?.qualifyingFinishMap || defaultRoundNamingPolicy?.qualifyingFinishMap || {});
|
|
6809
|
+
const qualifyingStageSequences = isQualifying ? Math.max(
|
|
6810
|
+
...(drawDefinition?.structures ?? []).filter((structure2) => structure2.stage === QUALIFYING).map(({ stageSequence }) => stageSequence ?? 1),
|
|
6811
|
+
0
|
|
6812
|
+
) : 0;
|
|
6813
|
+
const preQualifyingSequence = qualifyingStageSequences ? qualifyingStageSequences - (structure.stageSequence || 1) || "" : "";
|
|
6814
|
+
const preQualifyingAffix = preQualifyingSequence ? roundNamingPolicy?.affixes?.preQualifying || defaultRoundNamingPolicy.affixes.preQualifying || "" : "";
|
|
6802
6815
|
const roundNamingMap = roundNamingPolicy?.roundNamingMap || defaultRoundNamingPolicy.roundNamingMap || {};
|
|
6803
6816
|
const abbreviatedRoundNamingMap = roundNamingPolicy?.abbreviatedRoundNamingMap || defaultRoundNamingPolicy.abbreviatedRoundNamingMap || {};
|
|
6804
|
-
const
|
|
6805
|
-
const roundNumberAffix =
|
|
6817
|
+
const preFeedAffix = roundNamingPolicy?.affixes?.preFeedRound || defaultRoundNamingPolicy.affixes.preFeedRound;
|
|
6818
|
+
const roundNumberAffix = roundNamingPolicy?.affixes?.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
|
|
6806
6819
|
const namingConventions = roundNamingPolicy?.namingConventions || defaultRoundNamingPolicy.namingConventions;
|
|
6807
6820
|
const roundNameFallback = namingConventions.round;
|
|
6808
|
-
const stageInitial = stage && stage !== MAIN
|
|
6809
|
-
const stageConstants = roundNamingPolicy?.stageConstants;
|
|
6810
|
-
const
|
|
6821
|
+
const stageInitial = stage && stage !== MAIN ? stage[0] : "";
|
|
6822
|
+
const stageConstants = roundNamingPolicy?.stageConstants || defaultRoundNamingPolicy.stageConstants;
|
|
6823
|
+
const stageIndicator = stage && stageConstants?.[stage] || stageInitial;
|
|
6824
|
+
const stageConstant = `${preQualifyingAffix}${stageIndicator}${preQualifyingSequence}`;
|
|
6811
6825
|
const roundProfileKeys = roundProfile ? Object.keys(roundProfile) : [];
|
|
6826
|
+
const qualifyingAffix = isQualifying && stageConstants?.[QUALIFYING] ? `${stageConstants?.[QUALIFYING]}-` : "";
|
|
6812
6827
|
if (isRoundRobin || isAdHocStructure || isLuckyStructure) {
|
|
6813
6828
|
Object.assign(
|
|
6814
6829
|
roundNamingProfile,
|
|
6815
6830
|
...roundProfileKeys.map((key) => {
|
|
6816
|
-
const roundName = `${roundNameFallback} ${key}`;
|
|
6831
|
+
const roundName = `${qualifyingAffix}${roundNameFallback} ${key}`;
|
|
6817
6832
|
const abbreviatedRoundName = `${roundNumberAffix}${key}`;
|
|
6818
6833
|
return { [key]: { roundName, abbreviatedRoundName } };
|
|
6819
6834
|
})
|
|
@@ -6826,15 +6841,15 @@ function getRoundContextProfile({
|
|
|
6826
6841
|
return;
|
|
6827
6842
|
const { matchUpsCount, preFeedRound } = roundProfile[round];
|
|
6828
6843
|
const participantsCount = matchUpsCount * 2;
|
|
6829
|
-
const sizedRoundName = roundNamingMap[matchUpsCount] || `${
|
|
6830
|
-
const suffix = preFeedRound ? `-${
|
|
6844
|
+
const sizedRoundName = qualifyingFinishgMap?.[roundProfile?.[round].finishingRound] || qualifyingFinishgMap && `${roundNumberAffix}${participantsCount}` || roundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
|
|
6845
|
+
const suffix = preFeedRound ? `-${preFeedAffix}` : "";
|
|
6831
6846
|
const profileRoundName = `${sizedRoundName}${suffix}`;
|
|
6832
6847
|
const roundName = [
|
|
6833
6848
|
stageConstant,
|
|
6834
6849
|
structureAbbreviation,
|
|
6835
6850
|
profileRoundName
|
|
6836
6851
|
].filter(Boolean).join("-");
|
|
6837
|
-
const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${
|
|
6852
|
+
const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
|
|
6838
6853
|
const profileAbbreviation = `${sizedAbbreviation}${suffix}`;
|
|
6839
6854
|
const abbreviatedRoundName = [
|
|
6840
6855
|
stageConstant,
|
|
@@ -7008,6 +7023,7 @@ function getAllStructureMatchUps({
|
|
|
7008
7023
|
const roundNamingPolicy = appliedPolicies?.[POLICY_TYPE_ROUND_NAMING];
|
|
7009
7024
|
const result = getRoundContextProfile({
|
|
7010
7025
|
roundNamingPolicy,
|
|
7026
|
+
drawDefinition,
|
|
7011
7027
|
structure,
|
|
7012
7028
|
matchUps
|
|
7013
7029
|
});
|