tods-competition-factory 1.7.8 → 1.7.9
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.d.ts +26 -1
- package/dist/forge/generate.mjs +76 -29
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/utilities.d.ts +2 -1
- package/dist/forge/utilities.mjs +16 -1
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +71 -35
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +81 -73
- 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
|
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
function factoryVersion() {
|
|
365
|
-
return '1.7.
|
|
365
|
+
return '1.7.9';
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/******************************************************************************
|
|
@@ -24851,6 +24851,23 @@ function getNumericSeedValue(seedValue) {
|
|
|
24851
24851
|
return Infinity;
|
|
24852
24852
|
}
|
|
24853
24853
|
|
|
24854
|
+
function capitalizeFirst(str) {
|
|
24855
|
+
return !isString(str)
|
|
24856
|
+
? str
|
|
24857
|
+
: str
|
|
24858
|
+
.split(' ')
|
|
24859
|
+
.map(function (name) {
|
|
24860
|
+
return name
|
|
24861
|
+
.split('')
|
|
24862
|
+
.map(function (c, i) { return (i ? c.toLowerCase() : c.toUpperCase()); })
|
|
24863
|
+
.join('');
|
|
24864
|
+
})
|
|
24865
|
+
.join(' ');
|
|
24866
|
+
}
|
|
24867
|
+
function constantToString(str) {
|
|
24868
|
+
return !isString(str) ? str : capitalizeFirst(str.replace(/_/g, ' '));
|
|
24869
|
+
}
|
|
24870
|
+
|
|
24854
24871
|
var structureTemplate = function (_a) {
|
|
24855
24872
|
var _b = _a.finishingPosition, finishingPosition = _b === void 0 ? ROUND_OUTCOME : _b, qualifyingRoundNumber = _a.qualifyingRoundNumber, structureAbbreviation = _a.structureAbbreviation, _c = _a.seedAssignments, seedAssignments = _c === void 0 ? [] : _c, _d = _a.stageSequence, stageSequence = _d === void 0 ? 1 : _d, structureOrder = _a.structureOrder, seedingProfile = _a.seedingProfile, matchUpFormat = _a.matchUpFormat, structureType = _a.structureType, structureName = _a.structureName, matchUpType = _a.matchUpType, _e = _a.matchUps, matchUps = _e === void 0 ? [] : _e, structureId = _a.structureId, roundOffset = _a.roundOffset, roundLimit = _a.roundLimit, stageOrder = _a.stageOrder, structures = _a.structures, stage = _a.stage;
|
|
24856
24873
|
var structure = {
|
|
@@ -24906,7 +24923,7 @@ var structureTemplate = function (_a) {
|
|
|
24906
24923
|
};
|
|
24907
24924
|
|
|
24908
24925
|
function generateRoundRobin(_a) {
|
|
24909
|
-
var _b = _a.structureName, structureName = _b === void 0 ? MAIN : _b, _c = _a.stageSequence, stageSequence = _c === void 0 ? 1 : _c, structureOptions = _a.structureOptions, appliedPolicies = _a.appliedPolicies, seedingProfile = _a.seedingProfile, _d = _a.stage, stage = _d === void 0 ? MAIN : _d, matchUpType = _a.matchUpType, roundTarget = _a.roundTarget, structureId = _a.structureId, drawSize = _a.drawSize, idPrefix = _a.idPrefix, isMock = _a.isMock, uuids = _a.uuids;
|
|
24926
|
+
var _b = _a.structureName, structureName = _b === void 0 ? constantToString(MAIN) : _b, _c = _a.stageSequence, stageSequence = _c === void 0 ? 1 : _c, structureOptions = _a.structureOptions, appliedPolicies = _a.appliedPolicies, seedingProfile = _a.seedingProfile, _d = _a.stage, stage = _d === void 0 ? MAIN : _d, matchUpType = _a.matchUpType, roundTarget = _a.roundTarget, structureId = _a.structureId, drawSize = _a.drawSize, idPrefix = _a.idPrefix, isMock = _a.isMock, uuids = _a.uuids;
|
|
24910
24927
|
var _e = deriveGroups({
|
|
24911
24928
|
structureOptions: structureOptions,
|
|
24912
24929
|
appliedPolicies: appliedPolicies,
|
|
@@ -31038,7 +31055,7 @@ function getParticipantEntries(params) {
|
|
|
31038
31055
|
// id is the pair, team or individual participant currently being processed
|
|
31039
31056
|
// whereas participantId is the id of the entry into the draw
|
|
31040
31057
|
var addDrawEntry = function (id) {
|
|
31041
|
-
var _a, _b, _c, _d, _e
|
|
31058
|
+
var _a, _b, _c, _d, _e;
|
|
31042
31059
|
if ((_a = participantMap[id].draws) === null || _a === void 0 ? void 0 : _a[drawId])
|
|
31043
31060
|
return;
|
|
31044
31061
|
var includeSeeding = withSeeding && seedingPublished;
|
|
@@ -31055,13 +31072,17 @@ function getParticipantEntries(params) {
|
|
|
31055
31072
|
seedAssignments[MAIN] = mainSeeding;
|
|
31056
31073
|
if (seedAssignments && qualifyingSeeding)
|
|
31057
31074
|
seedAssignments[QUALIFYING] = mainSeeding;
|
|
31058
|
-
if (withEvents || withRankingProfile)
|
|
31075
|
+
if ((withEvents || withRankingProfile) &&
|
|
31076
|
+
participantMap[id] &&
|
|
31077
|
+
eventId) {
|
|
31078
|
+
if (!participantMap[id].events[eventId])
|
|
31079
|
+
participantMap[id].events[eventId] = {};
|
|
31059
31080
|
if (includeSeeding) {
|
|
31060
31081
|
// overwrite any event seeding with actual draw seeding (which may differ)
|
|
31061
31082
|
participantMap[id].events[eventId].seedValue =
|
|
31062
31083
|
mainSeeding || qualifyingSeeding;
|
|
31063
31084
|
}
|
|
31064
|
-
else if (
|
|
31085
|
+
else if (participantMap[id].events[eventId].seedValue) {
|
|
31065
31086
|
// if seeding for specific drawIds is NOT published, remove from event
|
|
31066
31087
|
participantMap[id].events[eventId].seedValue = undefined;
|
|
31067
31088
|
}
|
|
@@ -42961,8 +42982,8 @@ function firstRoundLoserConsolation(params) {
|
|
|
42961
42982
|
? feedInMatchUps(mainParams)
|
|
42962
42983
|
: treeMatchUps(mainParams)).matchUps;
|
|
42963
42984
|
var mainStructure = structureTemplate({
|
|
42985
|
+
structureName: structureName || constantToString(MAIN),
|
|
42964
42986
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
42965
|
-
structureName: structureName || MAIN,
|
|
42966
42987
|
stageSequence: stageSequence,
|
|
42967
42988
|
matchUpType: matchUpType,
|
|
42968
42989
|
matchUps: matchUps,
|
|
@@ -42979,8 +43000,9 @@ function firstRoundLoserConsolation(params) {
|
|
|
42979
43000
|
matchUpType: matchUpType,
|
|
42980
43001
|
isMock: isMock,
|
|
42981
43002
|
}).matchUps;
|
|
43003
|
+
var consolation = constantToString(CONSOLATION);
|
|
42982
43004
|
var consolationStructureName = params.consolationStructureName ||
|
|
42983
|
-
(structureName ? "".concat(structureName, " ").concat(
|
|
43005
|
+
(structureName ? "".concat(structureName, " ").concat(consolation) : consolation);
|
|
42984
43006
|
var consolationStructure = structureTemplate({
|
|
42985
43007
|
structureName: consolationStructureName,
|
|
42986
43008
|
matchUps: consolationMatchUps,
|
|
@@ -43059,7 +43081,7 @@ function feedInLinks(_a) {
|
|
|
43059
43081
|
}
|
|
43060
43082
|
|
|
43061
43083
|
function generateCurtisConsolation(params) {
|
|
43062
|
-
var
|
|
43084
|
+
var _a = params.structureName, structureName = _a === void 0 ? constantToString(MAIN) : _a, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionOffset = params.finishingPositionOffset, _b = params.stageSequence, stageSequence = _b === void 0 ? 1 : _b, structureNameMap = params.structureNameMap, staggeredEntry = params.staggeredEntry, _c = params.stage, stage = _c === void 0 ? MAIN : _c, matchUpType = params.matchUpType, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
43063
43085
|
var mainParams = {
|
|
43064
43086
|
finishingPositionOffset: finishingPositionOffset,
|
|
43065
43087
|
matchUpType: matchUpType,
|
|
@@ -43088,6 +43110,7 @@ function generateCurtisConsolation(params) {
|
|
|
43088
43110
|
var consolationStructure = consolationFeedStructure({
|
|
43089
43111
|
idPrefix: idPrefix && "".concat(idPrefix, "-c").concat(index),
|
|
43090
43112
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43113
|
+
playoffStructureNameBase: playoffStructureNameBase,
|
|
43091
43114
|
structureNameMap: structureNameMap,
|
|
43092
43115
|
stageSequence: stageSequence,
|
|
43093
43116
|
roundOffset: roundOffset,
|
|
@@ -43120,12 +43143,17 @@ function generateCurtisConsolation(params) {
|
|
|
43120
43143
|
matchUpType: matchUpType,
|
|
43121
43144
|
isMock: isMock,
|
|
43122
43145
|
}).matchUps;
|
|
43146
|
+
var defaultName = constantToString(PLAY_OFF);
|
|
43147
|
+
var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
|
|
43148
|
+
var structureName_1 = playoffStructureNameBase
|
|
43149
|
+
? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
|
|
43150
|
+
: mappedStructureName;
|
|
43123
43151
|
var playoffStructure = structureTemplate({
|
|
43124
|
-
structureName: (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[PLAY_OFF]) || PLAY_OFF,
|
|
43125
43152
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43126
43153
|
matchUps: playoffMatchUps,
|
|
43127
43154
|
stageSequence: 2,
|
|
43128
43155
|
stage: PLAY_OFF,
|
|
43156
|
+
structureName: structureName_1,
|
|
43129
43157
|
matchUpType: matchUpType,
|
|
43130
43158
|
});
|
|
43131
43159
|
var playoffLink = {
|
|
@@ -43147,7 +43175,7 @@ function generateCurtisConsolation(params) {
|
|
|
43147
43175
|
return __assign({ structures: structures, links: links }, SUCCESS);
|
|
43148
43176
|
}
|
|
43149
43177
|
function consolationFeedStructure(_a) {
|
|
43150
|
-
var _b = _a.stageSequence, stageSequence = _b === void 0 ? 1 : _b, structureNameMap = _a.structureNameMap, _c = _a.roundOffset, roundOffset = _c === void 0 ? 0 : _c, matchUpType = _a.matchUpType, structureId = _a.structureId, idPrefix = _a.idPrefix, drawSize = _a.drawSize, isMock = _a.isMock, index = _a.index, uuids = _a.uuids;
|
|
43178
|
+
var playoffStructureNameBase = _a.playoffStructureNameBase, _b = _a.stageSequence, stageSequence = _b === void 0 ? 1 : _b, structureNameMap = _a.structureNameMap, _c = _a.roundOffset, roundOffset = _c === void 0 ? 0 : _c, matchUpType = _a.matchUpType, structureId = _a.structureId, idPrefix = _a.idPrefix, drawSize = _a.drawSize, isMock = _a.isMock, index = _a.index, uuids = _a.uuids;
|
|
43151
43179
|
var consolationDrawPositions = drawSize / (2 * Math.pow(2, roundOffset));
|
|
43152
43180
|
var _d = feedInMatchUps({
|
|
43153
43181
|
finishingPositionOffset: consolationDrawPositions,
|
|
@@ -43159,8 +43187,11 @@ function consolationFeedStructure(_a) {
|
|
|
43159
43187
|
isMock: isMock,
|
|
43160
43188
|
uuids: uuids,
|
|
43161
43189
|
}), consolationMatchUps = _d.matchUps, consolationRoundsCount = _d.roundsCount;
|
|
43162
|
-
var defaultName = "".concat(CONSOLATION, " ").concat(index + 1);
|
|
43163
|
-
var
|
|
43190
|
+
var defaultName = "".concat(constantToString(CONSOLATION), " ").concat(index + 1);
|
|
43191
|
+
var mappedStructureName = (structureNameMap === null || structureNameMap === void 0 ? void 0 : structureNameMap[defaultName]) || defaultName;
|
|
43192
|
+
var structureName = playoffStructureNameBase
|
|
43193
|
+
? "".concat(playoffStructureNameBase, " ").concat(mappedStructureName)
|
|
43194
|
+
: mappedStructureName;
|
|
43164
43195
|
var consolationStructure = structureTemplate({
|
|
43165
43196
|
matchUps: consolationMatchUps,
|
|
43166
43197
|
stage: CONSOLATION,
|
|
@@ -43172,23 +43203,7 @@ function consolationFeedStructure(_a) {
|
|
|
43172
43203
|
return { consolationStructure: consolationStructure, consolationRoundsCount: consolationRoundsCount };
|
|
43173
43204
|
}
|
|
43174
43205
|
|
|
43175
|
-
/**
|
|
43176
|
-
*
|
|
43177
|
-
* @param {object} playoffAttributes - mapping of exitProfile to structure names, e.g. 0-1-1 for SOUTH
|
|
43178
|
-
* @param {string} playoffStructureNameBase - Root word for default playoff naming, e.g. 'Playoff' for 'Playoff 3-4'
|
|
43179
|
-
* @param {string} exitProfile - rounds at which a participant exited each structure, e.g. 0-1-1-1 for losing EAST, WEST, SOUTH
|
|
43180
|
-
* @param {boolean} exitProfileLimit - limit playoff rounds generated by the attributes present in playoffAttributes
|
|
43181
|
-
* @param {number} finishingPositionOffset - amount by which to offset finishingPositions, e.g. 2 for playing off 3-4
|
|
43182
|
-
* @param {number} finishingPositionLimit - highest value of possible finishing Positions to play off
|
|
43183
|
-
* @param {object} finishingPositionNaming - map of { [finishingPositionRange]: customName }
|
|
43184
|
-
* @param {number} roundOffsetLimit - how many rounds to play off (# of additional matchUps per participant)
|
|
43185
|
-
* @param {number} roundOffset - used internally to track generated structures; saved in structure attributes;
|
|
43186
|
-
* @param {number} stageSequence - what sequence within stage structures, e.g. WEST is stageSequence 2 in COMPASS
|
|
43187
|
-
* @param {string} stage - [QUALIFYING, MAIN, CONSOLATION, PLAY-OFF]
|
|
43188
|
-
*
|
|
43189
|
-
*/
|
|
43190
43206
|
function generatePlayoffStructures(params) {
|
|
43191
|
-
var matchUpType = params.matchUpType;
|
|
43192
43207
|
var _a = params.finishingPositionOffset, finishingPositionOffset = _a === void 0 ? 0 : _a, addNameBaseToAttributeName = params.addNameBaseToAttributeName, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionNaming = params.finishingPositionNaming, finishingPositionLimit = params.finishingPositionLimit, playoffAttributes = params.playoffAttributes, _b = params.stageSequence, stageSequence = _b === void 0 ? 1 : _b, _c = params.exitProfile, exitProfile = _c === void 0 ? '0' : _c, exitProfileLimit = params.exitProfileLimit, roundOffsetLimit = params.roundOffsetLimit, _d = params.roundOffset, roundOffset = _d === void 0 ? 0 : _d, drawDefinition = params.drawDefinition, staggeredEntry = params.staggeredEntry, // not propagated to child structurs
|
|
43193
43208
|
sequenceLimit = params.sequenceLimit, _e = params.stage, stage = _e === void 0 ? MAIN : _e, structureId = params.structureId, drawSize = params.drawSize, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
43194
43209
|
var generateStructure = !playoffAttributes || !exitProfileLimit || (playoffAttributes === null || playoffAttributes === void 0 ? void 0 : playoffAttributes[exitProfile]);
|
|
@@ -43199,7 +43214,7 @@ function generatePlayoffStructures(params) {
|
|
|
43199
43214
|
var allMatchUps = [];
|
|
43200
43215
|
var structures = [];
|
|
43201
43216
|
var links = [];
|
|
43202
|
-
matchUpType = matchUpType || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpType);
|
|
43217
|
+
var matchUpType = params.matchUpType || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpType);
|
|
43203
43218
|
var finishingPositionsFrom = finishingPositionOffset + 1;
|
|
43204
43219
|
var finishingPositionsTo = finishingPositionOffset + drawSize;
|
|
43205
43220
|
var finishingPositionRange = "".concat(finishingPositionsFrom, "-").concat(finishingPositionsTo);
|
|
@@ -43253,7 +43268,8 @@ function generatePlayoffStructures(params) {
|
|
|
43253
43268
|
if (playoffDrawPositions < 2)
|
|
43254
43269
|
return;
|
|
43255
43270
|
var childFinishingPositionOffset = drawSize / Math.pow(2, roundNumber) + finishingPositionOffset;
|
|
43256
|
-
if (
|
|
43271
|
+
if (finishingPositionLimit &&
|
|
43272
|
+
childFinishingPositionOffset + 1 > finishingPositionLimit)
|
|
43257
43273
|
return;
|
|
43258
43274
|
var _a = generatePlayoffStructures({
|
|
43259
43275
|
finishingPositionOffset: childFinishingPositionOffset,
|
|
@@ -43321,8 +43337,8 @@ function feedInChampionship(params) {
|
|
|
43321
43337
|
? feedInMatchUps(mainParams)
|
|
43322
43338
|
: treeMatchUps(mainParams)).matchUps;
|
|
43323
43339
|
var mainStructure = structureTemplate({
|
|
43340
|
+
structureName: structureName || constantToString(MAIN),
|
|
43324
43341
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43325
|
-
structureName: structureName || MAIN,
|
|
43326
43342
|
stageSequence: stageSequence,
|
|
43327
43343
|
matchUpType: matchUpType,
|
|
43328
43344
|
matchUps: matchUps,
|
|
@@ -43346,9 +43362,9 @@ function feedInChampionship(params) {
|
|
|
43346
43362
|
}), consolationMatchUps = _c.matchUps, roundsCount = _c.roundsCount;
|
|
43347
43363
|
if (drawSize > 2) {
|
|
43348
43364
|
var consolationStructure = structureTemplate({
|
|
43365
|
+
structureName: constantToString(CONSOLATION),
|
|
43349
43366
|
matchUps: consolationMatchUps,
|
|
43350
43367
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43351
|
-
structureName: CONSOLATION,
|
|
43352
43368
|
stage: CONSOLATION,
|
|
43353
43369
|
stageSequence: 1,
|
|
43354
43370
|
matchUpType: matchUpType,
|
|
@@ -43417,20 +43433,18 @@ function processPlayoffGroups(_a) {
|
|
|
43417
43433
|
if (positionsPlayedOff) {
|
|
43418
43434
|
finishingPositionOffset = Math.min.apply(Math, __spreadArray([], __read(positionsPlayedOff), false)) - 1;
|
|
43419
43435
|
}
|
|
43420
|
-
var
|
|
43436
|
+
var playoffGroupParams = {
|
|
43437
|
+
addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
|
|
43438
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
43439
|
+
finishingPositionNaming: playoffGroup.finishingPositionNaming,
|
|
43440
|
+
finishingPositionLimit: playoffGroup.finishingPositionLimit,
|
|
43421
43441
|
structureId: (_c = playoffGroup.structureId) !== null && _c !== void 0 ? _c : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43442
|
+
playoffAttributes: playoffGroup.playoffAttributes,
|
|
43422
43443
|
structureNameMap: playoffGroup.structureNameMap,
|
|
43423
43444
|
structureName: playoffGroup.structureName,
|
|
43424
|
-
|
|
43425
|
-
appliedPolicies: policyDefinitions,
|
|
43426
|
-
finishingPositionOffset: finishingPositionOffset,
|
|
43427
|
-
stage: PLAY_OFF,
|
|
43428
|
-
stageSequence: stageSequence,
|
|
43429
|
-
matchUpType: matchUpType,
|
|
43430
|
-
drawSize: drawSize,
|
|
43431
|
-
isMock: isMock,
|
|
43432
|
-
uuids: uuids,
|
|
43445
|
+
sequenceLimit: playoffGroup.sequenceLimit,
|
|
43433
43446
|
};
|
|
43447
|
+
var params = __assign(__assign({}, playoffGroupParams), { idPrefix: idPrefix && "".concat(idPrefix, "-po"), appliedPolicies: policyDefinitions, finishingPositionOffset: finishingPositionOffset, stage: PLAY_OFF, stageSequence: stageSequence, matchUpType: matchUpType, drawSize: drawSize, isMock: isMock, uuids: uuids });
|
|
43434
43448
|
var updateStructureAndLinks = function (_a) {
|
|
43435
43449
|
var playoffStructures = _a.playoffStructures, playoffLinks = _a.playoffLinks;
|
|
43436
43450
|
var _b = __read(playoffStructures, 1), playoffStructure = _b[0];
|
|
@@ -43642,7 +43656,7 @@ function generatePlayoffLink(_a) {
|
|
|
43642
43656
|
// groups of finishing drawPositions which playoff
|
|
43643
43657
|
function generateRoundRobinWithPlayOff(params) {
|
|
43644
43658
|
var drawDefinition = params.drawDefinition, structureOptions = params.structureOptions, requireSequential = params.requireSequential;
|
|
43645
|
-
var mainDrawProperties = __assign(__assign({ structureName: MAIN }, params), { stage: MAIN }); // default structureName
|
|
43659
|
+
var mainDrawProperties = __assign(__assign({ structureName: constantToString(MAIN) }, params), { stage: MAIN }); // default structureName
|
|
43646
43660
|
var _a = generateRoundRobin(mainDrawProperties), structures = _a.structures, groupCount = _a.groupCount, groupSize = _a.groupSize;
|
|
43647
43661
|
// TODO: test for and handle this situation
|
|
43648
43662
|
if (groupCount < 1) {
|
|
@@ -43650,7 +43664,7 @@ function generateRoundRobinWithPlayOff(params) {
|
|
|
43650
43664
|
}
|
|
43651
43665
|
// define a default playoff group if none specified
|
|
43652
43666
|
var playoffGroups = (structureOptions === null || structureOptions === void 0 ? void 0 : structureOptions.playoffGroups) || [
|
|
43653
|
-
{ finishingPositions: [1], structureName: PLAY_OFF },
|
|
43667
|
+
{ finishingPositions: [1], structureName: constantToString(PLAY_OFF) },
|
|
43654
43668
|
];
|
|
43655
43669
|
var _b = __read(structures, 1), mainStructure = _b[0];
|
|
43656
43670
|
var _c = processPlayoffGroups(__assign({ sourceStructureId: mainStructure.structureId, requireSequential: requireSequential, drawDefinition: drawDefinition, playoffGroups: playoffGroups, groupCount: groupCount, groupSize: groupSize }, params)), playoffStructures = _c.structures, links = _c.links;
|
|
@@ -43768,7 +43782,7 @@ function generateDoubleElimination(_a) {
|
|
|
43768
43782
|
isMock: isMock,
|
|
43769
43783
|
}).matchUps;
|
|
43770
43784
|
var mainStructure = structureTemplate({
|
|
43771
|
-
structureName: structureName || MAIN,
|
|
43785
|
+
structureName: structureName || constantToString(MAIN),
|
|
43772
43786
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43773
43787
|
stageSequence: 1,
|
|
43774
43788
|
stage: MAIN,
|
|
@@ -43787,9 +43801,9 @@ function generateDoubleElimination(_a) {
|
|
|
43787
43801
|
uuids: uuids,
|
|
43788
43802
|
}).matchUps;
|
|
43789
43803
|
var consolationStructure = structureTemplate({
|
|
43804
|
+
structureName: constantToString(BACKDRAW),
|
|
43790
43805
|
matchUps: consolationMatchUps,
|
|
43791
43806
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43792
|
-
structureName: BACKDRAW,
|
|
43793
43807
|
stage: CONSOLATION,
|
|
43794
43808
|
stageSequence: 2,
|
|
43795
43809
|
matchUpType: matchUpType,
|
|
@@ -43802,9 +43816,9 @@ function generateDoubleElimination(_a) {
|
|
|
43802
43816
|
isMock: isMock,
|
|
43803
43817
|
}).matchUps;
|
|
43804
43818
|
var deciderStructure = structureTemplate({
|
|
43819
|
+
structureName: constantToString(DECIDER),
|
|
43805
43820
|
matchUps: deciderMatchUps,
|
|
43806
43821
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
43807
|
-
structureName: DECIDER,
|
|
43808
43822
|
stageSequence: 3,
|
|
43809
43823
|
stage: PLAY_OFF,
|
|
43810
43824
|
matchUpType: matchUpType,
|
|
@@ -43919,11 +43933,12 @@ function getGenerators(params) {
|
|
|
43919
43933
|
params.skipRounds ||
|
|
43920
43934
|
(drawSize <= 4 && ((feedPolicy === null || feedPolicy === void 0 ? void 0 : feedPolicy.feedMainFinal) ? 0 : 1)) ||
|
|
43921
43935
|
0;
|
|
43936
|
+
var main = constantToString(MAIN);
|
|
43922
43937
|
var singleElimination = function () {
|
|
43923
43938
|
var matchUps = treeMatchUps(params).matchUps;
|
|
43924
43939
|
var structure = structureTemplate({
|
|
43925
|
-
structureName: structureName || MAIN,
|
|
43926
43940
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43941
|
+
structureName: structureName || main,
|
|
43927
43942
|
stageSequence: stageSequence,
|
|
43928
43943
|
matchUpType: matchUpType,
|
|
43929
43944
|
matchUps: matchUps,
|
|
@@ -43934,8 +43949,8 @@ function getGenerators(params) {
|
|
|
43934
43949
|
var generators = (_a = {},
|
|
43935
43950
|
_a[AD_HOC] = function () {
|
|
43936
43951
|
var structure = structureTemplate({
|
|
43937
|
-
structureName: structureName || MAIN,
|
|
43938
43952
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43953
|
+
structureName: structureName || main,
|
|
43939
43954
|
finishingPosition: WIN_RATIO,
|
|
43940
43955
|
stageSequence: stageSequence,
|
|
43941
43956
|
matchUps: [],
|
|
@@ -43947,8 +43962,8 @@ function getGenerators(params) {
|
|
|
43947
43962
|
_a[LUCKY_DRAW] = function () {
|
|
43948
43963
|
var matchUps = luckyDraw(params).matchUps;
|
|
43949
43964
|
var structure = structureTemplate({
|
|
43950
|
-
structureName: structureName || MAIN,
|
|
43951
43965
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43966
|
+
structureName: structureName || main,
|
|
43952
43967
|
stageSequence: stageSequence,
|
|
43953
43968
|
matchUpType: matchUpType,
|
|
43954
43969
|
matchUps: matchUps,
|
|
@@ -43970,8 +43985,8 @@ function getGenerators(params) {
|
|
|
43970
43985
|
_a[FEED_IN$1] = function () {
|
|
43971
43986
|
var matchUps = feedInMatchUps({ drawSize: drawSize, uuids: uuids, matchUpType: matchUpType }).matchUps;
|
|
43972
43987
|
var structure = structureTemplate({
|
|
43973
|
-
structureName: structureName || MAIN,
|
|
43974
43988
|
structureId: structureId || (uuids === null || uuids === void 0 ? void 0 : uuids.pop()),
|
|
43989
|
+
structureName: structureName || main,
|
|
43975
43990
|
stageSequence: stageSequence,
|
|
43976
43991
|
matchUpType: matchUpType,
|
|
43977
43992
|
stage: MAIN,
|
|
@@ -46704,7 +46719,7 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
46704
46719
|
if (availabilityResult.error) {
|
|
46705
46720
|
return decorateResult({ result: availabilityResult, stack: stack });
|
|
46706
46721
|
}
|
|
46707
|
-
var sourceStructureId = params.structureId, addNameBaseToAttributeName = params.addNameBaseToAttributeName, playoffStructureNameBase = params.playoffStructureNameBase, playoffAttributes = params.playoffAttributes, playoffPositions = params.playoffPositions, tournamentRecord = params.tournamentRecord, exitProfileLimit = params.exitProfileLimit, roundProfiles = params.roundProfiles, roundNumbers = params.roundNumbers, idPrefix = params.idPrefix, isMock = params.isMock, event = params.event, uuids = params.uuids;
|
|
46722
|
+
var sourceStructureId = params.structureId, addNameBaseToAttributeName = params.addNameBaseToAttributeName, playoffStructureNameBase = params.playoffStructureNameBase, finishingPositionNaming = params.finishingPositionNaming, finishingPositionLimit = params.finishingPositionLimit, playoffAttributes = params.playoffAttributes, playoffPositions = params.playoffPositions, roundOffsetLimit = params.roundOffsetLimit, tournamentRecord = params.tournamentRecord, exitProfileLimit = params.exitProfileLimit, roundProfiles = params.roundProfiles, roundNumbers = params.roundNumbers, idPrefix = params.idPrefix, isMock = params.isMock, event = params.event, uuids = params.uuids;
|
|
46708
46723
|
// The goal here is to return { structures, links } and not modify existing drawDefinition
|
|
46709
46724
|
// However, a copy of the drawDefinition needs to have the structures attached in order to
|
|
46710
46725
|
// populate the newly created structures with participants which should advance into them
|
|
@@ -46795,6 +46810,9 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
46795
46810
|
idPrefix: idPrefix,
|
|
46796
46811
|
isMock: isMock,
|
|
46797
46812
|
uuids: uuids,
|
|
46813
|
+
finishingPositionNaming: finishingPositionNaming,
|
|
46814
|
+
finishingPositionLimit: finishingPositionLimit,
|
|
46815
|
+
roundOffsetLimit: roundOffsetLimit,
|
|
46798
46816
|
});
|
|
46799
46817
|
if (result.error)
|
|
46800
46818
|
return { value: decorateResult({ result: result, stack: stack }) };
|
|
@@ -46979,8 +46997,8 @@ function addVoluntaryConsolationStage$1(_a) {
|
|
|
46979
46997
|
|
|
46980
46998
|
function generateVoluntaryConsolation$1(params) {
|
|
46981
46999
|
var _a, _b;
|
|
46982
|
-
var _c, _d, _e, _f, _g;
|
|
46983
|
-
var
|
|
47000
|
+
var _c, _d, _e, _f, _g, _h, _j;
|
|
47001
|
+
var _k = params.drawType, drawType = _k === void 0 ? SINGLE_ELIMINATION : _k, _l = params.attachConsolation, attachConsolation = _l === void 0 ? true : _l, _m = params.applyPositioning, applyPositioning = _m === void 0 ? true : _m, tournamentRecord = params.tournamentRecord, staggeredEntry = params.staggeredEntry, // optional - specifies main structure FEED_IN for drawTypes CURTIS_CONSOLATION, FEED_IN_CHAMPIONSHIPS, FMLC
|
|
46984
47002
|
automated = params.automated, placeByes = params.placeByes, isMock = params.isMock, event = params.event;
|
|
46985
47003
|
var drawDefinition = params === null || params === void 0 ? void 0 : params.drawDefinition;
|
|
46986
47004
|
if (!drawDefinition)
|
|
@@ -47013,8 +47031,8 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
47013
47031
|
if (result_1.error)
|
|
47014
47032
|
return result_1;
|
|
47015
47033
|
}
|
|
47016
|
-
tieFormat = copyTieFormat(tieFormat
|
|
47017
|
-
matchUpType = matchUpType
|
|
47034
|
+
tieFormat = copyTieFormat(tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_d = resolveTieFormat({ drawDefinition: drawDefinition })) === null || _d === void 0 ? void 0 : _d.tieFormat);
|
|
47035
|
+
matchUpType = (_e = matchUpType !== null && matchUpType !== void 0 ? matchUpType : drawDefinition.matchUpType) !== null && _e !== void 0 ? _e : TypeEnum.Singles;
|
|
47018
47036
|
var stageStructures = getDrawStructures({
|
|
47019
47037
|
stageSequence: 1,
|
|
47020
47038
|
drawDefinition: drawDefinition,
|
|
@@ -47023,13 +47041,13 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
47023
47041
|
// invalid to have more than one existing VOLUNTARY_CONSOLATION structure
|
|
47024
47042
|
var structureCount = stageStructures.length;
|
|
47025
47043
|
if (structureCount > 1)
|
|
47026
|
-
return { error:
|
|
47044
|
+
return { error: STAGE_SEQUENCE_LIMIT };
|
|
47027
47045
|
// invalid to already have matchUps generated for any existing structure
|
|
47028
|
-
if ((
|
|
47029
|
-
return { error:
|
|
47030
|
-
var structureId = (
|
|
47046
|
+
if ((_g = (_f = stageStructures === null || stageStructures === void 0 ? void 0 : stageStructures[0]) === null || _f === void 0 ? void 0 : _f.matchUps) === null || _g === void 0 ? void 0 : _g.length)
|
|
47047
|
+
return { error: EXISTING_STRUCTURE };
|
|
47048
|
+
var structureId = (_h = stageStructures === null || stageStructures === void 0 ? void 0 : stageStructures[0]) === null || _h === void 0 ? void 0 : _h.structureId;
|
|
47031
47049
|
Object.assign(params, definedAttributes({
|
|
47032
|
-
structureName: params.structureName
|
|
47050
|
+
structureName: (_j = params.structureName) !== null && _j !== void 0 ? _j : constantToString(VOLUNTARY_CONSOLATION),
|
|
47033
47051
|
structureId: structureId,
|
|
47034
47052
|
matchUpType: matchUpType,
|
|
47035
47053
|
tieFormat: tieFormat,
|
|
@@ -55024,17 +55042,6 @@ function formatPersonName(_a) {
|
|
|
55024
55042
|
if (!person)
|
|
55025
55043
|
return;
|
|
55026
55044
|
var spacer = hasSpacing(personFormat) ? ' ' : '';
|
|
55027
|
-
var capitalizeFirst = function (str) {
|
|
55028
|
-
return str
|
|
55029
|
-
.split(' ')
|
|
55030
|
-
.map(function (name) {
|
|
55031
|
-
return name
|
|
55032
|
-
.split('')
|
|
55033
|
-
.map(function (c, i) { return (i ? c.toLowerCase() : c.toUpperCase()); })
|
|
55034
|
-
.join('');
|
|
55035
|
-
})
|
|
55036
|
-
.join(' ');
|
|
55037
|
-
};
|
|
55038
55045
|
var firstName = capitalizeFirst((_b = person === null || person === void 0 ? void 0 : person.standardGivenName) !== null && _b !== void 0 ? _b : '');
|
|
55039
55046
|
var lastName = capitalizeFirst((_c = person === null || person === void 0 ? void 0 : person.standardFamilyName) !== null && _c !== void 0 ? _c : '');
|
|
55040
55047
|
if (!personFormat)
|
|
@@ -63017,7 +63024,7 @@ function generateDrawDefinition(params) {
|
|
|
63017
63024
|
}
|
|
63018
63025
|
else if (structureId && generateQualifyingPlaceholder) {
|
|
63019
63026
|
var qualifyingStructure = structureTemplate({
|
|
63020
|
-
structureName: QUALIFYING,
|
|
63027
|
+
structureName: constantToString(QUALIFYING),
|
|
63021
63028
|
stage: QUALIFYING,
|
|
63022
63029
|
});
|
|
63023
63030
|
var link = generateQualifyingLink({
|
|
@@ -68923,6 +68930,7 @@ var utilities = {
|
|
|
68923
68930
|
structureSort: structureSort,
|
|
68924
68931
|
matchUpSort: matchUpSort,
|
|
68925
68932
|
tidyScore: tidyScore,
|
|
68933
|
+
createMap: createMap,
|
|
68926
68934
|
generateScoreString: generateScoreString,
|
|
68927
68935
|
calculateWinCriteria: calculateWinCriteria,
|
|
68928
68936
|
compareTieFormats: compareTieFormats,
|