tods-competition-factory 1.8.0 → 1.8.1

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.1';
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 }))
@@ -37475,8 +37476,7 @@ function scheduleProfileRounds(_a) {
37475
37476
  clearScheduledMatchUps({ tournamentRecords: tournamentRecords, scheduledDates: scheduledDates });
37476
37477
  }
37477
37478
  var courts = getVenuesAndCourts({
37478
- dates: scheduleDates,
37479
- ignoreDisabled: true,
37479
+ ignoreDisabled: false,
37480
37480
  tournamentRecords: tournamentRecords,
37481
37481
  }).courts;
37482
37482
  var matchUps = allCompetitionMatchUps({
@@ -39788,6 +39788,8 @@ var POLICY_MATCHUP_ACTIONS_DEFAULT = (_a$2 = {},
39788
39788
  processCodes: {
39789
39789
  substitution: ['RANKING.IGNORE', 'RATING.IGNORE'],
39790
39790
  },
39791
+ substituteAfterCompleted: false,
39792
+ substituteWithoutScore: false,
39791
39793
  },
39792
39794
  _a$2);
39793
39795
 
@@ -53261,9 +53263,14 @@ function validDefinitionKeys(definition) {
53261
53263
  return keyValidation.reduce(function (p, key) { return (!definitionKeys.includes(key) ? false : p); }, true);
53262
53264
  }
53263
53265
  function newDrawDefinition(_a) {
53264
- var _b = _a.drawId, drawId = _b === void 0 ? UUID() : _b, matchUpType = _a.matchUpType, drawType = _a.drawType;
53266
+ var _b = _a.drawId, drawId = _b === void 0 ? UUID() : _b, processCodes = _a.processCodes, matchUpType = _a.matchUpType, drawType = _a.drawType;
53265
53267
  var drawDefinition = definitionTemplate();
53266
- return Object.assign(drawDefinition, { drawId: drawId, drawType: drawType, matchUpType: matchUpType });
53268
+ return Object.assign(drawDefinition, {
53269
+ processCodes: processCodes,
53270
+ matchUpType: matchUpType,
53271
+ drawType: drawType,
53272
+ drawId: drawId,
53273
+ });
53267
53274
  }
53268
53275
 
53269
53276
  var drawDefinition$1;
@@ -63080,7 +63087,11 @@ function generateDrawDefinition(params) {
63080
63087
  // Begin construction of drawDefinition
63081
63088
  if (existingDrawDefinition && drawType !== existingDrawDefinition.drawType)
63082
63089
  existingDrawDefinition.drawType = drawType;
63083
- var drawDefinition = existingDrawDefinition !== null && existingDrawDefinition !== void 0 ? existingDrawDefinition : newDrawDefinition({ drawType: drawType, drawId: params.drawId });
63090
+ var drawDefinition = existingDrawDefinition !== null && existingDrawDefinition !== void 0 ? existingDrawDefinition : newDrawDefinition({
63091
+ drawType: drawType,
63092
+ drawId: params.drawId,
63093
+ processCodes: params.processCodes,
63094
+ });
63084
63095
  // if there is a defined matchUpFormat/tieFormat only attach to drawDefinition...
63085
63096
  // ...when there is not an equivalent definition on the parent event
63086
63097
  if (matchUpFormat || tieFormat) {
@@ -63629,10 +63640,24 @@ function enableTieAutoCalc(params) {
63629
63640
  function modifyEvent(_a) {
63630
63641
  var _b, _c, _d, _e, _f;
63631
63642
  var tournamentRecord = _a.tournamentRecord, eventUpdates = _a.eventUpdates, eventId = _a.eventId, event = _a.event;
63643
+ var stack = 'modifyEvent';
63632
63644
  if (!tournamentRecord)
63633
- return { error: MISSING_TOURNAMENT_RECORD };
63634
- if (!isString(eventId) || !isObject(eventUpdates))
63635
- return { error: INVALID_VALUES };
63645
+ return decorateResult({
63646
+ result: { error: MISSING_TOURNAMENT_RECORD },
63647
+ stack: stack,
63648
+ });
63649
+ if (!isString(eventId))
63650
+ return decorateResult({
63651
+ result: { error: MISSING_EVENT },
63652
+ context: { eventId: eventId },
63653
+ stack: stack,
63654
+ });
63655
+ if (!isObject(eventUpdates))
63656
+ return decorateResult({
63657
+ result: { error: INVALID_VALUES },
63658
+ context: { eventUpdates: eventUpdates },
63659
+ stack: stack,
63660
+ });
63636
63661
  var enteredParticipantIds = (_c = (_b = event === null || event === void 0 ? void 0 : event.entries) === null || _b === void 0 ? void 0 : _b.filter(function (_a) {
63637
63662
  var entryStatus = _a.entryStatus;
63638
63663
  var status = entryStatus;
@@ -63666,8 +63691,9 @@ function modifyEvent(_a) {
63666
63691
  enteredParticipantGenders[0] === eventUpdates.gender);
63667
63692
  if (eventUpdates.gender && !validGender)
63668
63693
  return decorateResult({
63669
- context: { gender: eventUpdates.gender },
63694
+ context: { gender: eventUpdates.gender, validGender: validGender },
63670
63695
  result: { error: INVALID_VALUES },
63696
+ stack: stack,
63671
63697
  });
63672
63698
  var validEventTypes = (enteredParticipantTypes.includes(TEAM$1) && [TEAM$1]) ||
63673
63699
  (enteredParticipantTypes.includes(INDIVIDUAL) && [SINGLES]) ||
@@ -63679,8 +63705,9 @@ function modifyEvent(_a) {
63679
63705
  var validEventType = validEventTypes.includes((_f = eventUpdates.eventType) !== null && _f !== void 0 ? _f : '');
63680
63706
  if (eventUpdates.eventType && !validEventType)
63681
63707
  return decorateResult({
63682
- context: { participantType: eventUpdates.eventType },
63708
+ context: { participantType: eventUpdates.eventType, validEventType: validEventType },
63683
63709
  result: { error: INVALID_VALUES },
63710
+ stack: stack,
63684
63711
  });
63685
63712
  if (eventUpdates.eventType)
63686
63713
  event.eventType = eventUpdates.eventType;
@@ -68065,7 +68092,7 @@ function generateEventWithFlights(params) {
68065
68092
  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
68093
  var gender = eventProfile.gender;
68067
68094
  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;
68095
+ 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
68096
  var eventId = eventProfile.eventId || UUID();
68070
68097
  var tieFormat = eventProfile.tieFormat ||
68071
68098
  (eventType === TEAM$1
@@ -68116,7 +68143,7 @@ function generateEventWithFlights(params) {
68116
68143
  eventAttributes = {};
68117
68144
  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
68145
  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 });
68146
+ 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
68147
  // attach any valid eventExtensions
68121
68148
  if ((eventExtensions === null || eventExtensions === void 0 ? void 0 : eventExtensions.length) && Array.isArray(eventExtensions)) {
68122
68149
  var extensions = eventExtensions.filter(isValidExtension);