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
|
@@ -2905,7 +2905,7 @@ var matchUpFormatCode = {
|
|
|
2905
2905
|
};
|
|
2906
2906
|
|
|
2907
2907
|
function factoryVersion() {
|
|
2908
|
-
return '1.8.
|
|
2908
|
+
return '1.8.22';
|
|
2909
2909
|
}
|
|
2910
2910
|
|
|
2911
2911
|
function getObjectTieFormat(obj) {
|
|
@@ -6434,8 +6434,8 @@ function unlinkTournament(_a) {
|
|
|
6434
6434
|
var _a;
|
|
6435
6435
|
var tournamentRecord = tournamentRecords[currentTournamentId];
|
|
6436
6436
|
var extension = findTournamentExtension({
|
|
6437
|
-
tournamentRecord: tournamentRecord,
|
|
6438
6437
|
name: LINKED_TOURNAMENTS,
|
|
6438
|
+
tournamentRecord: tournamentRecord,
|
|
6439
6439
|
}).extension;
|
|
6440
6440
|
// if there is no extension return { ...SUCCESS } because no links exist
|
|
6441
6441
|
if (!extension)
|
|
@@ -8112,7 +8112,6 @@ var DIRECT_ENTRY_STATUSES = [
|
|
|
8112
8112
|
var STRUCTURE_SELECTED_STATUSES = [
|
|
8113
8113
|
CONFIRMED,
|
|
8114
8114
|
DIRECT_ACCEPTANCE,
|
|
8115
|
-
FEED_IN,
|
|
8116
8115
|
JUNIOR_EXEMPT,
|
|
8117
8116
|
LUCKY_LOSER,
|
|
8118
8117
|
QUALIFIER,
|
|
@@ -9241,6 +9240,9 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
|
9241
9240
|
namingConventions: {
|
|
9242
9241
|
round: 'Round',
|
|
9243
9242
|
},
|
|
9243
|
+
qualifyingFinishMap: {
|
|
9244
|
+
1: 'Final',
|
|
9245
|
+
},
|
|
9244
9246
|
abbreviatedRoundNamingMap: {
|
|
9245
9247
|
// key is matchUpsCount for the round
|
|
9246
9248
|
1: 'F',
|
|
@@ -9255,6 +9257,7 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
|
9255
9257
|
affixes: {
|
|
9256
9258
|
roundNumber: 'R',
|
|
9257
9259
|
preFeedRound: 'Q',
|
|
9260
|
+
preQualifying: 'P',
|
|
9258
9261
|
},
|
|
9259
9262
|
stageConstants: (_b$4 = {},
|
|
9260
9263
|
_b$4[MAIN] = '',
|
|
@@ -9266,33 +9269,61 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
|
9266
9269
|
_a$h);
|
|
9267
9270
|
|
|
9268
9271
|
function getRoundContextProfile(_a) {
|
|
9269
|
-
var
|
|
9270
|
-
var
|
|
9272
|
+
var _b, _c, _d, _e;
|
|
9273
|
+
var roundNamingPolicy = _a.roundNamingPolicy, drawDefinition = _a.drawDefinition, structure = _a.structure, matchUps = _a.matchUps;
|
|
9274
|
+
var _f = getRoundMatchUps$1({ matchUps: matchUps }), roundProfile = _f.roundProfile, roundMatchUps = _f.roundMatchUps;
|
|
9271
9275
|
var structureAbbreviation = structure.structureAbbreviation, stage = structure.stage;
|
|
9272
9276
|
var isAdHocStructure = isAdHoc({ structure: structure });
|
|
9273
9277
|
var isLuckyStructure = isLucky({ structure: structure });
|
|
9274
9278
|
var isRoundRobin = structure.structures;
|
|
9275
9279
|
var roundNamingProfile = {};
|
|
9276
9280
|
var defaultRoundNamingPolicy = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING];
|
|
9281
|
+
var isQualifying = structure.stage === QUALIFYING;
|
|
9282
|
+
var qualifyingFinishgMap = isQualifying &&
|
|
9283
|
+
((roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.qualifyingFinishMap) ||
|
|
9284
|
+
(defaultRoundNamingPolicy === null || defaultRoundNamingPolicy === void 0 ? void 0 : defaultRoundNamingPolicy.qualifyingFinishMap) ||
|
|
9285
|
+
{});
|
|
9286
|
+
var qualifyingStageSequences = isQualifying
|
|
9287
|
+
? Math.max.apply(Math, __spreadArray(__spreadArray([], __read(((_b = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) !== null && _b !== void 0 ? _b : [])
|
|
9288
|
+
.filter(function (structure) { return structure.stage === QUALIFYING; })
|
|
9289
|
+
.map(function (_a) {
|
|
9290
|
+
var stageSequence = _a.stageSequence;
|
|
9291
|
+
return stageSequence !== null && stageSequence !== void 0 ? stageSequence : 1;
|
|
9292
|
+
})), false), [0], false)) : 0;
|
|
9293
|
+
var preQualifyingSequence = qualifyingStageSequences
|
|
9294
|
+
? qualifyingStageSequences - (structure.stageSequence || 1) || ''
|
|
9295
|
+
: '';
|
|
9296
|
+
var preQualifyingAffix = preQualifyingSequence
|
|
9297
|
+
? ((_c = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _c === void 0 ? void 0 : _c.preQualifying) ||
|
|
9298
|
+
defaultRoundNamingPolicy.affixes.preQualifying ||
|
|
9299
|
+
''
|
|
9300
|
+
: '';
|
|
9277
9301
|
var roundNamingMap = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.roundNamingMap) ||
|
|
9278
9302
|
defaultRoundNamingPolicy.roundNamingMap ||
|
|
9279
9303
|
{};
|
|
9280
9304
|
var abbreviatedRoundNamingMap = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.abbreviatedRoundNamingMap) ||
|
|
9281
9305
|
defaultRoundNamingPolicy.abbreviatedRoundNamingMap ||
|
|
9282
9306
|
{};
|
|
9283
|
-
var
|
|
9284
|
-
|
|
9307
|
+
var preFeedAffix = ((_d = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _d === void 0 ? void 0 : _d.preFeedRound) ||
|
|
9308
|
+
defaultRoundNamingPolicy.affixes.preFeedRound;
|
|
9309
|
+
var roundNumberAffix = ((_e = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _e === void 0 ? void 0 : _e.roundNumber) ||
|
|
9310
|
+
defaultRoundNamingPolicy.affixes.roundNumber;
|
|
9285
9311
|
var namingConventions = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.namingConventions) ||
|
|
9286
9312
|
defaultRoundNamingPolicy.namingConventions;
|
|
9287
9313
|
var roundNameFallback = namingConventions.round;
|
|
9288
|
-
var stageInitial = stage && stage !== MAIN
|
|
9289
|
-
var stageConstants = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.stageConstants
|
|
9290
|
-
|
|
9314
|
+
var stageInitial = stage && stage !== MAIN ? stage[0] : '';
|
|
9315
|
+
var stageConstants = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.stageConstants) ||
|
|
9316
|
+
defaultRoundNamingPolicy.stageConstants;
|
|
9317
|
+
var stageIndicator = (stage && (stageConstants === null || stageConstants === void 0 ? void 0 : stageConstants[stage])) || stageInitial;
|
|
9318
|
+
var stageConstant = "".concat(preQualifyingAffix).concat(stageIndicator).concat(preQualifyingSequence);
|
|
9291
9319
|
var roundProfileKeys = roundProfile ? Object.keys(roundProfile) : [];
|
|
9320
|
+
var qualifyingAffix = isQualifying && (stageConstants === null || stageConstants === void 0 ? void 0 : stageConstants[QUALIFYING])
|
|
9321
|
+
? "".concat(stageConstants === null || stageConstants === void 0 ? void 0 : stageConstants[QUALIFYING], "-")
|
|
9322
|
+
: '';
|
|
9292
9323
|
if (isRoundRobin || isAdHocStructure || isLuckyStructure) {
|
|
9293
9324
|
Object.assign.apply(Object, __spreadArray([roundNamingProfile], __read(roundProfileKeys.map(function (key) {
|
|
9294
9325
|
var _a;
|
|
9295
|
-
var roundName = "".concat(roundNameFallback, " ").concat(key);
|
|
9326
|
+
var roundName = "".concat(qualifyingAffix).concat(roundNameFallback, " ").concat(key);
|
|
9296
9327
|
var abbreviatedRoundName = "".concat(roundNumberAffix).concat(key);
|
|
9297
9328
|
return _a = {}, _a[key] = { roundName: roundName, abbreviatedRoundName: abbreviatedRoundName }, _a;
|
|
9298
9329
|
})), false));
|
|
@@ -9304,9 +9335,11 @@ function getRoundContextProfile(_a) {
|
|
|
9304
9335
|
return;
|
|
9305
9336
|
var _b = roundProfile[round], matchUpsCount = _b.matchUpsCount, preFeedRound = _b.preFeedRound;
|
|
9306
9337
|
var participantsCount = matchUpsCount * 2;
|
|
9307
|
-
var sizedRoundName =
|
|
9308
|
-
"".concat(
|
|
9309
|
-
|
|
9338
|
+
var sizedRoundName = (qualifyingFinishgMap === null || qualifyingFinishgMap === void 0 ? void 0 : qualifyingFinishgMap[roundProfile === null || roundProfile === void 0 ? void 0 : roundProfile[round].finishingRound]) ||
|
|
9339
|
+
(qualifyingFinishgMap && "".concat(roundNumberAffix).concat(participantsCount)) ||
|
|
9340
|
+
roundNamingMap[matchUpsCount] ||
|
|
9341
|
+
"".concat(roundNumberAffix).concat(participantsCount);
|
|
9342
|
+
var suffix = preFeedRound ? "-".concat(preFeedAffix) : '';
|
|
9310
9343
|
var profileRoundName = "".concat(sizedRoundName).concat(suffix);
|
|
9311
9344
|
var roundName = [
|
|
9312
9345
|
stageConstant,
|
|
@@ -9316,7 +9349,7 @@ function getRoundContextProfile(_a) {
|
|
|
9316
9349
|
.filter(Boolean)
|
|
9317
9350
|
.join('-');
|
|
9318
9351
|
var sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] ||
|
|
9319
|
-
"".concat(
|
|
9352
|
+
"".concat(roundNumberAffix).concat(participantsCount);
|
|
9320
9353
|
var profileAbbreviation = "".concat(sizedAbbreviation).concat(suffix);
|
|
9321
9354
|
var abbreviatedRoundName = [
|
|
9322
9355
|
stageConstant,
|
|
@@ -9514,6 +9547,7 @@ function getAllStructureMatchUps(_a) {
|
|
|
9514
9547
|
var roundNamingPolicy = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_ROUND_NAMING];
|
|
9515
9548
|
var result = getRoundContextProfile({
|
|
9516
9549
|
roundNamingPolicy: roundNamingPolicy,
|
|
9550
|
+
drawDefinition: drawDefinition,
|
|
9517
9551
|
structure: structure,
|
|
9518
9552
|
matchUps: matchUps,
|
|
9519
9553
|
});
|
|
@@ -25071,16 +25105,6 @@ function scoreModification$1(params) {
|
|
|
25071
25105
|
return decorateResult({ result: result, stack: stack });
|
|
25072
25106
|
}
|
|
25073
25107
|
|
|
25074
|
-
/**
|
|
25075
|
-
*
|
|
25076
|
-
* Finds all structureIds which are affected by an outcome change in a completed structure
|
|
25077
|
-
* Is specific to Round Robins which direct participants by WIN_RATIO
|
|
25078
|
-
*
|
|
25079
|
-
* @param {object} drawDefinition
|
|
25080
|
-
* @param {object} structure
|
|
25081
|
-
* @param {object} matchUp
|
|
25082
|
-
*
|
|
25083
|
-
*/
|
|
25084
25108
|
function getAffectedTargetStructureIds(_a) {
|
|
25085
25109
|
var _b, _c;
|
|
25086
25110
|
var drawDefinition = _a.drawDefinition, structure = _a.structure, matchUp = _a.matchUp;
|
|
@@ -46856,7 +46880,7 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
46856
46880
|
// not for use when generating structures from qualifyingProfiles
|
|
46857
46881
|
function generateQualifyingStructure$1(params) {
|
|
46858
46882
|
var _a;
|
|
46859
|
-
var _b, _c, _d;
|
|
46883
|
+
var _b, _c, _d, _e;
|
|
46860
46884
|
if (!params.drawDefinition)
|
|
46861
46885
|
return { error: MISSING_DRAW_DEFINITION };
|
|
46862
46886
|
var stack = 'generateQualifyingStructure';
|
|
@@ -46895,7 +46919,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
46895
46919
|
var chainModified = void 0;
|
|
46896
46920
|
while (!chainModified && nextStructureId_1) {
|
|
46897
46921
|
targetStructure.stageSequence = nextStageSequence;
|
|
46898
|
-
var targetTargetStructureId = (_c = (_b = drawDefinition.links.find(function (link) { return link.source.structureId === nextStructureId_1; })) === null ||
|
|
46922
|
+
var targetTargetStructureId = (_d = (_c = (_b = drawDefinition.links) === null || _b === void 0 ? void 0 : _b.find(function (link) { return link.source.structureId === nextStructureId_1; })) === null || _c === void 0 ? void 0 : _c.target) === null || _d === void 0 ? void 0 : _d.structureId;
|
|
46899
46923
|
nextStructureId_1 = targetTargetStructureId;
|
|
46900
46924
|
nextStageSequence += 1;
|
|
46901
46925
|
if (!targetTargetStructureId) {
|
|
@@ -46928,7 +46952,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
46928
46952
|
? "".concat(constantToString(QUALIFYING), " ").concat(roundTargetName).concat(stageSequenceName)
|
|
46929
46953
|
: constantToString(QUALIFYING));
|
|
46930
46954
|
if (drawType === ROUND_ROBIN) {
|
|
46931
|
-
var
|
|
46955
|
+
var _f = generateRoundRobin({
|
|
46932
46956
|
structureName: structureName || qualifyingStructureName,
|
|
46933
46957
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
46934
46958
|
stage: QUALIFYING,
|
|
@@ -46941,7 +46965,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
46941
46965
|
drawSize: drawSize,
|
|
46942
46966
|
isMock: isMock,
|
|
46943
46967
|
uuids: uuids,
|
|
46944
|
-
}), maxRoundNumber =
|
|
46968
|
+
}), maxRoundNumber = _f.maxRoundNumber /*, groupSize*/, structures = _f.structures, groupCount = _f.groupCount;
|
|
46945
46969
|
qualifiersCount = groupCount;
|
|
46946
46970
|
roundLimit = maxRoundNumber;
|
|
46947
46971
|
structure = structures[0];
|
|
@@ -46975,7 +46999,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
46975
46999
|
extension: { name: ROUND_TARGET, value: roundTarget },
|
|
46976
47000
|
});
|
|
46977
47001
|
}
|
|
46978
|
-
qualifiersCount = (
|
|
47002
|
+
qualifiersCount = (_e = matchUps === null || matchUps === void 0 ? void 0 : matchUps.filter(function (matchUp) { return matchUp.roundNumber === roundLimit; })) === null || _e === void 0 ? void 0 : _e.length;
|
|
46979
47003
|
}
|
|
46980
47004
|
// order of operations is important here!! finalQualifier positions is not yet updated when this step occurs
|
|
46981
47005
|
var linkType = drawType === ROUND_ROBIN ? LinkTypeEnum.Position : LinkTypeEnum.Winner;
|
|
@@ -52585,6 +52609,7 @@ var entryGovernor = {
|
|
|
52585
52609
|
|
|
52586
52610
|
var linkGovernor = {
|
|
52587
52611
|
generateQualifyingLink: generateQualifyingLink,
|
|
52612
|
+
getStructureLinks: getStructureLinks,
|
|
52588
52613
|
};
|
|
52589
52614
|
|
|
52590
52615
|
var definitionTemplate = function () { return ({
|
|
@@ -58566,8 +58591,8 @@ function analyzeDraws(_a) {
|
|
|
58566
58591
|
return !inactiveStructure;
|
|
58567
58592
|
}).length;
|
|
58568
58593
|
var links = getStructureLinks({
|
|
58569
|
-
drawDefinition: drawDefinition,
|
|
58570
58594
|
structureId: mainStructure.structureId,
|
|
58595
|
+
drawDefinition: drawDefinition,
|
|
58571
58596
|
}).links;
|
|
58572
58597
|
var isMatchPlay = ensureInt(mainStructure.activeRounds[0]) === 1 &&
|
|
58573
58598
|
mainStructure.activeRounds.length === 1 &&
|
|
@@ -64448,6 +64473,26 @@ function generateDrawDefinition(params) {
|
|
|
64448
64473
|
return __assign(__assign({ existingDrawDefinition: !!existingDrawDefinition, qualifyingConflicts: qualifyingConflicts, positioningReports: positioningReports, drawDefinition: drawDefinition, structureId: structureId }, SUCCESS), { conflicts: conflicts });
|
|
64449
64474
|
}
|
|
64450
64475
|
|
|
64476
|
+
function isValidForQualifying(_a) {
|
|
64477
|
+
var structureId = _a.structureId, drawDefinition = _a.drawDefinition;
|
|
64478
|
+
if (!drawDefinition)
|
|
64479
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
64480
|
+
if (!isString(structureId))
|
|
64481
|
+
return { error: INVALID_VALUES };
|
|
64482
|
+
var result = getStructureLinks({
|
|
64483
|
+
drawDefinition: drawDefinition,
|
|
64484
|
+
structureId: structureId,
|
|
64485
|
+
});
|
|
64486
|
+
if (result.error)
|
|
64487
|
+
return result;
|
|
64488
|
+
var targetFeedProfiles = result.links.target
|
|
64489
|
+
.flatMap(function (t) { return t.target.feedProfile; })
|
|
64490
|
+
.filter(Boolean);
|
|
64491
|
+
var valid = !intersection([BOTTOM_UP, TOP_DOWN, RANDOM], targetFeedProfiles)
|
|
64492
|
+
.length;
|
|
64493
|
+
return __assign(__assign({}, SUCCESS), { valid: valid });
|
|
64494
|
+
}
|
|
64495
|
+
|
|
64451
64496
|
function renameStructures(params) {
|
|
64452
64497
|
return renameStructures$1(params);
|
|
64453
64498
|
}
|
|
@@ -64719,6 +64764,7 @@ var eventGovernor = {
|
|
|
64719
64764
|
attachQualifyingStructure: attachQualifyingStructure,
|
|
64720
64765
|
attachPlayoffStructures: attachPlayoffStructures,
|
|
64721
64766
|
addQualifyingStructure: addQualifyingStructure,
|
|
64767
|
+
isValidForQualifying: isValidForQualifying,
|
|
64722
64768
|
setStructureOrder: setStructureOrder,
|
|
64723
64769
|
attachStructures: attachStructures,
|
|
64724
64770
|
renameStructures: renameStructures,
|