tods-competition-factory 0.294.0 → 0.295.0

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.
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
249
249
  };
250
250
 
251
251
  function factoryVersion() {
252
- return '0.294.0';
252
+ return '0.295.0';
253
253
  }
254
254
 
255
255
  function decorateResult({
@@ -2301,7 +2301,7 @@ function validateTieFormat({
2301
2301
  const errors = [];
2302
2302
 
2303
2303
  if (typeof tieFormat !== 'object') {
2304
- errors.push('tieformat must be an object');
2304
+ errors.push('tieFormat must be an object');
2305
2305
  return decorateResult({
2306
2306
  result: {
2307
2307
  error: INVALID_TIE_FORMAT,
@@ -2371,12 +2371,12 @@ function validateTieFormat({
2371
2371
  errors.push('Either non-zero valueGoal, or { aggregateValue: true } must be specified in winCriteria');
2372
2372
  return decorateResult({
2373
2373
  result: {
2374
- error: INVALID_TIE_FORMAT,
2375
- stack,
2376
2374
  context: {
2377
2375
  tieFormat,
2378
2376
  errors
2379
- }
2377
+ },
2378
+ error: INVALID_TIE_FORMAT,
2379
+ stack
2380
2380
  }
2381
2381
  });
2382
2382
  }
@@ -19006,6 +19006,10 @@ function includesMatchUpStatuses({
19006
19006
  };
19007
19007
  }
19008
19008
 
19009
+ function copyTieFormat(tieFormat) {
19010
+ return makeDeepCopy(tieFormat, false, true);
19011
+ }
19012
+
19009
19013
  function addNotes({
19010
19014
  element,
19011
19015
  notes
@@ -20203,7 +20207,7 @@ function updateTieMatchUpScore({
20203
20207
  structure
20204
20208
  } = result;
20205
20209
  const tieFormat = matchUp.tieFormat || (structure === null || structure === void 0 ? void 0 : structure.tieFormat) || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.tieFormat) || (event === null || event === void 0 ? void 0 : event.tieFormat) || undefined;
20206
- matchUp.tieFormat = tieFormat;
20210
+ matchUp.tieFormat = copyTieFormat(tieFormat);
20207
20211
  const {
20208
20212
  winningSide,
20209
20213
  set,
@@ -39975,7 +39979,15 @@ function generateVoluntaryConsolation$1(params = {}) {
39975
39979
  tieFormat,
39976
39980
  matchUpType
39977
39981
  } = params;
39978
- tieFormat = tieFormat || drawDefinition.tieFormat || undefined;
39982
+
39983
+ if (tieFormat) {
39984
+ const result = validateTieFormat({
39985
+ tieFormat
39986
+ });
39987
+ if (result.error) return result;
39988
+ }
39989
+
39990
+ tieFormat = copyTieFormat(tieFormat || drawDefinition.tieFormat || undefined);
39979
39991
  matchUpType = matchUpType || drawDefinition.matchUpType || SINGLES$1;
39980
39992
  const {
39981
39993
  structures: stageStructures
@@ -41421,7 +41433,15 @@ function generateDrawTypeAndModifyDrawDefinition$1(params = {}) {
41421
41433
  tieFormat,
41422
41434
  matchUpType
41423
41435
  } = params;
41424
- tieFormat = tieFormat || drawDefinition.tieFormat || undefined;
41436
+
41437
+ if (tieFormat) {
41438
+ const result = validateTieFormat({
41439
+ tieFormat
41440
+ });
41441
+ if (result.error) return result;
41442
+ }
41443
+
41444
+ tieFormat = copyTieFormat(tieFormat || drawDefinition.tieFormat || undefined);
41425
41445
  matchUpType = matchUpType || drawDefinition.matchUpType || SINGLES$1;
41426
41446
  params.tieFormat = tieFormat;
41427
41447
  params.matchUpType = matchUpType;
@@ -47284,10 +47304,6 @@ function drawEngineAsync(test) {
47284
47304
  }
47285
47305
  }
47286
47306
 
47287
- function copyTieFormat(tieFormat) {
47288
- return makeDeepCopy(tieFormat, false, true);
47289
- }
47290
-
47291
47307
  function getOrderedTieFormat({
47292
47308
  tieFormat,
47293
47309
  orderMap
@@ -47683,10 +47699,10 @@ function removeCollectionDefinition({
47683
47699
  aggregateValue,
47684
47700
  valueGoal
47685
47701
  } = calculateWinCriteria(tieFormat);
47686
- tieFormat.winCriteria = {
47702
+ tieFormat.winCriteria = definedAttributes({
47687
47703
  aggregateValue,
47688
47704
  valueGoal
47689
- }; // if valueGoal has changed, force renaming of the tieFormat
47705
+ }); // if valueGoal has changed, force renaming of the tieFormat
47690
47706
 
47691
47707
  const originalValueGoal = existingTieFormat.winCriteria.valueGoal;
47692
47708
 
@@ -47876,6 +47892,7 @@ function updateTieFormat({
47876
47892
  event
47877
47893
  }) {
47878
47894
  const stack = 'updateTieFormat';
47895
+ const tieFormatCopy = copyTieFormat(tieFormat);
47879
47896
  const collectionMap = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions.reduce((instanceMap, def) => {
47880
47897
  instanceMap[def.collectionId] = (instanceMap[def.collectionId] || 0) + def.matchUpCount;
47881
47898
  return instanceMap;
@@ -47883,7 +47900,7 @@ function updateTieFormat({
47883
47900
 
47884
47901
  if (event && eventId) {
47885
47902
  if (event.tieFormat) {
47886
- event.tieFormat = copyTieFormat(tieFormat);
47903
+ event.tieFormat = tieFormatCopy;
47887
47904
  } else {
47888
47905
  // ensure that all matchUps in the event contain tieMatchUps referenced by tieFormat
47889
47906
  const {
@@ -47899,7 +47916,7 @@ function updateTieFormat({
47899
47916
  }) => collectionId));
47900
47917
 
47901
47918
  if (mapsCheck(collectionMap, matchUpMap)) {
47902
- event.tieFormat = copyTieFormat(tieFormat);
47919
+ event.tieFormat = tieFormatCopy;
47903
47920
  } else {
47904
47921
  return decorateResult({
47905
47922
  context: {
@@ -47916,7 +47933,7 @@ function updateTieFormat({
47916
47933
  }
47917
47934
  } else if (matchUp) {
47918
47935
  if (matchUp.tieFormat) {
47919
- matchUp.tieFormat = copyTieFormat(tieFormat);
47936
+ matchUp.tieFormat = tieFormatCopy;
47920
47937
  } else {
47921
47938
  // ensure that all tieMatchUps are referenced by tieFormat
47922
47939
  const matchUpMap = instanceCount(matchUp.tieMatchUps.map(({
@@ -47924,7 +47941,7 @@ function updateTieFormat({
47924
47941
  }) => collectionId));
47925
47942
 
47926
47943
  if (mapsCheck(collectionMap, matchUpMap)) {
47927
- matchUp.tieFormat = copyTieFormat(tieFormat);
47944
+ matchUp.tieFormat = tieFormatCopy;
47928
47945
  } else {
47929
47946
  return decorateResult({
47930
47947
  context: {
@@ -47948,7 +47965,7 @@ function updateTieFormat({
47948
47965
  });
47949
47966
  } else if (structure) {
47950
47967
  if (structure.tieFormat) {
47951
- structure.tieFormat = copyTieFormat(tieFormat);
47968
+ structure.tieFormat = tieFormatCopy;
47952
47969
  } else {
47953
47970
  // ensure that all matchUps in the structure contain tieMatchUps referenced by tieFormat
47954
47971
  const {
@@ -47964,7 +47981,7 @@ function updateTieFormat({
47964
47981
  }) => collectionId));
47965
47982
 
47966
47983
  if (mapsCheck(collectionMap, matchUpMap)) {
47967
- structure.tieFormat = copyTieFormat(tieFormat);
47984
+ structure.tieFormat = tieFormatCopy;
47968
47985
  } else {
47969
47986
  return decorateResult({
47970
47987
  context: {
@@ -47995,7 +48012,7 @@ function updateTieFormat({
47995
48012
  });
47996
48013
  } else if (drawDefinition) {
47997
48014
  if (drawDefinition.tieFormat) {
47998
- drawDefinition.tieFormat = copyTieFormat(tieFormat);
48015
+ drawDefinition.tieFormat = tieFormatCopy;
47999
48016
  } else {
48000
48017
  // ensure that all matchUps in the draw contain tieMatchUps referenced by tieFormat
48001
48018
  const {
@@ -48011,7 +48028,7 @@ function updateTieFormat({
48011
48028
  }) => collectionId));
48012
48029
 
48013
48030
  if (mapsCheck(collectionMap, matchUpMap)) {
48014
- drawDefinition.tieFormat = copyTieFormat(tieFormat);
48031
+ drawDefinition.tieFormat = tieFormatCopy;
48015
48032
  }
48016
48033
  }
48017
48034
 
@@ -48174,10 +48191,10 @@ function modifyCollectionDefinition({
48174
48191
  aggregateValue,
48175
48192
  valueGoal
48176
48193
  } = calculateWinCriteria(tieFormat);
48177
- tieFormat.winCriteria = {
48194
+ tieFormat.winCriteria = definedAttributes({
48178
48195
  aggregateValue,
48179
48196
  valueGoal
48180
- }; // if valueGoal has changed, force renaming of the tieFormat
48197
+ }); // if valueGoal has changed, force renaming of the tieFormat
48181
48198
 
48182
48199
  const originalValueGoal = existingTieFormat.winCriteria.valueGoal;
48183
48200
 
@@ -48230,8 +48247,6 @@ function addCollectionDefinition({
48230
48247
  uuids,
48231
48248
  event
48232
48249
  }) {
48233
- var _matchUp;
48234
-
48235
48250
  const {
48236
48251
  valid,
48237
48252
  errors
@@ -48254,7 +48269,7 @@ function addCollectionDefinition({
48254
48269
  structure
48255
48270
  } = result;
48256
48271
  matchUp = matchUp || result.matchUp;
48257
- const existingTieFormat = result.tieFormat || ((_matchUp = matchUp) === null || _matchUp === void 0 ? void 0 : _matchUp.tieFormat);
48272
+ const existingTieFormat = result.tieFormat || matchUp.tieFormat;
48258
48273
  const tieFormat = copyTieFormat(existingTieFormat);
48259
48274
  result = validateTieFormat({
48260
48275
  tieFormat
@@ -48281,10 +48296,10 @@ function addCollectionDefinition({
48281
48296
  aggregateValue,
48282
48297
  valueGoal
48283
48298
  } = calculateWinCriteria(tieFormat);
48284
- tieFormat.winCriteria = {
48299
+ tieFormat.winCriteria = definedAttributes({
48285
48300
  aggregateValue,
48286
48301
  valueGoal
48287
- }; // if valueGoal has changed, force renaming of the tieFormat
48302
+ }); // if valueGoal has changed, force renaming of the tieFormat
48288
48303
 
48289
48304
  const originalValueGoal = existingTieFormat.winCriteria.valueGoal;
48290
48305
 
@@ -48646,10 +48661,10 @@ function collectionGroupUpdate({
48646
48661
  aggregateValue,
48647
48662
  valueGoal
48648
48663
  } = calculateWinCriteria(tieFormat);
48649
- tieFormat.winCriteria = {
48664
+ tieFormat.winCriteria = definedAttributes({
48650
48665
  aggregateValue,
48651
48666
  valueGoal
48652
- }; // if valueGoal has changed, force renaming of the tieFormat
48667
+ }); // if valueGoal has changed, force renaming of the tieFormat
48653
48668
 
48654
48669
  if (originalValueGoal && originalValueGoal !== valueGoal) {
48655
48670
  if (tieFormatName) {
@@ -48678,6 +48693,10 @@ function collectionGroupUpdate({
48678
48693
  event
48679
48694
  });
48680
48695
  const prunedTieFormat = definedAttributes(tieFormat);
48696
+ const result = validateTieFormat({
48697
+ tieFormat: prunedTieFormat
48698
+ });
48699
+ if (result.error) return result;
48681
48700
 
48682
48701
  if (eventId) {
48683
48702
  event.tieFormat = prunedTieFormat; // NOTE: there is not a modifyEventNotice