tods-competition-factory 1.7.8 → 1.7.10

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.
@@ -1276,6 +1276,28 @@ interface UnifiedVenueID {
1276
1276
  venueId: string;
1277
1277
  }
1278
1278
 
1279
+ /**
1280
+ *
1281
+ * @param {object} playoffAttributes - mapping of exitProfile to structure names, e.g. 0-1-1 for SOUTH
1282
+ * @param {string} playoffStructureNameBase - Root word for default playoff naming, e.g. 'Playoff' for 'Playoff 3-4'
1283
+ * @param {string} exitProfile - rounds at which a participant exited each structure, e.g. 0-1-1-1 for losing EAST, WEST, SOUTH
1284
+ * @param {boolean} exitProfileLimit - limit playoff rounds generated by the attributes present in playoffAttributes
1285
+ * @param {number} finishingPositionOffset - amount by which to offset finishingPositions, e.g. 2 for playing off 3-4
1286
+ * @param {number} finishingPositionLimit - highest value of possible finishing Positions to play off
1287
+ * @param {object} finishingPositionNaming - map of { [finishingPositionRange]: customName }
1288
+ * @param {number} roundOffsetLimit - how many rounds to play off (# of additional matchUps per participant)
1289
+ * @param {number} roundOffset - used internally to track generated structures; saved in structure attributes;
1290
+ * @param {number} stageSequence - what sequence within stage structures, e.g. WEST is stageSequence 2 in COMPASS
1291
+ * @param {string} stage - [QUALIFYING, MAIN, CONSOLATION, PLAY-OFF]
1292
+ *
1293
+ */
1294
+ type NamingEntry = {
1295
+ [key: string]: {
1296
+ name: string;
1297
+ abbreviation: string;
1298
+ };
1299
+ };
1300
+
1279
1301
  type HydratedParticipant = {
1280
1302
  [key: string | number]: any;
1281
1303
  } & Participant;
@@ -1349,13 +1371,16 @@ type RoundProfile = {
1349
1371
 
1350
1372
  type GenerateAndPopulateArgs = {
1351
1373
  addNameBaseToAttributeName?: boolean;
1374
+ finishingPositionNaming?: NamingEntry;
1352
1375
  playoffStructureNameBase?: string;
1376
+ playoffAttributes?: NamingEntry;
1377
+ finishingPositionLimit?: number;
1353
1378
  tournamentRecord?: Tournament;
1354
1379
  drawDefinition: DrawDefinition;
1355
1380
  roundProfiles?: RoundProfile[];
1356
1381
  playoffPositions?: number[];
1382
+ roundOffsetLimit?: number;
1357
1383
  exitProfileLimit?: boolean;
1358
- playoffAttributes?: any;
1359
1384
  roundNumbers?: number[];
1360
1385
  structureId: string;
1361
1386
  idPrefix?: string;
@@ -503,6 +503,10 @@ const INVALID_STAGE = {
503
503
  message: "Invalid stage",
504
504
  code: "ERR_INVALID_STAGE"
505
505
  };
506
+ const STAGE_SEQUENCE_LIMIT = {
507
+ message: "stageSequence limit",
508
+ code: "ERR_LIMIT_STAGE_SEQUENCE"
509
+ };
506
510
  const MISSING_POSITION_ASSIGNMENTS = {
507
511
  message: "Missing positionAssignments",
508
512
  code: "ERR_MISSING_POSITION_ASSIGNMENTS"
@@ -724,6 +728,10 @@ const EXISTING_STAGE = {
724
728
  message: "Existing stage",
725
729
  code: "ERR_EXISTING_STAGE"
726
730
  };
731
+ const EXISTING_STRUCTURE = {
732
+ message: "Existing structure",
733
+ code: "ERR_EXISTING_STRUCTURE"
734
+ };
727
735
 
728
736
  const syncGlobalState = {
729
737
  disableNotifications: false,
@@ -1164,6 +1172,9 @@ function getAccessorValue({ element, accessor }) {
1164
1172
  }
1165
1173
  }
1166
1174
 
1175
+ function isString(obj) {
1176
+ return typeof obj === "string";
1177
+ }
1167
1178
  function isObject(obj) {
1168
1179
  return typeof obj === "object";
1169
1180
  }
@@ -4961,6 +4972,15 @@ function getNumericSeedValue(seedValue) {
4961
4972
  return Infinity;
4962
4973
  }
4963
4974
 
4975
+ function capitalizeFirst(str) {
4976
+ return !isString(str) ? str : str.split(" ").map(
4977
+ (name) => name.split("").map((c, i) => i ? c.toLowerCase() : c.toUpperCase()).join("")
4978
+ ).join(" ");
4979
+ }
4980
+ function constantToString(str) {
4981
+ return !isString(str) ? str : capitalizeFirst(str.replace(/_/g, " "));
4982
+ }
4983
+
4964
4984
  const structureTemplate = ({
4965
4985
  finishingPosition = ROUND_OUTCOME,
4966
4986
  qualifyingRoundNumber,
@@ -5073,7 +5093,7 @@ function groupRounds({ groupSize, drawPositionOffset }) {
5073
5093
  }
5074
5094
 
5075
5095
  function generateRoundRobin({
5076
- structureName = MAIN,
5096
+ structureName = constantToString(MAIN),
5077
5097
  stageSequence = 1,
5078
5098
  structureOptions,
5079
5099
  appliedPolicies,
@@ -14055,8 +14075,8 @@ function firstRoundLoserConsolation(params) {
14055
14075
  };
14056
14076
  const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
14057
14077
  const mainStructure = structureTemplate({
14078
+ structureName: structureName || constantToString(MAIN),
14058
14079
  structureId: structureId || uuids?.pop(),
14059
- structureName: structureName || MAIN,
14060
14080
  stageSequence,
14061
14081
  matchUpType,
14062
14082
  matchUps,
@@ -14073,7 +14093,8 @@ function firstRoundLoserConsolation(params) {
14073
14093
  matchUpType,
14074
14094
  isMock
14075
14095
  });
14076
- const consolationStructureName = params.consolationStructureName || (structureName ? `${structureName} ${CONSOLATION}` : CONSOLATION);
14096
+ const consolation = constantToString(CONSOLATION);
14097
+ const consolationStructureName = params.consolationStructureName || (structureName ? `${structureName} ${consolation}` : consolation);
14077
14098
  const consolationStructure = structureTemplate({
14078
14099
  structureName: consolationStructureName,
14079
14100
  matchUps: consolationMatchUps,
@@ -14151,8 +14172,9 @@ function feedInLinks({
14151
14172
 
14152
14173
  function generateCurtisConsolation(params) {
14153
14174
  const {
14175
+ structureName = constantToString(MAIN),
14176
+ playoffStructureNameBase,
14154
14177
  finishingPositionOffset,
14155
- structureName = MAIN,
14156
14178
  stageSequence = 1,
14157
14179
  structureNameMap,
14158
14180
  staggeredEntry,
@@ -14190,6 +14212,7 @@ function generateCurtisConsolation(params) {
14190
14212
  const { consolationStructure } = consolationFeedStructure({
14191
14213
  idPrefix: idPrefix && `${idPrefix}-c${index}`,
14192
14214
  structureId: uuids?.pop(),
14215
+ playoffStructureNameBase,
14193
14216
  structureNameMap,
14194
14217
  stageSequence: stageSequence2,
14195
14218
  roundOffset,
@@ -14218,12 +14241,15 @@ function generateCurtisConsolation(params) {
14218
14241
  matchUpType,
14219
14242
  isMock
14220
14243
  });
14244
+ const defaultName = constantToString(PLAY_OFF);
14245
+ const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
14246
+ const structureName2 = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
14221
14247
  const playoffStructure = structureTemplate({
14222
- structureName: structureNameMap?.[PLAY_OFF] || PLAY_OFF,
14223
14248
  structureId: uuids?.pop(),
14224
14249
  matchUps: playoffMatchUps,
14225
14250
  stageSequence: 2,
14226
14251
  stage: PLAY_OFF,
14252
+ structureName: structureName2,
14227
14253
  matchUpType
14228
14254
  });
14229
14255
  const playoffLink = {
@@ -14245,6 +14271,7 @@ function generateCurtisConsolation(params) {
14245
14271
  return { structures, links, ...SUCCESS };
14246
14272
  }
14247
14273
  function consolationFeedStructure({
14274
+ playoffStructureNameBase,
14248
14275
  stageSequence = 1,
14249
14276
  structureNameMap,
14250
14277
  roundOffset = 0,
@@ -14267,8 +14294,9 @@ function consolationFeedStructure({
14267
14294
  isMock,
14268
14295
  uuids
14269
14296
  });
14270
- const defaultName = `${CONSOLATION} ${index + 1}`;
14271
- const structureName = structureNameMap?.[defaultName] || defaultName;
14297
+ const defaultName = `${constantToString(CONSOLATION)} ${index + 1}`;
14298
+ const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
14299
+ const structureName = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
14272
14300
  const consolationStructure = structureTemplate({
14273
14301
  matchUps: consolationMatchUps,
14274
14302
  stage: CONSOLATION,
@@ -14281,7 +14309,6 @@ function consolationFeedStructure({
14281
14309
  }
14282
14310
 
14283
14311
  function generatePlayoffStructures(params) {
14284
- let { matchUpType } = params;
14285
14312
  const {
14286
14313
  finishingPositionOffset = 0,
14287
14314
  addNameBaseToAttributeName,
@@ -14311,7 +14338,7 @@ function generatePlayoffStructures(params) {
14311
14338
  const allMatchUps = [];
14312
14339
  const structures = [];
14313
14340
  const links = [];
14314
- matchUpType = matchUpType || drawDefinition?.matchUpType;
14341
+ const matchUpType = params.matchUpType || drawDefinition?.matchUpType;
14315
14342
  const finishingPositionsFrom = finishingPositionOffset + 1;
14316
14343
  const finishingPositionsTo = finishingPositionOffset + drawSize;
14317
14344
  const finishingPositionRange = `${finishingPositionsFrom}-${finishingPositionsTo}`;
@@ -14361,7 +14388,7 @@ function generatePlayoffStructures(params) {
14361
14388
  if (playoffDrawPositions < 2)
14362
14389
  return;
14363
14390
  const childFinishingPositionOffset = drawSize / Math.pow(2, roundNumber) + finishingPositionOffset;
14364
- if (childFinishingPositionOffset + 1 > finishingPositionLimit)
14391
+ if (finishingPositionLimit && childFinishingPositionOffset + 1 > finishingPositionLimit)
14365
14392
  return;
14366
14393
  const {
14367
14394
  structures: childStructures,
@@ -14449,8 +14476,8 @@ function feedInChampionship(params) {
14449
14476
  };
14450
14477
  const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
14451
14478
  const mainStructure = structureTemplate({
14479
+ structureName: structureName || constantToString(MAIN),
14452
14480
  structureId: structureId || uuids?.pop(),
14453
- structureName: structureName || MAIN,
14454
14481
  stageSequence,
14455
14482
  matchUpType,
14456
14483
  matchUps,
@@ -14474,9 +14501,9 @@ function feedInChampionship(params) {
14474
14501
  });
14475
14502
  if (drawSize > 2) {
14476
14503
  const consolationStructure = structureTemplate({
14504
+ structureName: constantToString(CONSOLATION),
14477
14505
  matchUps: consolationMatchUps,
14478
14506
  structureId: uuids?.pop(),
14479
- structureName: CONSOLATION,
14480
14507
  stage: CONSOLATION,
14481
14508
  stageSequence: 1,
14482
14509
  matchUpType
@@ -14551,10 +14578,19 @@ function processPlayoffGroups({
14551
14578
  if (positionsPlayedOff) {
14552
14579
  finishingPositionOffset = Math.min(...positionsPlayedOff) - 1;
14553
14580
  }
14554
- const params = {
14581
+ const playoffGroupParams = {
14582
+ addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
14583
+ playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
14584
+ finishingPositionNaming: playoffGroup.finishingPositionNaming,
14585
+ finishingPositionLimit: playoffGroup.finishingPositionLimit,
14555
14586
  structureId: playoffGroup.structureId ?? uuids?.pop(),
14587
+ playoffAttributes: playoffGroup.playoffAttributes,
14556
14588
  structureNameMap: playoffGroup.structureNameMap,
14557
14589
  structureName: playoffGroup.structureName,
14590
+ sequenceLimit: playoffGroup.sequenceLimit
14591
+ };
14592
+ const params = {
14593
+ ...playoffGroupParams,
14558
14594
  idPrefix: idPrefix && `${idPrefix}-po`,
14559
14595
  appliedPolicies: policyDefinitions,
14560
14596
  finishingPositionOffset,
@@ -16559,20 +16595,20 @@ function evaluateCollectionResult({
16559
16595
  if (matchUp.winningSide)
16560
16596
  sideWins[matchUp.winningSide - 1] += 1;
16561
16597
  });
16562
- if (matchUpValue) {
16598
+ if (isConvertableInteger(matchUpValue)) {
16563
16599
  collectionMatchUps.forEach((matchUp) => {
16564
16600
  if (matchUp.winningSide) {
16565
16601
  sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
16566
16602
  }
16567
16603
  });
16568
- } else if (setValue) {
16604
+ } else if (isConvertableInteger(setValue)) {
16569
16605
  collectionMatchUps.forEach((matchUp) => {
16570
16606
  matchUp.score?.sets?.forEach((set) => {
16571
16607
  if (set.winningSide)
16572
16608
  sideMatchUpValues[set.winningSide - 1] += setValue;
16573
16609
  });
16574
16610
  });
16575
- } else if (scoreValue) {
16611
+ } else if (isConvertableInteger(scoreValue)) {
16576
16612
  collectionMatchUps.forEach((matchUp) => {
16577
16613
  matchUp.score?.sets?.forEach((set) => {
16578
16614
  const {
@@ -16599,15 +16635,17 @@ function evaluateCollectionResult({
16599
16635
  collectionDefinition,
16600
16636
  collectionPosition
16601
16637
  });
16602
- sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue2;
16638
+ if (isConvertableInteger(matchUpValue2)) {
16639
+ sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue2;
16640
+ }
16603
16641
  }
16604
16642
  });
16605
16643
  }
16606
- if (collectionValue) {
16644
+ if (isConvertableInteger(collectionValue)) {
16607
16645
  let collectionWinningSide;
16608
16646
  if (winCriteria?.aggregateValue) {
16609
16647
  if (allCollectionMatchUpsCompleted) {
16610
- if ((matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
16648
+ if (isConvertableInteger(matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
16611
16649
  collectionWinningSide = sideMatchUpValues[0] > sideMatchUpValues[1] ? 1 : 2;
16612
16650
  } else if (sideWins[0] !== sideWins[1]) {
16613
16651
  collectionWinningSide = sideWins[0] > sideWins[1] ? 1 : 2;
@@ -16643,7 +16681,7 @@ function evaluateCollectionResult({
16643
16681
  }
16644
16682
  if (!belongsToValueGroup) {
16645
16683
  sideCollectionValues.forEach(
16646
- (sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue
16684
+ (sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue || 0
16647
16685
  );
16648
16686
  } else {
16649
16687
  groupValueGroups[collectionGroupNumber].sideWins[0] += sideWins[0] || 0;
@@ -16668,7 +16706,9 @@ function getGroupValueGroups({
16668
16706
  }) {
16669
16707
  const groupValueGroups = Object.assign(
16670
16708
  {},
16671
- ...collectionGroups.filter((group) => group?.groupValue && group?.groupNumber).map((group) => ({
16709
+ ...collectionGroups.filter(
16710
+ (group) => isConvertableInteger(group?.groupValue) && group?.groupNumber
16711
+ ).map((group) => ({
16672
16712
  [group.groupNumber]: {
16673
16713
  ...group,
16674
16714
  allGroupMatchUpsCompleted: true,
@@ -16745,11 +16785,11 @@ function generateTieMatchUpScore(params) {
16745
16785
  }, void 0);
16746
16786
  }
16747
16787
  if (groupWinningSide) {
16748
- sideTieValues[groupWinningSide - 1] += groupValue;
16788
+ sideTieValues[groupWinningSide - 1] += groupValue || 0;
16749
16789
  }
16750
16790
  }
16751
16791
  const sideScores = sideTieValues.map(
16752
- (sideTieValue, i) => sideTieValue + sideAdjustments[i]
16792
+ (sideTieValue, i) => (sideTieValue || 0) + sideAdjustments[i]
16753
16793
  );
16754
16794
  const set = {
16755
16795
  side1Score: sideScores[0],
@@ -17402,8 +17442,11 @@ function generateAndPopulatePlayoffStructures(params) {
17402
17442
  structureId: sourceStructureId,
17403
17443
  addNameBaseToAttributeName,
17404
17444
  playoffStructureNameBase,
17445
+ finishingPositionNaming,
17446
+ finishingPositionLimit,
17405
17447
  playoffAttributes,
17406
17448
  playoffPositions,
17449
+ roundOffsetLimit,
17407
17450
  tournamentRecord,
17408
17451
  exitProfileLimit,
17409
17452
  roundProfiles,
@@ -17508,7 +17551,10 @@ function generateAndPopulatePlayoffStructures(params) {
17508
17551
  drawSize,
17509
17552
  idPrefix,
17510
17553
  isMock,
17511
- uuids
17554
+ uuids,
17555
+ finishingPositionNaming,
17556
+ finishingPositionLimit,
17557
+ roundOffsetLimit
17512
17558
  });
17513
17559
  if (result.error)
17514
17560
  return decorateResult({ result, stack });
@@ -19129,13 +19175,17 @@ function createGroupParticipant({
19129
19175
 
19130
19176
  function generateRoundRobinWithPlayOff(params) {
19131
19177
  const { drawDefinition, structureOptions, requireSequential } = params;
19132
- const mainDrawProperties = { structureName: MAIN, ...params, stage: MAIN };
19178
+ const mainDrawProperties = {
19179
+ structureName: constantToString(MAIN),
19180
+ ...params,
19181
+ stage: MAIN
19182
+ };
19133
19183
  const { structures, groupCount, groupSize } = generateRoundRobin(mainDrawProperties);
19134
19184
  if (groupCount < 1) {
19135
19185
  console.log(INVALID_CONFIGURATION);
19136
19186
  }
19137
19187
  const playoffGroups = structureOptions?.playoffGroups || [
19138
- { finishingPositions: [1], structureName: PLAY_OFF }
19188
+ { finishingPositions: [1], structureName: constantToString(PLAY_OFF) }
19139
19189
  ];
19140
19190
  const [mainStructure] = structures;
19141
19191
  const { structures: playoffStructures, links } = processPlayoffGroups({
@@ -19253,7 +19303,7 @@ function generateDoubleElimination({
19253
19303
  isMock
19254
19304
  });
19255
19305
  const mainStructure = structureTemplate({
19256
- structureName: structureName || MAIN,
19306
+ structureName: structureName || constantToString(MAIN),
19257
19307
  structureId: uuids?.pop(),
19258
19308
  stageSequence: 1,
19259
19309
  stage: MAIN,
@@ -19272,9 +19322,9 @@ function generateDoubleElimination({
19272
19322
  uuids
19273
19323
  });
19274
19324
  const consolationStructure = structureTemplate({
19325
+ structureName: constantToString(BACKDRAW),
19275
19326
  matchUps: consolationMatchUps,
19276
19327
  structureId: uuids?.pop(),
19277
- structureName: BACKDRAW,
19278
19328
  stage: CONSOLATION,
19279
19329
  stageSequence: 2,
19280
19330
  matchUpType
@@ -19287,9 +19337,9 @@ function generateDoubleElimination({
19287
19337
  isMock
19288
19338
  });
19289
19339
  const deciderStructure = structureTemplate({
19340
+ structureName: constantToString(DECIDER),
19290
19341
  matchUps: deciderMatchUps,
19291
19342
  structureId: uuids?.pop(),
19292
- structureName: DECIDER,
19293
19343
  stageSequence: 3,
19294
19344
  stage: PLAY_OFF,
19295
19345
  matchUpType
@@ -19411,11 +19461,12 @@ function getGenerators(params) {
19411
19461
  const { appliedPolicies } = getAppliedPolicies(params);
19412
19462
  const feedPolicy = params.policyDefinitions?.[POLICY_TYPE_FEED_IN] || appliedPolicies?.[POLICY_TYPE_FEED_IN];
19413
19463
  params.skipRounds = params.skipRounds || drawSize <= 4 && (feedPolicy?.feedMainFinal ? 0 : 1) || 0;
19464
+ const main = constantToString(MAIN);
19414
19465
  const singleElimination = () => {
19415
19466
  const { matchUps } = treeMatchUps(params);
19416
19467
  const structure = structureTemplate({
19417
- structureName: structureName || MAIN,
19418
19468
  structureId: structureId || uuids?.pop(),
19469
+ structureName: structureName || main,
19419
19470
  stageSequence,
19420
19471
  matchUpType,
19421
19472
  matchUps,
@@ -19426,8 +19477,8 @@ function getGenerators(params) {
19426
19477
  const generators = {
19427
19478
  [AD_HOC]: () => {
19428
19479
  const structure = structureTemplate({
19429
- structureName: structureName || MAIN,
19430
19480
  structureId: structureId || uuids?.pop(),
19481
+ structureName: structureName || main,
19431
19482
  finishingPosition: WIN_RATIO,
19432
19483
  stageSequence,
19433
19484
  matchUps: [],
@@ -19439,8 +19490,8 @@ function getGenerators(params) {
19439
19490
  [LUCKY_DRAW]: () => {
19440
19491
  const { matchUps } = luckyDraw(params);
19441
19492
  const structure = structureTemplate({
19442
- structureName: structureName || MAIN,
19443
19493
  structureId: structureId || uuids?.pop(),
19494
+ structureName: structureName || main,
19444
19495
  stageSequence,
19445
19496
  matchUpType,
19446
19497
  matchUps,
@@ -19466,8 +19517,8 @@ function getGenerators(params) {
19466
19517
  [FEED_IN$1]: () => {
19467
19518
  const { matchUps } = feedInMatchUps({ drawSize, uuids, matchUpType });
19468
19519
  const structure = structureTemplate({
19469
- structureName: structureName || MAIN,
19470
19520
  structureId: structureId || uuids?.pop(),
19521
+ structureName: structureName || main,
19471
19522
  stageSequence,
19472
19523
  matchUpType,
19473
19524
  stage: MAIN,
@@ -19529,9 +19580,9 @@ function generateVoluntaryConsolation$1(params) {
19529
19580
  return result2;
19530
19581
  }
19531
19582
  tieFormat = copyTieFormat(
19532
- tieFormat || resolveTieFormat({ drawDefinition })?.tieFormat
19583
+ tieFormat ?? resolveTieFormat({ drawDefinition })?.tieFormat
19533
19584
  );
19534
- matchUpType = matchUpType || drawDefinition.matchUpType || TypeEnum.Singles;
19585
+ matchUpType = matchUpType ?? drawDefinition.matchUpType ?? TypeEnum.Singles;
19535
19586
  const { structures: stageStructures } = getDrawStructures({
19536
19587
  stageSequence: 1,
19537
19588
  drawDefinition,
@@ -19539,14 +19590,14 @@ function generateVoluntaryConsolation$1(params) {
19539
19590
  });
19540
19591
  const structureCount = stageStructures.length;
19541
19592
  if (structureCount > 1)
19542
- return { error: INVALID_STRUCTURE };
19593
+ return { error: STAGE_SEQUENCE_LIMIT };
19543
19594
  if (stageStructures?.[0]?.matchUps?.length)
19544
- return { error: INVALID_STRUCTURE };
19595
+ return { error: EXISTING_STRUCTURE };
19545
19596
  const structureId = stageStructures?.[0]?.structureId;
19546
19597
  Object.assign(
19547
19598
  params,
19548
19599
  definedAttributes({
19549
- structureName: params.structureName || VOLUNTARY_CONSOLATION,
19600
+ structureName: params.structureName ?? constantToString(VOLUNTARY_CONSOLATION),
19550
19601
  structureId,
19551
19602
  matchUpType,
19552
19603
  tieFormat,
@@ -23268,7 +23319,7 @@ function generateDrawDefinition(params) {
23268
23319
  }
23269
23320
  } else if (structureId && generateQualifyingPlaceholder) {
23270
23321
  const qualifyingStructure = structureTemplate({
23271
- structureName: QUALIFYING,
23322
+ structureName: constantToString(QUALIFYING),
23272
23323
  stage: QUALIFYING
23273
23324
  });
23274
23325
  const { link } = generateQualifyingLink({