tods-competition-factory 1.8.0 → 1.8.2

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.
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
362
362
  };
363
363
 
364
364
  function factoryVersion() {
365
- return '1.8.0';
365
+ return '1.8.2';
366
366
  }
367
367
 
368
368
  /******************************************************************************
@@ -2880,6 +2880,7 @@ function JSON2CSV(arrayOfJSON, config) {
2880
2880
  : rows.join(rowJoiner);
2881
2881
  }
2882
2882
  function flattenJSON(obj, keyJoiner, path) {
2883
+ if (keyJoiner === void 0) { keyJoiner = '.'; }
2883
2884
  if (path === void 0) { path = []; }
2884
2885
  return (typeof obj === 'object' &&
2885
2886
  Object.keys(obj).reduce(function (result, key) {
@@ -6199,7 +6200,7 @@ function removeExtension(_a) {
6199
6200
  }
6200
6201
  function addEventExtension(_a) {
6201
6202
  var e_3, _b;
6202
- var tournamentRecords = _a.tournamentRecords, eventId = _a.eventId, extension = _a.extension;
6203
+ var tournamentRecords = _a.tournamentRecords, extension = _a.extension, eventId = _a.eventId;
6203
6204
  if (typeof eventId !== 'string')
6204
6205
  return { error: MISSING_EVENT };
6205
6206
  if (!isValidExtension({ extension: extension }))
@@ -16772,6 +16773,137 @@ var fixtures = {
16772
16773
  flagIOC: flagIOC,
16773
16774
  };
16774
16775
 
16776
+ var logColors = {
16777
+ reset: '\x1b[0m',
16778
+ bright: '\x1b[1m',
16779
+ dim: '\x1b[2m',
16780
+ red: '\x1b[31m',
16781
+ brightred: '\x1b[91m',
16782
+ green: '\x1b[32m',
16783
+ brightgreen: '\x1b[92m',
16784
+ yellow: '\x1b[33m',
16785
+ brightyellow: '\x1b[93m',
16786
+ blue: '\x1b[34m',
16787
+ brightblue: '\x1b[94m',
16788
+ lightblue: '\x1b[105m',
16789
+ magenta: '\x1b[35m',
16790
+ brightmagenta: '\x1b[95m',
16791
+ cyan: '\x1b[36m',
16792
+ brightcyan: '\x1b[96m',
16793
+ white: '\x1b[37m',
16794
+ brightwhite: '\x1b[97m',
16795
+ };
16796
+
16797
+ var globalLog = [];
16798
+ function pushGlobalLog(value, devContextOverride) {
16799
+ if (typeof value === 'string')
16800
+ value = { method: value };
16801
+ if (devContextOverride || getDevContext())
16802
+ globalLog.push(value);
16803
+ }
16804
+ function getGlobalLog(purge) {
16805
+ var globalLogCopy = globalLog.slice();
16806
+ if (purge) {
16807
+ globalLog.length = 0;
16808
+ }
16809
+ return globalLogCopy;
16810
+ }
16811
+ function printGlobalLog(purge) {
16812
+ var globalLogCopy = getGlobalLog(purge);
16813
+ var modifiedText = globalLogCopy.map(function (line) {
16814
+ var color = line.color, keyColors = line.keyColors, method = line.method, newline = line.newline;
16815
+ var methodColor = Object.keys(logColors).includes(color)
16816
+ ? logColors[color]
16817
+ : logColors.cyan;
16818
+ var bodyKeys = Object.keys(line).filter(function (key) { return !['color', 'keyColors', 'method', 'newline'].includes(key); });
16819
+ var body = bodyKeys
16820
+ .map(function (key) {
16821
+ var keyColor = keyColors &&
16822
+ Object.keys(keyColors).includes(key) &&
16823
+ logColors[keyColors[key]]
16824
+ ? logColors[keyColors[key]]
16825
+ : logColors.brightwhite;
16826
+ return "".concat(logColors.white).concat(key, ": ").concat(keyColor).concat(line[key]);
16827
+ })
16828
+ .join(', ');
16829
+ var tabs = (method === null || method === void 0 ? void 0 : method.length) < 15 ? "\t\t" : '\t';
16830
+ return [
16831
+ newline ? '\n' : '',
16832
+ methodColor,
16833
+ method,
16834
+ tabs,
16835
+ logColors.white,
16836
+ body,
16837
+ logColors.reset,
16838
+ '\n',
16839
+ ].join('');
16840
+ });
16841
+ if (modifiedText === null || modifiedText === void 0 ? void 0 : modifiedText.length)
16842
+ console.log.apply(console, __spreadArray([], __read(modifiedText), false));
16843
+ }
16844
+ function purgeGlobalLog() {
16845
+ globalLog.length = 0;
16846
+ }
16847
+
16848
+ function visualizeScheduledMatchUps(_a) {
16849
+ var scheduledMatchUps = _a.scheduledMatchUps, showGlobalLog = _a.showGlobalLog;
16850
+ purgeGlobalLog();
16851
+ var structureIds = scheduledMatchUps === null || scheduledMatchUps === void 0 ? void 0 : scheduledMatchUps.reduce(function (structureIds, _a) {
16852
+ var structureId = _a.structureId;
16853
+ return structureIds.includes(structureId)
16854
+ ? structureIds
16855
+ : structureIds.concat(structureId);
16856
+ }, []);
16857
+ var structureNames = Object.assign.apply(Object, __spreadArray([{}], __read((structureIds || []).map(function (structureId) {
16858
+ var _a;
16859
+ var _b = scheduledMatchUps.find(function (matchUp) { return matchUp.structureId === structureId; }), structureName = _b.structureName, matchUpType = _b.matchUpType;
16860
+ return _a = {},
16861
+ _a[structureId] = "".concat(structureName, " ").concat(matchUpType),
16862
+ _a;
16863
+ })), false));
16864
+ structureIds === null || structureIds === void 0 ? void 0 : structureIds.forEach(function (structureId) {
16865
+ var _a;
16866
+ pushGlobalLog({
16867
+ color: 'blue',
16868
+ method: 'draw',
16869
+ structure: structureNames[structureId],
16870
+ keyColors: {
16871
+ structure: 'magenta',
16872
+ },
16873
+ }, true);
16874
+ var structureMatchUps = scheduledMatchUps.filter(function (matchUp) { return matchUp.structureId === structureId; });
16875
+ var roundMatchUps = ((_a = getRoundMatchUps$1({
16876
+ matchUps: structureMatchUps,
16877
+ })) === null || _a === void 0 ? void 0 : _a.roundMatchUps) || [];
16878
+ Object.keys(roundMatchUps).forEach(function (roundNumber) {
16879
+ pushGlobalLog({
16880
+ roundNumber: roundNumber,
16881
+ keyColors: {
16882
+ roundNumber: 'brightcyan',
16883
+ },
16884
+ }, true);
16885
+ roundMatchUps[roundNumber].forEach(function (_a) {
16886
+ var matchUpId = _a.matchUpId, schedule = _a.schedule;
16887
+ var scheduledTime = extractTime(schedule.scheduledTime);
16888
+ pushGlobalLog({
16889
+ matchUpId: matchUpId,
16890
+ time: scheduledTime,
16891
+ date: schedule.scheduledDate,
16892
+ venue: schedule.venueId,
16893
+ keyColors: {
16894
+ time: 'brightcyan',
16895
+ date: 'brightcyan',
16896
+ matchUpId: 'yellow',
16897
+ venue: 'magenta',
16898
+ },
16899
+ }, true);
16900
+ });
16901
+ });
16902
+ });
16903
+ if (showGlobalLog)
16904
+ printGlobalLog();
16905
+ }
16906
+
16775
16907
  function calculateWinCriteria(_a) {
16776
16908
  var e_1, _b, e_2, _c, e_3, _d;
16777
16909
  var _e = _a.collectionDefinitions, collectionDefinitions = _e === void 0 ? [] : _e, _f = _a.collectionGroups, collectionGroups = _f === void 0 ? [] : _f;
@@ -22807,11 +22939,6 @@ function getStructureDrawPositionProfiles(params) {
22807
22939
  };
22808
22940
  }
22809
22941
 
22810
- function pushGlobalLog(value, devContextOverride) {
22811
- if (devContextOverride || getDevContext())
22812
- ;
22813
- }
22814
-
22815
22942
  function clearDrawPosition(params) {
22816
22943
  var inContextDrawMatchUps = params.inContextDrawMatchUps, participantId = params.participantId, drawPosition = params.drawPosition;
22817
22944
  var tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, structureId = params.structureId, matchUpsMap = params.matchUpsMap, event = params.event;
@@ -23099,7 +23226,11 @@ function removeDrawPosition(_a) {
23099
23226
  initialWinningSide === targetMatchUp.winningSide;
23100
23227
  if (!noChange) {
23101
23228
  if (removedDrawPosition) {
23102
- pushGlobalLog();
23229
+ pushGlobalLog({
23230
+ method: stack,
23231
+ color: 'brightyellow',
23232
+ removedDrawPosition: removedDrawPosition,
23233
+ });
23103
23234
  }
23104
23235
  modifyMatchUpNotice({
23105
23236
  tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
@@ -23147,7 +23278,11 @@ function removeDrawPosition(_a) {
23147
23278
  }).initialRoundNumber;
23148
23279
  // if clearing a drawPosition from a feed round the initialRoundNumber for the drawPosition must be { roundNumber: 1 }
23149
23280
  if (initialRoundNumber_1 === 1) {
23150
- pushGlobalLog();
23281
+ pushGlobalLog({
23282
+ method: stack,
23283
+ color: 'brightyellow',
23284
+ loserMatchUpDrawPosition: loserMatchUpDrawPosition,
23285
+ });
23151
23286
  drawPositionRemovals({
23152
23287
  structureId: loserMatchUp.structureId,
23153
23288
  drawPosition: loserMatchUpDrawPosition,
@@ -23545,7 +23680,7 @@ function assignDrawPositionBye$1(_a) {
23545
23680
  if (!structureId)
23546
23681
  (structureId = structure.structureId);
23547
23682
  var stack = 'assignDrawPositionBye';
23548
- pushGlobalLog();
23683
+ pushGlobalLog({ method: stack, color: 'cyan', drawPosition: drawPosition });
23549
23684
  if (!matchUpsMap) {
23550
23685
  matchUpsMap = getMatchUpsMap({ drawDefinition: drawDefinition });
23551
23686
  }
@@ -23714,7 +23849,8 @@ function assignRoundRobinBYE(_a) {
23714
23849
  function advanceDrawPosition(_a) {
23715
23850
  var _b;
23716
23851
  var drawPositionToAdvance = _a.drawPositionToAdvance, inContextDrawMatchUps = _a.inContextDrawMatchUps, sourceDrawPositions = _a.sourceDrawPositions, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpsMap = _a.matchUpsMap, matchUpId = _a.matchUpId, event = _a.event;
23717
- pushGlobalLog();
23852
+ var stack = 'advanceDrawPosition';
23853
+ pushGlobalLog({ method: stack, color: 'cyan', drawPositionToAdvance: drawPositionToAdvance });
23718
23854
  var matchUp = matchUpsMap.drawMatchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
23719
23855
  var inContextMatchUp = inContextDrawMatchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
23720
23856
  var structureId = inContextMatchUp === null || inContextMatchUp === void 0 ? void 0 : inContextMatchUp.structureId;
@@ -23856,8 +23992,14 @@ function advanceWinner(_a) {
23856
23992
  winningSide: undefined,
23857
23993
  drawPositions: drawPositions,
23858
23994
  });
23859
- noContextWinnerMatchUp.drawPositions.find(function (position) { return !twoDrawPositions.includes(position); });
23860
- pushGlobalLog();
23995
+ var changedDrawPosition = noContextWinnerMatchUp.drawPositions.find(function (position) { return !twoDrawPositions.includes(position); });
23996
+ pushGlobalLog({
23997
+ method: stack,
23998
+ color: 'brightyellow',
23999
+ changedDrawPosition: changedDrawPosition,
24000
+ pairedDrawPositionIsBye: pairedDrawPositionIsBye,
24001
+ drawPositionIsBye: drawPositionIsBye,
24002
+ });
23861
24003
  modifyMatchUpNotice({
23862
24004
  tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
23863
24005
  matchUp: noContextWinnerMatchUp,
@@ -23916,7 +24058,8 @@ function advanceWinner(_a) {
23916
24058
  function assignFedDrawPositionBye(_a) {
23917
24059
  var loserTargetDrawPosition = _a.loserTargetDrawPosition, tournamentRecord = _a.tournamentRecord, loserTargetLink = _a.loserTargetLink, drawDefinition = _a.drawDefinition, loserMatchUp = _a.loserMatchUp, matchUpsMap = _a.matchUpsMap, event = _a.event;
23918
24060
  var roundNumber = loserMatchUp.roundNumber;
23919
- pushGlobalLog();
24061
+ var stack = 'assignFedDrawPositionBye';
24062
+ pushGlobalLog({ method: stack, color: 'cyan', loserTargetDrawPosition: loserTargetDrawPosition });
23920
24063
  var mappedMatchUps = (matchUpsMap === null || matchUpsMap === void 0 ? void 0 : matchUpsMap.mappedMatchUps) || {};
23921
24064
  var loserStructureMatchUps = mappedMatchUps[loserMatchUp.structureId].matchUps;
23922
24065
  var initialRoundNumber = getInitialRoundNumber({
@@ -26934,18 +27077,35 @@ function attemptToSetWinningSide(params) {
26934
27077
  });
26935
27078
  }
26936
27079
 
27080
+ var keyColors = {
27081
+ drawPositionToRemove: 'green',
27082
+ iteration: 'brightred',
27083
+ winner: 'green',
27084
+ loser: 'brightred',
27085
+ };
26937
27086
  function removeDoubleExit(params) {
26938
27087
  var _a;
26939
27088
  var inContextDrawMatchUps = params.inContextDrawMatchUps, appliedPolicies = params.appliedPolicies, drawDefinition = params.drawDefinition, matchUpsMap = params.matchUpsMap, targetData = params.targetData, matchUp = params.matchUp;
26940
27089
  var _b = params.iteration, iteration = _b === void 0 ? 0 : _b;
26941
27090
  iteration += 1;
26942
27091
  var stack = 'removeDoubleExit';
26943
- pushGlobalLog();
27092
+ pushGlobalLog({
27093
+ method: stack,
27094
+ color: 'brightyellow',
27095
+ iteration: iteration,
27096
+ keyColors: keyColors,
27097
+ });
26944
27098
  var loserTargetLink = targetData.targetLinks.loserTargetLink, _c = targetData.targetMatchUps, loserMatchUp = _c.loserMatchUp, winnerMatchUp = _c.winnerMatchUp, loserTargetDrawPosition = _c.loserTargetDrawPosition;
26945
27099
  // only handles winnerMatchUps in the same structure
26946
27100
  if (winnerMatchUp && winnerMatchUp.matchUpStatus !== BYE) {
26947
- winnerMatchUp.stage; winnerMatchUp.roundNumber; winnerMatchUp.roundPosition;
26948
- pushGlobalLog();
27101
+ var stage = winnerMatchUp.stage, roundNumber = winnerMatchUp.roundNumber, roundPosition = winnerMatchUp.roundPosition;
27102
+ pushGlobalLog({
27103
+ winner: 'winner',
27104
+ stage: stage,
27105
+ roundNumber: roundNumber,
27106
+ roundPosition: roundPosition,
27107
+ keyColors: keyColors,
27108
+ });
26949
27109
  conditionallyRemoveDrawPosition(__assign(__assign({}, params), { targetMatchUp: winnerMatchUp, sourceMatchUp: matchUp, iteration: iteration }));
26950
27110
  }
26951
27111
  if (loserMatchUp && loserMatchUp.matchUpStatus !== BYE) {
@@ -26957,8 +27117,15 @@ function removeDoubleExit(params) {
26957
27117
  drawDefinition: drawDefinition,
26958
27118
  structureId: inContextLoserMatchUp.structureId,
26959
27119
  }).structure;
26960
- loserMatchUp.stage; loserMatchUp.roundNumber; loserMatchUp.roundPosition; loserMatchUp.feedRound;
26961
- pushGlobalLog();
27120
+ var stage = loserMatchUp.stage, roundNumber = loserMatchUp.roundNumber, roundPosition = loserMatchUp.roundPosition, feedRound = loserMatchUp.feedRound;
27121
+ pushGlobalLog({
27122
+ loser: 'loser',
27123
+ stage: stage,
27124
+ roundNumber: roundNumber,
27125
+ roundPosition: roundPosition,
27126
+ keyColors: keyColors,
27127
+ feedRound: feedRound,
27128
+ });
26962
27129
  if ((_a = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies.progression) === null || _a === void 0 ? void 0 : _a.doubleExitPropagateBye) {
26963
27130
  removeDirectedBye({
26964
27131
  drawPosition: loserTargetDrawPosition,
@@ -26980,7 +27147,7 @@ function conditionallyRemoveDrawPosition(params) {
26980
27147
  var _a, _b, _c, _d, _e;
26981
27148
  var inContextDrawMatchUps = params.inContextDrawMatchUps, appliedPolicies = params.appliedPolicies, drawDefinition = params.drawDefinition, sourceMatchUp = params.sourceMatchUp, targetMatchUp = params.targetMatchUp, matchUpsMap = params.matchUpsMap, structure = params.structure, iteration = params.iteration;
26982
27149
  var stack = 'conditionallyRemoveDrawPosition';
26983
- pushGlobalLog();
27150
+ pushGlobalLog({ method: stack });
26984
27151
  // only handles winnerMatchUps in the same structure
26985
27152
  var nextTargetData = positionTargets({
26986
27153
  matchUpId: targetMatchUp.matchUpId,
@@ -27024,8 +27191,16 @@ function conditionallyRemoveDrawPosition(params) {
27024
27191
  }
27025
27192
  }
27026
27193
  if (nextWinnerMatchUp && drawPositionToRemove) {
27027
- nextWinnerMatchUp.stage; nextWinnerMatchUp.roundNumber; nextWinnerMatchUp.roundPosition;
27028
- pushGlobalLog();
27194
+ var stage = nextWinnerMatchUp.stage, roundNumber = nextWinnerMatchUp.roundNumber, roundPosition = nextWinnerMatchUp.roundPosition;
27195
+ pushGlobalLog({
27196
+ method: 'removeDirectedWinner',
27197
+ drawPositionToRemove: drawPositionToRemove,
27198
+ keyColors: keyColors,
27199
+ color: 'brightgreen',
27200
+ stage: stage,
27201
+ roundNumber: roundNumber,
27202
+ roundPosition: roundPosition,
27203
+ });
27029
27204
  removeDirectedWinner({
27030
27205
  winningDrawPosition: drawPositionToRemove,
27031
27206
  winnerMatchUp: nextWinnerMatchUp,
@@ -27636,7 +27811,12 @@ function setMatchUpStatus$2(params) {
27636
27811
  return swapWinnerLoser(params);
27637
27812
  }
27638
27813
  var matchUpWinner = (winningSide && !matchUpTieId) || params.projectedWinningSide;
27639
- pushGlobalLog();
27814
+ pushGlobalLog({
27815
+ method: stack,
27816
+ activeDownstream: activeDownstream,
27817
+ matchUpWinner: matchUpWinner,
27818
+ winningSide: winningSide,
27819
+ });
27640
27820
  var result = (!activeDownstream && noDownstreamDependencies(params)) ||
27641
27821
  (matchUpWinner && winningSideWithDownstreamDependencies(params)) ||
27642
27822
  (directingMatchUpStatus && applyMatchUpValues(params)) || {
@@ -35723,7 +35903,8 @@ function getGroupedRounds(_a) {
35723
35903
  }
35724
35904
 
35725
35905
  function getMatchUpsToSchedule(_a) {
35726
- var matchUpPotentialParticipantIds = _a.matchUpPotentialParticipantIds, scheduleCompletedMatchUps = _a.scheduleCompletedMatchUps, dateScheduledMatchUpIds = _a.dateScheduledMatchUpIds, matchUpNotBeforeTimes = _a.matchUpNotBeforeTimes, orderedMatchUpIds = _a.orderedMatchUpIds, clearDate = _a.clearDate, matchUps = _a.matchUps;
35906
+ var matchUpPotentialParticipantIds = _a.matchUpPotentialParticipantIds, scheduleCompletedMatchUps = _a.scheduleCompletedMatchUps, dateScheduledMatchUpIds = _a.dateScheduledMatchUpIds, matchUpNotBeforeTimes = _a.matchUpNotBeforeTimes, matchUpScheduleTimes = _a.matchUpScheduleTimes, orderedMatchUpIds = _a.orderedMatchUpIds, clearDate = _a.clearDate, matchUps = _a.matchUps;
35907
+ var alreadyScheduledMatchUpIds = Object.keys(matchUpScheduleTimes);
35727
35908
  // this must be done to preserve the order of matchUpIds
35728
35909
  var matchUpsToSchedule = orderedMatchUpIds
35729
35910
  .map(function (matchUpId) {
@@ -35731,7 +35912,9 @@ function getMatchUpsToSchedule(_a) {
35731
35912
  })
35732
35913
  .filter(Boolean)
35733
35914
  .filter(function (matchUp) {
35734
- var alreadyScheduled = !clearDate && dateScheduledMatchUpIds.includes(matchUp.matchUpId);
35915
+ var alreadyScheduled = !clearDate &&
35916
+ (dateScheduledMatchUpIds.includes(matchUp.matchUpId) ||
35917
+ alreadyScheduledMatchUpIds.includes(matchUp.matchUpId));
35735
35918
  var doNotSchedule = [
35736
35919
  BYE,
35737
35920
  DEFAULTED,
@@ -35954,6 +36137,7 @@ function getVenueSchedulingDetails(_a) {
35954
36137
  scheduleCompletedMatchUps: scheduleCompletedMatchUps,
35955
36138
  dateScheduledMatchUpIds: dateScheduledMatchUpIds,
35956
36139
  matchUpNotBeforeTimes: matchUpNotBeforeTimes,
36140
+ matchUpScheduleTimes: matchUpScheduleTimes,
35957
36141
  orderedMatchUpIds: orderedMatchUpIds,
35958
36142
  clearDate: clearDate,
35959
36143
  matchUps: matchUps,
@@ -37475,8 +37659,7 @@ function scheduleProfileRounds(_a) {
37475
37659
  clearScheduledMatchUps({ tournamentRecords: tournamentRecords, scheduledDates: scheduledDates });
37476
37660
  }
37477
37661
  var courts = getVenuesAndCourts({
37478
- dates: scheduleDates,
37479
- ignoreDisabled: true,
37662
+ ignoreDisabled: false,
37480
37663
  tournamentRecords: tournamentRecords,
37481
37664
  }).courts;
37482
37665
  var matchUps = allCompetitionMatchUps({
@@ -39788,6 +39971,8 @@ var POLICY_MATCHUP_ACTIONS_DEFAULT = (_a$2 = {},
39788
39971
  processCodes: {
39789
39972
  substitution: ['RANKING.IGNORE', 'RATING.IGNORE'],
39790
39973
  },
39974
+ substituteAfterCompleted: false,
39975
+ substituteWithoutScore: false,
39791
39976
  },
39792
39977
  _a$2);
39793
39978
 
@@ -53261,9 +53446,14 @@ function validDefinitionKeys(definition) {
53261
53446
  return keyValidation.reduce(function (p, key) { return (!definitionKeys.includes(key) ? false : p); }, true);
53262
53447
  }
53263
53448
  function newDrawDefinition(_a) {
53264
- var _b = _a.drawId, drawId = _b === void 0 ? UUID() : _b, matchUpType = _a.matchUpType, drawType = _a.drawType;
53449
+ var _b = _a.drawId, drawId = _b === void 0 ? UUID() : _b, processCodes = _a.processCodes, matchUpType = _a.matchUpType, drawType = _a.drawType;
53265
53450
  var drawDefinition = definitionTemplate();
53266
- return Object.assign(drawDefinition, { drawId: drawId, drawType: drawType, matchUpType: matchUpType });
53451
+ return Object.assign(drawDefinition, {
53452
+ processCodes: processCodes,
53453
+ matchUpType: matchUpType,
53454
+ drawType: drawType,
53455
+ drawId: drawId,
53456
+ });
53267
53457
  }
53268
53458
 
53269
53459
  var drawDefinition$1;
@@ -63080,7 +63270,11 @@ function generateDrawDefinition(params) {
63080
63270
  // Begin construction of drawDefinition
63081
63271
  if (existingDrawDefinition && drawType !== existingDrawDefinition.drawType)
63082
63272
  existingDrawDefinition.drawType = drawType;
63083
- var drawDefinition = existingDrawDefinition !== null && existingDrawDefinition !== void 0 ? existingDrawDefinition : newDrawDefinition({ drawType: drawType, drawId: params.drawId });
63273
+ var drawDefinition = existingDrawDefinition !== null && existingDrawDefinition !== void 0 ? existingDrawDefinition : newDrawDefinition({
63274
+ drawType: drawType,
63275
+ drawId: params.drawId,
63276
+ processCodes: params.processCodes,
63277
+ });
63084
63278
  // if there is a defined matchUpFormat/tieFormat only attach to drawDefinition...
63085
63279
  // ...when there is not an equivalent definition on the parent event
63086
63280
  if (matchUpFormat || tieFormat) {
@@ -63629,10 +63823,24 @@ function enableTieAutoCalc(params) {
63629
63823
  function modifyEvent(_a) {
63630
63824
  var _b, _c, _d, _e, _f;
63631
63825
  var tournamentRecord = _a.tournamentRecord, eventUpdates = _a.eventUpdates, eventId = _a.eventId, event = _a.event;
63826
+ var stack = 'modifyEvent';
63632
63827
  if (!tournamentRecord)
63633
- return { error: MISSING_TOURNAMENT_RECORD };
63634
- if (!isString(eventId) || !isObject(eventUpdates))
63635
- return { error: INVALID_VALUES };
63828
+ return decorateResult({
63829
+ result: { error: MISSING_TOURNAMENT_RECORD },
63830
+ stack: stack,
63831
+ });
63832
+ if (!isString(eventId))
63833
+ return decorateResult({
63834
+ result: { error: MISSING_EVENT },
63835
+ context: { eventId: eventId },
63836
+ stack: stack,
63837
+ });
63838
+ if (!isObject(eventUpdates))
63839
+ return decorateResult({
63840
+ result: { error: INVALID_VALUES },
63841
+ context: { eventUpdates: eventUpdates },
63842
+ stack: stack,
63843
+ });
63636
63844
  var enteredParticipantIds = (_c = (_b = event === null || event === void 0 ? void 0 : event.entries) === null || _b === void 0 ? void 0 : _b.filter(function (_a) {
63637
63845
  var entryStatus = _a.entryStatus;
63638
63846
  var status = entryStatus;
@@ -63666,8 +63874,9 @@ function modifyEvent(_a) {
63666
63874
  enteredParticipantGenders[0] === eventUpdates.gender);
63667
63875
  if (eventUpdates.gender && !validGender)
63668
63876
  return decorateResult({
63669
- context: { gender: eventUpdates.gender },
63877
+ context: { gender: eventUpdates.gender, validGender: validGender },
63670
63878
  result: { error: INVALID_VALUES },
63879
+ stack: stack,
63671
63880
  });
63672
63881
  var validEventTypes = (enteredParticipantTypes.includes(TEAM$1) && [TEAM$1]) ||
63673
63882
  (enteredParticipantTypes.includes(INDIVIDUAL) && [SINGLES]) ||
@@ -63679,8 +63888,9 @@ function modifyEvent(_a) {
63679
63888
  var validEventType = validEventTypes.includes((_f = eventUpdates.eventType) !== null && _f !== void 0 ? _f : '');
63680
63889
  if (eventUpdates.eventType && !validEventType)
63681
63890
  return decorateResult({
63682
- context: { participantType: eventUpdates.eventType },
63891
+ context: { participantType: eventUpdates.eventType, validEventType: validEventType },
63683
63892
  result: { error: INVALID_VALUES },
63893
+ stack: stack,
63684
63894
  });
63685
63895
  if (eventUpdates.eventType)
63686
63896
  event.eventType = eventUpdates.eventType;
@@ -68065,7 +68275,7 @@ function generateEventWithFlights(params) {
68065
68275
  var allUniqueParticipantIds = params.allUniqueParticipantIds, matchUpStatusProfile = params.matchUpStatusProfile, participantsProfile = params.participantsProfile, completeAllMatchUps = params.completeAllMatchUps, autoEntryPositions = params.autoEntryPositions, hydrateCollections = params.hydrateCollections, randomWinningSide = params.randomWinningSide, ratingsParameters = params.ratingsParameters, tournamentRecord = params.tournamentRecord, eventProfile = params.eventProfile, eventIndex = params.eventIndex, publish = params.publish, uuids = params.uuids;
68066
68276
  var gender = eventProfile.gender;
68067
68277
  var eventName = eventProfile.eventName;
68068
- var _e = eventProfile.eventType, eventType = _e === void 0 ? SINGLES : _e, policyDefinitions = eventProfile.policyDefinitions, _f = eventProfile.drawProfiles, drawProfiles = _f === void 0 ? [] : _f, eventExtensions = eventProfile.eventExtensions, surfaceCategory = eventProfile.surfaceCategory, tieFormatName = eventProfile.tieFormatName, discipline = eventProfile.discipline, eventLevel = eventProfile.eventLevel, timeItems = eventProfile.timeItems, ballType = eventProfile.ballType, category = eventProfile.category;
68278
+ var _e = eventProfile.eventType, eventType = _e === void 0 ? SINGLES : _e, policyDefinitions = eventProfile.policyDefinitions, _f = eventProfile.drawProfiles, drawProfiles = _f === void 0 ? [] : _f, eventExtensions = eventProfile.eventExtensions, surfaceCategory = eventProfile.surfaceCategory, tieFormatName = eventProfile.tieFormatName, processCodes = eventProfile.processCodes, discipline = eventProfile.discipline, eventLevel = eventProfile.eventLevel, timeItems = eventProfile.timeItems, ballType = eventProfile.ballType, category = eventProfile.category;
68069
68279
  var eventId = eventProfile.eventId || UUID();
68070
68280
  var tieFormat = eventProfile.tieFormat ||
68071
68281
  (eventType === TEAM$1
@@ -68116,7 +68326,7 @@ function generateEventWithFlights(params) {
68116
68326
  eventAttributes = {};
68117
68327
  var categoryName = (category === null || category === void 0 ? void 0 : category.categoryName) || (category === null || category === void 0 ? void 0 : category.ageCategoryCode) || (category === null || category === void 0 ? void 0 : category.ratingType);
68118
68328
  eventName = eventName || categoryName || 'Generated Event';
68119
- var newEvent = __assign(__assign({}, eventAttributes), { surfaceCategory: surfaceCategory, discipline: discipline, eventLevel: eventLevel, eventName: eventName, eventType: eventType, tieFormat: tieFormat, ballType: ballType, category: category, eventId: eventId, gender: gender });
68329
+ var newEvent = __assign(__assign({}, eventAttributes), { surfaceCategory: surfaceCategory, processCodes: processCodes, discipline: discipline, eventLevel: eventLevel, eventName: eventName, eventType: eventType, tieFormat: tieFormat, ballType: ballType, category: category, eventId: eventId, gender: gender });
68120
68330
  // attach any valid eventExtensions
68121
68331
  if ((eventExtensions === null || eventExtensions === void 0 ? void 0 : eventExtensions.length) && Array.isArray(eventExtensions)) {
68122
68332
  var extensions = eventExtensions.filter(isValidExtension);
@@ -69430,6 +69640,7 @@ var utilities = {
69430
69640
  UUID: UUID,
69431
69641
  UUIDS: UUIDS,
69432
69642
  validateTieFormat: validateTieFormat,
69643
+ visualizeScheduledMatchUps: visualizeScheduledMatchUps,
69433
69644
  };
69434
69645
  // END
69435
69646