tods-competition-factory 2.0.2 → 2.0.3

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.
@@ -2939,13 +2939,15 @@ declare function updateTeamLineUp({ drawDefinition, participantId, tieFormat, li
2939
2939
  error?: ErrorType;
2940
2940
  };
2941
2941
 
2942
- declare function addAdHocMatchUps({ tournamentRecord, drawDefinition, structureId, matchUps, event }: {
2942
+ type AddAdHocMatchUpsParams = {
2943
+ suppressNotifications?: boolean;
2943
2944
  tournamentRecord: any;
2945
+ structureId?: string;
2944
2946
  drawDefinition: any;
2945
- structureId: any;
2946
- matchUps: any;
2947
+ matchUps: any[];
2947
2948
  event: any;
2948
- }): ResultType;
2949
+ };
2950
+ declare function addAdHocMatchUps(params: AddAdHocMatchUpsParams): ResultType;
2949
2951
 
2950
2952
  type ModifyDrawNameArgs = {
2951
2953
  tournamentRecord: Tournament;
@@ -2974,36 +2976,20 @@ type SetSubOrderArgs = {
2974
2976
  };
2975
2977
  declare function setSubOrder({ tournamentRecord, drawDefinition, drawPosition, structureId, subOrder, event, }: SetSubOrderArgs): ResultType;
2976
2978
 
2977
- /**
2978
- *
2979
- * @param {object} tournamentRecord - passed automatically if tournamentEngine.setState() has been called
2980
- * @param {string} eventId - resolved by tournamentEngine to the event object
2981
- *
2982
- * @param {object} policyDefinitions - seeding policyDefinitions determines the # of seeds for given participantsCount/drawSize
2983
- * @param {object} scaleAttributes -
2984
- * @param {string} scaleName - OPTIONAL - defaults to scaleAttributes.scaleName
2985
- * @param {number} drawSize - OPTIONAL - defaults to calculation based on # of entries
2986
- * @param {string} drawId - OPTIONAL - will use flight.drawEntries or drawDefinition.entries rather than event.entries
2987
- * @param {string} stage - OPTIONAL - filters entries by specified stage
2988
- *
2989
- * @param {boolean} sortDescending - OPTIONAL - defaults to false
2990
- * @param {function} scaleSortMethod - OPTIONAL - user defined sorting method
2991
- *
2992
- * @returns {object} - { success: true } or { error }
2993
- */
2994
- declare function autoSeeding({ tournamentRecord, drawDefinition, policyDefinitions, scaleAttributes, scaleName, drawSize, drawId, event, stage, sortDescending, scaleSortMethod, }: {
2979
+ type AutoSeedingParams = {
2980
+ sortDescending: boolean;
2981
+ stage: StageTypeUnion;
2995
2982
  tournamentRecord: any;
2996
- drawDefinition: any;
2997
2983
  policyDefinitions: any;
2998
2984
  scaleAttributes: any;
2999
- scaleName: any;
3000
- drawSize: any;
3001
- drawId: any;
3002
- event: any;
3003
- stage: any;
3004
- sortDescending: any;
3005
2985
  scaleSortMethod: any;
3006
- }): {
2986
+ drawDefinition: any;
2987
+ scaleName: string;
2988
+ drawSize: number;
2989
+ drawId: string;
2990
+ event: any;
2991
+ };
2992
+ declare function autoSeeding({ tournamentRecord, drawDefinition, policyDefinitions, scaleAttributes, scaleName, drawSize, drawId, event, stage, sortDescending, scaleSortMethod, }: AutoSeedingParams): {
3007
2993
  stageEntries?: Entry[] | undefined;
3008
2994
  seedsCount?: number | undefined;
3009
2995
  entries?: Entry[] | undefined;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.2';
6
+ return '2.0.3';
7
7
  }
8
8
 
9
9
  /******************************************************************************
@@ -26698,19 +26698,20 @@ function removeAdHocRound(_a) {
26698
26698
  return __assign({ deletedMatchUpsCount: deletedMatchUpIds.length, roundRemoved: roundRemoved }, SUCCESS);
26699
26699
  }
26700
26700
 
26701
- function addAdHocMatchUps(_a) {
26702
- var _b;
26703
- var _c, _d, _e, _f, _g, _h, _j;
26704
- var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structureId = _a.structureId, matchUps = _a.matchUps, event = _a.event;
26701
+ function addAdHocMatchUps(params) {
26702
+ var _a;
26703
+ var _b, _c, _d, _e, _f, _g, _h;
26704
+ var suppressNotifications = params.suppressNotifications, tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, matchUps = params.matchUps, event = params.event;
26705
26705
  if (typeof drawDefinition !== 'object')
26706
26706
  return { error: MISSING_DRAW_DEFINITION };
26707
- if (!structureId && ((_c = drawDefinition.structures) === null || _c === void 0 ? void 0 : _c.length) === 1)
26708
- structureId = (_e = (_d = drawDefinition.structures) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.structureId;
26707
+ var structureId = params === null || params === void 0 ? void 0 : params.structureId;
26708
+ if (!structureId && ((_b = drawDefinition.structures) === null || _b === void 0 ? void 0 : _b.length) === 1)
26709
+ structureId = (_d = (_c = drawDefinition.structures) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.structureId;
26709
26710
  if (typeof structureId !== 'string')
26710
26711
  return { error: MISSING_STRUCTURE_ID };
26711
26712
  if (!validMatchUps(matchUps))
26712
26713
  return { error: INVALID_VALUES, info: mustBeAnArray('matchUps') };
26713
- var structure = (_f = drawDefinition.structures) === null || _f === void 0 ? void 0 : _f.find(function (structure) { return structure.structureId === structureId; });
26714
+ var structure = (_e = drawDefinition.structures) === null || _e === void 0 ? void 0 : _e.find(function (structure) { return structure.structureId === structureId; });
26714
26715
  if (!structure)
26715
26716
  return { error: STRUCTURE_NOT_FOUND };
26716
26717
  var existingMatchUps = structure === null || structure === void 0 ? void 0 : structure.matchUps;
@@ -26718,10 +26719,10 @@ function addAdHocMatchUps(_a) {
26718
26719
  if (structure.structures || structureHasRoundPositions || structure.finishingPosition === ROUND_OUTCOME) {
26719
26720
  return { error: INVALID_STRUCTURE };
26720
26721
  }
26721
- var existingMatchUpIds = (_j = (_h = (_g = allTournamentMatchUps({
26722
+ var existingMatchUpIds = (_h = (_g = (_f = allTournamentMatchUps({
26722
26723
  tournamentRecord: tournamentRecord,
26723
26724
  inContext: false,
26724
- })) === null || _g === void 0 ? void 0 : _g.matchUps) === null || _h === void 0 ? void 0 : _h.map(getMatchUpId)) !== null && _j !== void 0 ? _j : [];
26725
+ })) === null || _f === void 0 ? void 0 : _f.matchUps) === null || _g === void 0 ? void 0 : _g.map(getMatchUpId)) !== null && _h !== void 0 ? _h : [];
26725
26726
  var newMatchUpIds = matchUps.map(getMatchUpId);
26726
26727
  if (overlap(existingMatchUpIds, newMatchUpIds)) {
26727
26728
  return {
@@ -26729,7 +26730,7 @@ function addAdHocMatchUps(_a) {
26729
26730
  info: 'One or more matchUpIds already present in tournamentRecord',
26730
26731
  };
26731
26732
  }
26732
- (_b = structure.matchUps).push.apply(_b, __spreadArray([], __read(matchUps), false));
26733
+ (_a = structure.matchUps).push.apply(_a, __spreadArray([], __read(matchUps), false));
26733
26734
  var tieMatchUps = matchUps
26734
26735
  .map(function (_a) {
26735
26736
  var tieMatchUps = _a.tieMatchUps;
@@ -26737,13 +26738,15 @@ function addAdHocMatchUps(_a) {
26737
26738
  })
26738
26739
  .filter(Boolean)
26739
26740
  .flat();
26740
- addMatchUpsNotice({
26741
- tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
26742
- matchUps: __spreadArray(__spreadArray([], __read(tieMatchUps), false), __read(matchUps), false),
26743
- eventId: event === null || event === void 0 ? void 0 : event.eventId,
26744
- drawDefinition: drawDefinition,
26745
- });
26746
- modifyDrawNotice({ drawDefinition: drawDefinition, structureIds: [structureId] });
26741
+ if (!suppressNotifications) {
26742
+ addMatchUpsNotice({
26743
+ tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
26744
+ matchUps: __spreadArray(__spreadArray([], __read(tieMatchUps), false), __read(matchUps), false),
26745
+ eventId: event === null || event === void 0 ? void 0 : event.eventId,
26746
+ drawDefinition: drawDefinition,
26747
+ });
26748
+ modifyDrawNotice({ drawDefinition: drawDefinition, structureIds: [structureId] });
26749
+ }
26747
26750
  return __assign({}, SUCCESS);
26748
26751
  }
26749
26752
 
@@ -26797,6 +26800,36 @@ function setSubOrder(_a) {
26797
26800
  return __assign({}, SUCCESS);
26798
26801
  }
26799
26802
 
26803
+ function generateSeedingScaleItems(_a) {
26804
+ var scaleAttributes = _a.scaleAttributes, scaledEntries = _a.scaledEntries, stageEntries = _a.stageEntries, seedsCount = _a.seedsCount, scaleName = _a.scaleName;
26805
+ if (!scaleAttributes)
26806
+ return { error: MISSING_VALUE, info: 'missing scaleAttributes' };
26807
+ var seededEntries = Object.assign.apply(Object, __spreadArray([{}], __read((scaledEntries || [])
26808
+ .slice(0, seedsCount)
26809
+ .map(function (_a, index) {
26810
+ var _b;
26811
+ var participantId = _a.participantId;
26812
+ return (_b = {}, _b[participantId] = index + 1, _b);
26813
+ })), false));
26814
+ scaleName = scaleName || scaleAttributes.scaleName;
26815
+ var scaleDate = new Date().toISOString();
26816
+ var scaleItemsWithParticipantIds = stageEntries.map(function (_a) {
26817
+ var participantId = _a.participantId;
26818
+ var scaleItem = {
26819
+ scaleValue: seededEntries[participantId],
26820
+ eventType: scaleAttributes.eventType,
26821
+ scaleType: SEEDING$1,
26822
+ scaleName: scaleName,
26823
+ scaleDate: scaleDate,
26824
+ };
26825
+ return {
26826
+ scaleItems: [scaleItem],
26827
+ participantId: participantId,
26828
+ };
26829
+ });
26830
+ return { scaleItemsWithParticipantIds: scaleItemsWithParticipantIds };
26831
+ }
26832
+
26800
26833
  function getEliminationDrawSize(_a) {
26801
26834
  var participantsCount = _a.participantsCount, participantCount = _a.participantCount;
26802
26835
  participantsCount = participantsCount !== null && participantsCount !== void 0 ? participantsCount : participantCount;
@@ -26897,36 +26930,6 @@ function getEntriesAndSeedsCount(_a) {
26897
26930
  return { entries: entries, seedsCount: seedsCount, stageEntries: stageEntries };
26898
26931
  }
26899
26932
 
26900
- function generateSeedingScaleItems(_a) {
26901
- var scaleAttributes = _a.scaleAttributes, scaledEntries = _a.scaledEntries, stageEntries = _a.stageEntries, seedsCount = _a.seedsCount, scaleName = _a.scaleName;
26902
- if (!scaleAttributes)
26903
- return { error: MISSING_VALUE, info: 'missing scaleAttributes' };
26904
- var seededEntries = Object.assign.apply(Object, __spreadArray([{}], __read((scaledEntries || [])
26905
- .slice(0, seedsCount)
26906
- .map(function (_a, index) {
26907
- var _b;
26908
- var participantId = _a.participantId;
26909
- return (_b = {}, _b[participantId] = index + 1, _b);
26910
- })), false));
26911
- scaleName = scaleName || scaleAttributes.scaleName;
26912
- var scaleDate = new Date().toISOString();
26913
- var scaleItemsWithParticipantIds = stageEntries.map(function (_a) {
26914
- var participantId = _a.participantId;
26915
- var scaleItem = {
26916
- scaleValue: seededEntries[participantId],
26917
- eventType: scaleAttributes.eventType,
26918
- scaleType: SEEDING$1,
26919
- scaleName: scaleName,
26920
- scaleDate: scaleDate,
26921
- };
26922
- return {
26923
- scaleItems: [scaleItem],
26924
- participantId: participantId,
26925
- };
26926
- });
26927
- return { scaleItemsWithParticipantIds: scaleItemsWithParticipantIds };
26928
- }
26929
-
26930
26933
  function getParticipantScaleItem(params) {
26931
26934
  var _a;
26932
26935
  var tournamentRecord = params.tournamentRecord, scaleAttributes = params.scaleAttributes, participantId = params.participantId;
@@ -26990,23 +26993,6 @@ function getScaledEntries(_a) {
26990
26993
  }
26991
26994
  }
26992
26995
 
26993
- /**
26994
- *
26995
- * @param {object} tournamentRecord - passed automatically if tournamentEngine.setState() has been called
26996
- * @param {string} eventId - resolved by tournamentEngine to the event object
26997
- *
26998
- * @param {object} policyDefinitions - seeding policyDefinitions determines the # of seeds for given participantsCount/drawSize
26999
- * @param {object} scaleAttributes -
27000
- * @param {string} scaleName - OPTIONAL - defaults to scaleAttributes.scaleName
27001
- * @param {number} drawSize - OPTIONAL - defaults to calculation based on # of entries
27002
- * @param {string} drawId - OPTIONAL - will use flight.drawEntries or drawDefinition.entries rather than event.entries
27003
- * @param {string} stage - OPTIONAL - filters entries by specified stage
27004
- *
27005
- * @param {boolean} sortDescending - OPTIONAL - defaults to false
27006
- * @param {function} scaleSortMethod - OPTIONAL - user defined sorting method
27007
- *
27008
- * @returns {object} - { success: true } or { error }
27009
- */
27010
26996
  function autoSeeding(_a) {
27011
26997
  var _b;
27012
26998
  var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, policyDefinitions = _a.policyDefinitions, scaleAttributes = _a.scaleAttributes, scaleName = _a.scaleName, drawSize = _a.drawSize, drawId = _a.drawId, event = _a.event, stage = _a.stage, sortDescending = _a.sortDescending, scaleSortMethod = _a.scaleSortMethod;
@@ -32579,9 +32565,9 @@ var POLICY_SEEDING_DEFAULT = (_a$b = {},
32579
32565
 
32580
32566
  function generateDrawDefinition(params) {
32581
32567
  var _a, e_1, _b, e_2, _c, e_3, _d, e_4, _e, _f, e_5, _g, e_6, _h, _j;
32582
- var _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34;
32568
+ var _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35;
32583
32569
  var stack = 'generateDrawDefinition';
32584
- var _35 = params.enforceMinimumDrawSize, enforceMinimumDrawSize = _35 === void 0 ? true : _35, _36 = params.considerEventEntries, considerEventEntries = _36 === void 0 ? true : _36, // in the absence of drawSize and drawEntries, look to event.entries
32570
+ var _36 = params.enforceMinimumDrawSize, enforceMinimumDrawSize = _36 === void 0 ? true : _36, _37 = params.considerEventEntries, considerEventEntries = _37 === void 0 ? true : _37, // in the absence of drawSize and drawEntries, look to event.entries
32585
32571
  ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections, ignoreStageSpace = params.ignoreStageSpace, tournamentRecord = params.tournamentRecord, qualifyingOnly = params.qualifyingOnly, tieFormatName = params.tieFormatName, drawEntries = params.drawEntries, placeByes = params.placeByes, event = params.event;
32586
32572
  var isMock = (_k = params.isMock) !== null && _k !== void 0 ? _k : true;
32587
32573
  var idPrefix = params.idPrefix;
@@ -32592,12 +32578,12 @@ function generateDrawDefinition(params) {
32592
32578
  var policyDefinitions = makeDeepCopy((_m = params.policyDefinitions) !== null && _m !== void 0 ? _m : {}, false, true);
32593
32579
  // get participants both for entry validation and for automated placement
32594
32580
  // automated placement requires them to be "inContext" for avoidance policies to work
32595
- var _37 = getParticipants({
32581
+ var _38 = getParticipants({
32596
32582
  withIndividualParticipants: true,
32597
32583
  convertExtensions: true,
32598
32584
  internalUse: true,
32599
32585
  tournamentRecord: tournamentRecord,
32600
- }), participants = _37.participants, participantMap = _37.participantMap;
32586
+ }), participants = _38.participants, participantMap = _38.participantMap;
32601
32587
  var eventEntries = (_p = (_o = event === null || event === void 0 ? void 0 : event.entries) === null || _o === void 0 ? void 0 : _o.filter(function (entry) { return entry.entryStatus && __spreadArray(__spreadArray([], __read(STRUCTURE_SELECTED_STATUSES), false), [QUALIFIER], false).includes(entry.entryStatus); })) !== null && _p !== void 0 ? _p : [];
32602
32588
  // -------------------- BEGIN PARAMETER DERIVATION AND VALIDATION -------------------------
32603
32589
  var consideredEntries = ((qualifyingOnly && []) ||
@@ -32780,8 +32766,8 @@ function generateDrawDefinition(params) {
32780
32766
  }
32781
32767
  else {
32782
32768
  try {
32783
- for (var _38 = __values(Object.keys(policyDefinitions)), _39 = _38.next(); !_39.done; _39 = _38.next()) {
32784
- var key = _39.value;
32769
+ for (var _39 = __values(Object.keys(policyDefinitions)), _40 = _39.next(); !_40.done; _40 = _39.next()) {
32770
+ var key = _40.value;
32785
32771
  if (JSON.stringify(appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[key]) !== JSON.stringify(policyDefinitions[key])) {
32786
32772
  policiesToAttach[key] = policyDefinitions[key];
32787
32773
  }
@@ -32790,7 +32776,7 @@ function generateDrawDefinition(params) {
32790
32776
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
32791
32777
  finally {
32792
32778
  try {
32793
- if (_39 && !_39.done && (_b = _38.return)) _b.call(_38);
32779
+ if (_40 && !_40.done && (_b = _39.return)) _b.call(_39);
32794
32780
  }
32795
32781
  finally { if (e_1) throw e_1.error; }
32796
32782
  }
@@ -32850,7 +32836,7 @@ function generateDrawDefinition(params) {
32850
32836
  var source = _a.source;
32851
32837
  return source.structureId !== existingQualifyingPlaceholderStructureId;
32852
32838
  });
32853
- var _40 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _40.qualifiersCount, qualifyingDrawPositionsCount = _40.qualifyingDrawPositionsCount, qualifyingDetails = _40.qualifyingDetails;
32839
+ var _41 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _41.qualifiersCount, qualifyingDrawPositionsCount = _41.qualifyingDrawPositionsCount, qualifyingDetails = _41.qualifyingDetails;
32854
32840
  if (qualifyingDrawPositionsCount) {
32855
32841
  if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.structures) {
32856
32842
  (_18 = drawDefinition.structures) === null || _18 === void 0 ? void 0 : _18.push.apply(_18, __spreadArray([], __read(qualifyingResult.structures), false));
@@ -32885,11 +32871,11 @@ function generateDrawDefinition(params) {
32885
32871
  if (result.error)
32886
32872
  return result;
32887
32873
  try {
32888
- for (var _41 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
32874
+ for (var _42 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
32889
32875
  var entryStage = _a.entryStage;
32890
32876
  return entryStage === QUALIFYING;
32891
- })), _42 = _41.next(); !_42.done; _42 = _41.next()) {
32892
- var entry = _42.value;
32877
+ })), _43 = _42.next(); !_43.done; _43 = _42.next()) {
32878
+ var entry = _43.value;
32893
32879
  var entryData = __assign(__assign({}, entry), { entryStage: (_21 = entry.entryStage) !== null && _21 !== void 0 ? _21 : MAIN, drawDefinition: drawDefinition });
32894
32880
  // ignore errors (EXITING_PARTICIPANT)
32895
32881
  addDrawEntry(entryData);
@@ -32898,13 +32884,13 @@ function generateDrawDefinition(params) {
32898
32884
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
32899
32885
  finally {
32900
32886
  try {
32901
- if (_42 && !_42.done && (_c = _41.return)) _c.call(_41);
32887
+ if (_43 && !_43.done && (_c = _42.return)) _c.call(_42);
32902
32888
  }
32903
32889
  finally { if (e_2) throw e_2.error; }
32904
32890
  }
32905
32891
  try {
32906
- for (var _43 = __values(qualifyingDetails || []), _44 = _43.next(); !_44.done; _44 = _43.next()) {
32907
- var qualifyingDetail = _44.value;
32892
+ for (var _44 = __values(qualifyingDetails || []), _45 = _44.next(); !_45.done; _45 = _44.next()) {
32893
+ var qualifyingDetail = _45.value;
32908
32894
  var qualifyingRoundNumber = qualifyingDetail.finalQualifyingRoundNumber, qualifyingStructureId = qualifyingDetail.finalQualifyingStructureId, targetEntryRound = qualifyingDetail.roundTarget, finishingPositions = qualifyingDetail.finishingPositions, linkType = qualifyingDetail.linkType;
32909
32895
  var link = mainStructure &&
32910
32896
  ((_22 = generateQualifyingLink({
@@ -32927,7 +32913,7 @@ function generateDrawDefinition(params) {
32927
32913
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
32928
32914
  finally {
32929
32915
  try {
32930
- if (_44 && !_44.done && (_d = _43.return)) _d.call(_43);
32916
+ if (_45 && !_45.done && (_d = _44.return)) _d.call(_44);
32931
32917
  }
32932
32918
  finally { if (e_3) throw e_3.error; }
32933
32919
  }
@@ -32982,7 +32968,7 @@ function generateDrawDefinition(params) {
32982
32968
  var participantIds = entries_2 === null || entries_2 === void 0 ? void 0 : entries_2.map(getParticipantId);
32983
32969
  var matchUpsCount_1 = entries_2 ? Math.floor(entries_2.length / 2) : 0;
32984
32970
  if (params.automated) {
32985
- var _45 = (_27 = params.drawMatic) !== null && _27 !== void 0 ? _27 : {}, restrictEntryStatus = _45.restrictEntryStatus, generateMatchUps = _45.generateMatchUps, structureId_1 = _45.structureId, matchUpIds = _45.matchUpIds, scaleName = _45.scaleName;
32971
+ var _46 = (_27 = params.drawMatic) !== null && _27 !== void 0 ? _27 : {}, restrictEntryStatus = _46.restrictEntryStatus, generateMatchUps = _46.generateMatchUps, structureId_1 = _46.structureId, matchUpIds = _46.matchUpIds, scaleName = _46.scaleName;
32986
32972
  var result = drawMatic({
32987
32973
  eventType: (_29 = (_28 = params.drawMatic) === null || _28 === void 0 ? void 0 : _28.eventType) !== null && _29 !== void 0 ? _29 : matchUpType,
32988
32974
  generateMatchUps: generateMatchUps !== null && generateMatchUps !== void 0 ? generateMatchUps : true,
@@ -32998,13 +32984,15 @@ function generateDrawDefinition(params) {
32998
32984
  isMock: isMock,
32999
32985
  event: event,
33000
32986
  });
33001
- addAdHocMatchUps({
33002
- matchUps: result.matchUps,
33003
- tournamentRecord: tournamentRecord,
33004
- drawDefinition: drawDefinition,
33005
- structureId: structureId_1,
33006
- event: event,
33007
- });
32987
+ ((_30 = result === null || result === void 0 ? void 0 : result.matchUps) === null || _30 === void 0 ? void 0 : _30.length) &&
32988
+ addAdHocMatchUps({
32989
+ suppressNotifications: true,
32990
+ matchUps: result.matchUps,
32991
+ tournamentRecord: tournamentRecord,
32992
+ drawDefinition: drawDefinition,
32993
+ structureId: structureId_1,
32994
+ event: event,
32995
+ });
33008
32996
  }
33009
32997
  else {
33010
32998
  generateRange(1, params.roundsCount + 1).forEach(function () {
@@ -33016,13 +33004,15 @@ function generateDrawDefinition(params) {
33016
33004
  isMock: isMock,
33017
33005
  event: event,
33018
33006
  }).matchUps;
33019
- addAdHocMatchUps({
33020
- tournamentRecord: tournamentRecord,
33021
- drawDefinition: drawDefinition,
33022
- structureId: structureId,
33023
- matchUps: matchUps,
33024
- event: event,
33025
- });
33007
+ (matchUps === null || matchUps === void 0 ? void 0 : matchUps.length) &&
33008
+ addAdHocMatchUps({
33009
+ suppressNotifications: true,
33010
+ tournamentRecord: tournamentRecord,
33011
+ drawDefinition: drawDefinition,
33012
+ structureId: structureId,
33013
+ matchUps: matchUps,
33014
+ event: event,
33015
+ });
33026
33016
  });
33027
33017
  }
33028
33018
  }
@@ -33036,8 +33026,8 @@ function generateDrawDefinition(params) {
33036
33026
  var roundTarget = 1;
33037
33027
  params.qualifyingProfiles.sort(roundTargetSort);
33038
33028
  try {
33039
- for (var _46 = __values(params.qualifyingProfiles), _47 = _46.next(); !_47.done; _47 = _46.next()) {
33040
- var roundTargetProfile = _47.value;
33029
+ for (var _47 = __values(params.qualifyingProfiles), _48 = _47.next(); !_48.done; _48 = _47.next()) {
33030
+ var roundTargetProfile = _48.value;
33041
33031
  if (!Array.isArray(roundTargetProfile.structureProfiles))
33042
33032
  return decorateResult({
33043
33033
  info: mustBeAnArray('structureProfiles'),
@@ -33045,13 +33035,13 @@ function generateDrawDefinition(params) {
33045
33035
  stack: stack,
33046
33036
  });
33047
33037
  roundTarget = roundTargetProfile.roundTarget || roundTarget;
33048
- var sortedStructureProfiles = ((_30 = roundTargetProfile.structureProfiles) === null || _30 === void 0 ? void 0 : _30.sort(sequenceSort)) || [];
33038
+ var sortedStructureProfiles = ((_31 = roundTargetProfile.structureProfiles) === null || _31 === void 0 ? void 0 : _31.sort(sequenceSort)) || [];
33049
33039
  var sequence = 1;
33050
33040
  try {
33051
33041
  for (var sortedStructureProfiles_1 = (e_6 = void 0, __values(sortedStructureProfiles)), sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next(); !sortedStructureProfiles_1_1.done; sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next()) {
33052
33042
  var structureProfile = sortedStructureProfiles_1_1.value;
33053
- var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _48 = structureProfile.seedsCount, seedsCount = _48 === void 0 ? 0 : _48, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
33054
- var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { seedingProfile: (_31 = structureProfile.seedingProfile) !== null && _31 !== void 0 ? _31 : seedingProfile, stageSequence: sequence, qualifyingRoundNumber: qualifyingRoundNumber, preparedStructureIds: preparedStructureIds, qualifyingPositions: qualifyingPositions, seededParticipants: seededParticipants, stage: QUALIFYING, seedingScaleName: seedingScaleName, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, qualifyingOnly: qualifyingOnly, seedByRanking: seedByRanking, participants: participants, roundTarget: roundTarget, seedsCount: seedsCount, placeByes: placeByes_1, drawSize: drawSize_1, entries: entries }));
33043
+ var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _49 = structureProfile.seedsCount, seedsCount = _49 === void 0 ? 0 : _49, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
33044
+ var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { seedingProfile: (_32 = structureProfile.seedingProfile) !== null && _32 !== void 0 ? _32 : seedingProfile, stageSequence: sequence, qualifyingRoundNumber: qualifyingRoundNumber, preparedStructureIds: preparedStructureIds, qualifyingPositions: qualifyingPositions, seededParticipants: seededParticipants, stage: QUALIFYING, seedingScaleName: seedingScaleName, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, qualifyingOnly: qualifyingOnly, seedByRanking: seedByRanking, participants: participants, roundTarget: roundTarget, seedsCount: seedsCount, placeByes: placeByes_1, drawSize: drawSize_1, entries: entries }));
33055
33045
  if (qualifyingStageResult.error) {
33056
33046
  return qualifyingStageResult;
33057
33047
  }
@@ -33059,9 +33049,9 @@ function generateDrawDefinition(params) {
33059
33049
  preparedStructureIds.push(qualifyingStageResult.structureId);
33060
33050
  }
33061
33051
  sequence += 1;
33062
- if ((_32 = qualifyingStageResult.conflicts) === null || _32 === void 0 ? void 0 : _32.length)
33052
+ if ((_33 = qualifyingStageResult.conflicts) === null || _33 === void 0 ? void 0 : _33.length)
33063
33053
  qualifyingConflicts.push.apply(qualifyingConflicts, __spreadArray([], __read(qualifyingStageResult.conflicts), false));
33064
- if ((_33 = qualifyingStageResult.positioningReport) === null || _33 === void 0 ? void 0 : _33.length)
33054
+ if ((_34 = qualifyingStageResult.positioningReport) === null || _34 === void 0 ? void 0 : _34.length)
33065
33055
  positioningReports.push((_j = {},
33066
33056
  _j[QUALIFYING] = qualifyingStageResult.positioningReport,
33067
33057
  _j));
@@ -33080,7 +33070,7 @@ function generateDrawDefinition(params) {
33080
33070
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
33081
33071
  finally {
33082
33072
  try {
33083
- if (_47 && !_47.done && (_g = _46.return)) _g.call(_46);
33073
+ if (_48 && !_48.done && (_g = _47.return)) _g.call(_47);
33084
33074
  }
33085
33075
  finally { if (e_5) throw e_5.error; }
33086
33076
  }
@@ -33103,7 +33093,7 @@ function generateDrawDefinition(params) {
33103
33093
  drawDefinition.links = [];
33104
33094
  drawDefinition.links.push(link);
33105
33095
  }
33106
- drawDefinition.drawName = (_34 = params.drawName) !== null && _34 !== void 0 ? _34 : (drawType && constantToString(drawType));
33096
+ drawDefinition.drawName = (_35 = params.drawName) !== null && _35 !== void 0 ? _35 : (drawType && constantToString(drawType));
33107
33097
  if (typeof voluntaryConsolation === 'object' && drawSize >= 4) {
33108
33098
  addVoluntaryConsolationStructure(__assign(__assign({}, voluntaryConsolation), { drawDefinition: drawDefinition, matchUpType: matchUpType }));
33109
33099
  }