tods-competition-factory 0.78.0 → 0.82.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.
- package/dist/tods-competition-factory.development.cjs.js +89 -55
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/dist/tods-competition-factory.production.esm.min.js +1 -1
- package/dist/tods-competition-factory.production.esm.min.js.map +1 -1
- package/package.json +8 -8
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.82.0';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -11694,12 +11694,12 @@ function getAllStructureMatchUps({
|
|
|
11694
11694
|
matchUp,
|
|
11695
11695
|
event
|
|
11696
11696
|
}) {
|
|
11697
|
-
var _roundNamingProfile$r, _roundNamingProfile$r2, _roundProfile$roundNu, _roundProfile$roundNu2, _roundProfile$roundNu3;
|
|
11697
|
+
var _roundNamingProfile$r, _roundNamingProfile$r2, _roundProfile$roundNu, _roundProfile$roundNu2, _roundProfile$roundNu3, _matchUp$score;
|
|
11698
11698
|
|
|
11699
11699
|
const tieFormat = matchUp.tieFormat || structure.tieFormat || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.tieFormat) || (event === null || event === void 0 ? void 0 : event.tieFormat) || undefined;
|
|
11700
11700
|
const collectionDefinitions = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions;
|
|
11701
11701
|
const collectionDefinition = matchUp.collectionId && (collectionDefinitions === null || collectionDefinitions === void 0 ? void 0 : collectionDefinitions.find(definition => definition.collectionId === matchUp.collectionId));
|
|
11702
|
-
const matchUpFormat = matchUp.
|
|
11702
|
+
const matchUpFormat = matchUp.collectionId ? collectionDefinition && collectionDefinition.matchUpFormat : matchUp.matchUpFormat || structure.matchUpFormat || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpFormat) || (event === null || event === void 0 ? void 0 : event.matchUpFormat);
|
|
11703
11703
|
const matchUpType = matchUp.matchUpType || (collectionDefinition === null || collectionDefinition === void 0 ? void 0 : collectionDefinition.matchUpType) || structure.matchUpType || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpType) || (event === null || event === void 0 ? void 0 : event.eventType) !== TEAM$2 && (event === null || event === void 0 ? void 0 : event.eventType);
|
|
11704
11704
|
const matchUpStatus = isCollectionBye ? BYE : matchUp.matchUpStatus;
|
|
11705
11705
|
const {
|
|
@@ -11768,6 +11768,29 @@ function getAllStructureMatchUps({
|
|
|
11768
11768
|
stage
|
|
11769
11769
|
}), makeDeepCopy(onlyDefined(matchUp), true, true));
|
|
11770
11770
|
|
|
11771
|
+
if (matchUpFormat && (_matchUp$score = matchUp.score) !== null && _matchUp$score !== void 0 && _matchUp$score.scoreStringSide1) {
|
|
11772
|
+
const parsedFormat = parse(matchUpFormat);
|
|
11773
|
+
const {
|
|
11774
|
+
bestOf,
|
|
11775
|
+
finalSetFormat,
|
|
11776
|
+
setFormat
|
|
11777
|
+
} = parsedFormat || {};
|
|
11778
|
+
|
|
11779
|
+
if (finalSetFormat !== null && finalSetFormat !== void 0 && finalSetFormat.tiebreakSet || setFormat !== null && setFormat !== void 0 && setFormat.tiebreakSet || setFormat !== null && setFormat !== void 0 && setFormat.timed) {
|
|
11780
|
+
matchUpWithContext.score.sets = matchUpWithContext.score.sets.sort((a, b) => a.setNumber - b.setNumber).map((set, i) => {
|
|
11781
|
+
const setNumber = i + 1;
|
|
11782
|
+
|
|
11783
|
+
if (setNumber === bestOf) {
|
|
11784
|
+
if (finalSetFormat !== null && finalSetFormat !== void 0 && finalSetFormat.tiebreakSet || finalSetFormat !== null && finalSetFormat !== void 0 && finalSetFormat.timed) set.tiebreakSet = true;
|
|
11785
|
+
} else {
|
|
11786
|
+
if (setFormat !== null && setFormat !== void 0 && setFormat.tiebreakSet || setFormat !== null && setFormat !== void 0 && setFormat.timed) set.tiebreakSet = true;
|
|
11787
|
+
}
|
|
11788
|
+
|
|
11789
|
+
return set;
|
|
11790
|
+
});
|
|
11791
|
+
}
|
|
11792
|
+
}
|
|
11793
|
+
|
|
11771
11794
|
if (Array.isArray(drawPositions)) {
|
|
11772
11795
|
const {
|
|
11773
11796
|
orderedDrawPositions,
|
|
@@ -15670,10 +15693,10 @@ function getMatchUpDependencies({
|
|
|
15670
15693
|
const {
|
|
15671
15694
|
drawDefinition
|
|
15672
15695
|
} = findEvent({
|
|
15673
|
-
tournamentRecord: tournamentRecords[hasTournamentId.tournamentId],
|
|
15696
|
+
tournamentRecord: tournamentRecords[hasTournamentId === null || hasTournamentId === void 0 ? void 0 : hasTournamentId.tournamentId],
|
|
15674
15697
|
drawId
|
|
15675
15698
|
});
|
|
15676
|
-
addGoesTo({
|
|
15699
|
+
if (drawDefinition) addGoesTo({
|
|
15677
15700
|
drawDefinition
|
|
15678
15701
|
});
|
|
15679
15702
|
}
|
|
@@ -22133,8 +22156,8 @@ function addParticipant$1({
|
|
|
22133
22156
|
}
|
|
22134
22157
|
|
|
22135
22158
|
const existingPairParticipants = tournamentParticipants.filter(participant => participant.participantType === PAIR$1).map(participant => ({
|
|
22136
|
-
participant,
|
|
22137
|
-
|
|
22159
|
+
individualParticipantIds: participant.individualParticipantIds,
|
|
22160
|
+
participant
|
|
22138
22161
|
})); // determine whether a PAIR participant already exists
|
|
22139
22162
|
|
|
22140
22163
|
const existingPairParticipant = participant.participantType === PAIR$1 && existingPairParticipants.find(existingPairParticipant => intersection(existingPairParticipant.individualParticipantIds, participant.individualParticipantIds).length === 2);
|
|
@@ -22171,8 +22194,8 @@ function addParticipant$1({
|
|
|
22171
22194
|
} else if ([TEAM$1, GROUP].includes(participantType)) {
|
|
22172
22195
|
if (!individualParticipantIds) participant.individualParticipantIds = [];
|
|
22173
22196
|
|
|
22174
|
-
if (individualParticipantIds.length) {
|
|
22175
|
-
for (const individualParticipantId of individualParticipantIds) {
|
|
22197
|
+
if (participant.individualParticipantIds.length) {
|
|
22198
|
+
for (const individualParticipantId of participant.individualParticipantIds) {
|
|
22176
22199
|
if (typeof individualParticipantId !== 'string') {
|
|
22177
22200
|
return {
|
|
22178
22201
|
error: INVALID_VALUES,
|
|
@@ -25894,7 +25917,7 @@ function modifyPersonRequests({
|
|
|
25894
25917
|
|
|
25895
25918
|
/**
|
|
25896
25919
|
*
|
|
25897
|
-
* @param {string[]} scheduleAttributes - attributes by which it is determined that a matchUp
|
|
25920
|
+
* @param {string[]} scheduleAttributes - attributes by which it is determined that a matchUp has a schedule
|
|
25898
25921
|
* @param {boolean} ignoreMatchUpStatuses - array of matchUpStatuses to ignore; defaults to completed
|
|
25899
25922
|
* @param {object} tournamentRecord - provided automatically by tournamentEngine
|
|
25900
25923
|
* @param {string[]} scheduleDates - optional - array of schedule dates to be cleared; default is to clear all dates
|
|
@@ -25921,27 +25944,32 @@ function clearScheduledMatchUps$1({
|
|
|
25921
25944
|
|
|
25922
25945
|
if (venueIds.length) scheduleAttributes.push('venueId');
|
|
25923
25946
|
const {
|
|
25924
|
-
matchUps
|
|
25947
|
+
matchUps: inContextMatchUps
|
|
25925
25948
|
} = allTournamentMatchUps({
|
|
25926
25949
|
matchUpFilters: {
|
|
25927
25950
|
scheduledDates
|
|
25928
25951
|
},
|
|
25929
25952
|
tournamentRecord
|
|
25930
25953
|
});
|
|
25931
|
-
const relevantMatchUpIds =
|
|
25954
|
+
const relevantMatchUpIds = inContextMatchUps.filter(matchUp => !ignoreMatchUpStatuses.includes(matchUp.matchUpStatus) && hasSchedule({
|
|
25932
25955
|
schedule: matchUp.schedule,
|
|
25933
25956
|
scheduleAttributes
|
|
25934
25957
|
}) && (!(venueIds !== null && venueIds !== void 0 && venueIds.length) || venueIds.includes(matchUp.schedule.venueId))).map(getMatchUpId);
|
|
25935
|
-
const
|
|
25936
|
-
|
|
25937
|
-
|
|
25938
|
-
|
|
25939
|
-
|
|
25940
|
-
return bulkScheduleMatchUps$1({
|
|
25941
|
-
schedule: clearedScheduleValues,
|
|
25942
|
-
matchUpIds: relevantMatchUpIds,
|
|
25943
|
-
tournamentRecord
|
|
25958
|
+
const {
|
|
25959
|
+
matchUps
|
|
25960
|
+
} = allTournamentMatchUps({
|
|
25961
|
+
tournamentRecord,
|
|
25962
|
+
inContext: false
|
|
25944
25963
|
});
|
|
25964
|
+
|
|
25965
|
+
for (const matchUp of matchUps) {
|
|
25966
|
+
if (relevantMatchUpIds.includes(matchUp.matchUpId)) {
|
|
25967
|
+
matchUp.timeItems = (matchUp.timeItems || []).filter(timeItem => ![ASSIGN_COURT, ASSIGN_VENUE, SCHEDULED_DATE, SCHEDULED_TIME].includes(timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType));
|
|
25968
|
+
}
|
|
25969
|
+
}
|
|
25970
|
+
|
|
25971
|
+
return { ...SUCCESS
|
|
25972
|
+
};
|
|
25945
25973
|
}
|
|
25946
25974
|
|
|
25947
25975
|
/**
|
|
@@ -29252,27 +29280,27 @@ function setTournamentRecord(record, deepCopyOption = true) {
|
|
|
29252
29280
|
if (typeof record !== 'object' || Array.isArray(record)) return {
|
|
29253
29281
|
error: INVALID_OBJECT
|
|
29254
29282
|
};
|
|
29255
|
-
if (!record.tournamentId) return {
|
|
29283
|
+
if (!(record !== null && record !== void 0 && record.tournamentId)) return {
|
|
29256
29284
|
error: INVALID_VALUES
|
|
29257
29285
|
};
|
|
29258
29286
|
return setTournamentRecord$1(deepCopyOption ? makeDeepCopy(record) : record);
|
|
29259
29287
|
}
|
|
29260
29288
|
function setState$3(records, deepCopyOption = true) {
|
|
29289
|
+
var _records;
|
|
29290
|
+
|
|
29261
29291
|
if (typeof records !== 'object') return {
|
|
29262
29292
|
error: INVALID_OBJECT
|
|
29263
29293
|
};
|
|
29264
29294
|
|
|
29265
29295
|
if (Array.isArray(records)) {
|
|
29266
|
-
const validRecordsArray = records.filter(
|
|
29267
|
-
tournamentId
|
|
29268
|
-
}) => tournamentId).length === records.length;
|
|
29296
|
+
const validRecordsArray = records.filter(record => record === null || record === void 0 ? void 0 : record.tournamentId).length === records.length;
|
|
29269
29297
|
if (!validRecordsArray) return {
|
|
29270
29298
|
error: INVALID_RECORDS
|
|
29271
29299
|
};
|
|
29272
29300
|
records = Object.assign({}, ...records.map(record => ({
|
|
29273
29301
|
[record.tournamentId]: record
|
|
29274
29302
|
})));
|
|
29275
|
-
} else if (records.tournamentId) {
|
|
29303
|
+
} else if ((_records = records) !== null && _records !== void 0 && _records.tournamentId) {
|
|
29276
29304
|
records = {
|
|
29277
29305
|
[records.tournamentId]: records
|
|
29278
29306
|
};
|
|
@@ -30552,17 +30580,17 @@ function generateTieMatchUps({
|
|
|
30552
30580
|
const matchUps = generateRange(0, matchUpCount || 0).map(index => {
|
|
30553
30581
|
const collectionPosition = index + 1;
|
|
30554
30582
|
const matchUp = {
|
|
30555
|
-
isMock,
|
|
30556
|
-
collectionId,
|
|
30557
|
-
matchUpType,
|
|
30558
|
-
matchUpFormat,
|
|
30559
|
-
collectionPosition,
|
|
30560
|
-
matchUpId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop()) || UUID(),
|
|
30561
30583
|
sides: [{
|
|
30562
30584
|
sideNumber: 1
|
|
30563
30585
|
}, {
|
|
30564
30586
|
sideNumber: 2
|
|
30565
|
-
}]
|
|
30587
|
+
}],
|
|
30588
|
+
matchUpId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop()) || UUID(),
|
|
30589
|
+
collectionPosition,
|
|
30590
|
+
matchUpFormat,
|
|
30591
|
+
collectionId,
|
|
30592
|
+
matchUpType,
|
|
30593
|
+
isMock
|
|
30566
30594
|
};
|
|
30567
30595
|
return matchUp;
|
|
30568
30596
|
});
|
|
@@ -33204,6 +33232,17 @@ function attachPlayoffStructures$1({
|
|
|
33204
33232
|
}) => structureId);
|
|
33205
33233
|
drawDefinition.structures.push(...structures);
|
|
33206
33234
|
drawDefinition.links.push(...links);
|
|
33235
|
+
const matchUps = structures.map(structure => {
|
|
33236
|
+
var _getAllStructureMatch;
|
|
33237
|
+
|
|
33238
|
+
return ((_getAllStructureMatch = getAllStructureMatchUps({
|
|
33239
|
+
structure
|
|
33240
|
+
})) === null || _getAllStructureMatch === void 0 ? void 0 : _getAllStructureMatch.matchUps) || [];
|
|
33241
|
+
}).flat();
|
|
33242
|
+
addMatchUpsNotice({
|
|
33243
|
+
drawDefinition,
|
|
33244
|
+
matchUps
|
|
33245
|
+
});
|
|
33207
33246
|
modifyDrawNotice({
|
|
33208
33247
|
drawDefinition,
|
|
33209
33248
|
structureIds
|
|
@@ -35502,12 +35541,12 @@ function alternateDrawPositionAssignment$1({
|
|
|
35502
35541
|
structureId
|
|
35503
35542
|
}) {
|
|
35504
35543
|
return positionParticipantAction({
|
|
35544
|
+
positionActionName: 'alternateDrawPositionAssignment',
|
|
35545
|
+
participantIdAttributeName: 'alternateParticipantid',
|
|
35505
35546
|
participantId: alternateParticipantId,
|
|
35506
35547
|
drawDefinition,
|
|
35507
35548
|
drawPosition,
|
|
35508
|
-
structureId
|
|
35509
|
-
participantIdAttributeName: 'alternateParticipantid',
|
|
35510
|
-
positionActionName: 'alternateDrawPositionAssignment'
|
|
35549
|
+
structureId
|
|
35511
35550
|
});
|
|
35512
35551
|
}
|
|
35513
35552
|
|
|
@@ -36321,7 +36360,7 @@ function addDrawEntries$1({
|
|
|
36321
36360
|
if (positionsAvailable < participantIds.length) return {
|
|
36322
36361
|
error: MORE_PARTICIPANTS_THAN_DRAW_POSITIONS
|
|
36323
36362
|
};
|
|
36324
|
-
const
|
|
36363
|
+
const participantIdsNotAdded = participantIds.reduce((notAdded, participantId) => {
|
|
36325
36364
|
const invalidLuckyLoser = entryStatus === LUCKY_LOSER && participantInEntries({
|
|
36326
36365
|
participantId,
|
|
36327
36366
|
drawDefinition,
|
|
@@ -36338,23 +36377,12 @@ function addDrawEntries$1({
|
|
|
36338
36377
|
});
|
|
36339
36378
|
|
|
36340
36379
|
if (invalidEntry || invalidLuckyLoser || invalidVoluntaryConsolation) {
|
|
36341
|
-
return
|
|
36342
|
-
participantId,
|
|
36343
|
-
error: EXISTING_PARTICIPANT
|
|
36344
|
-
});
|
|
36380
|
+
return notAdded.push(participantId);
|
|
36345
36381
|
}
|
|
36346
36382
|
|
|
36347
|
-
return
|
|
36383
|
+
return notAdded;
|
|
36348
36384
|
}, []);
|
|
36349
|
-
|
|
36350
|
-
if (invalidParticipantIds.length) {
|
|
36351
|
-
return {
|
|
36352
|
-
error: INVALID_ENTRIES,
|
|
36353
|
-
invalidParticipantIds
|
|
36354
|
-
};
|
|
36355
|
-
}
|
|
36356
|
-
|
|
36357
|
-
participantIds.filter(Boolean).forEach(participantId => {
|
|
36385
|
+
participantIds.filter(participantId => participantId && !participantIdsNotAdded.includes(participantId)).forEach(participantId => {
|
|
36358
36386
|
const entry = Object.assign({
|
|
36359
36387
|
participantId
|
|
36360
36388
|
}, {
|
|
@@ -36373,7 +36401,11 @@ function addDrawEntries$1({
|
|
|
36373
36401
|
modifyDrawNotice({
|
|
36374
36402
|
drawDefinition
|
|
36375
36403
|
});
|
|
36376
|
-
return {
|
|
36404
|
+
return participantIdsNotAdded !== null && participantIdsNotAdded !== void 0 && participantIdsNotAdded.length ? {
|
|
36405
|
+
message: 'some participantIds could not be added',
|
|
36406
|
+
participantIdsNotAdded,
|
|
36407
|
+
...SUCCESS
|
|
36408
|
+
} : { ...SUCCESS
|
|
36377
36409
|
};
|
|
36378
36410
|
}
|
|
36379
36411
|
|
|
@@ -38391,15 +38423,17 @@ function getValidAlternatesAction({
|
|
|
38391
38423
|
|
|
38392
38424
|
if (activeDrawPositions.includes(drawPosition)) return {};
|
|
38393
38425
|
const otherFlightEntries = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : (_policyDefinitions$PO = policyDefinitions[POLICY_TYPE_POSITION_ACTIONS]) === null || _policyDefinitions$PO === void 0 ? void 0 : _policyDefinitions$PO.otherFlightEntries;
|
|
38394
|
-
const drawEnteredParticpantIds = (drawDefinition.entries || []).map(({
|
|
38426
|
+
const drawEnteredParticpantIds = (drawDefinition.entries || []).sort((a, b) => (a.entryPosition || 9999) - (b.entryPosition || 9999)).map(({
|
|
38395
38427
|
participantId
|
|
38396
38428
|
}) => participantId).filter(Boolean);
|
|
38397
38429
|
const assignedParticipantIds = positionAssignments.map(assignment => assignment.participantId).filter(Boolean);
|
|
38430
|
+
const availableDrawEnteredParticipantIds = drawEnteredParticpantIds.filter(participantId => !assignedParticipantIds.includes(participantId));
|
|
38398
38431
|
const eventEntries = event.entries || [];
|
|
38399
|
-
const
|
|
38432
|
+
const availableEventAlternatesParticipantIds = eventEntries.filter(entry => entry.entryStatus === ALTERNATE && eligibleEntryStage({
|
|
38400
38433
|
structure,
|
|
38401
38434
|
entry
|
|
38402
38435
|
}) && !assignedParticipantIds.includes(entry.participantId)).sort((a, b) => (a.entryPosition || 9999) - (b.entryPosition || 9999)).map(entry => entry.participantId);
|
|
38436
|
+
const availableAlternatesParticipantIds = unique(availableDrawEnteredParticipantIds.concat(availableEventAlternatesParticipantIds));
|
|
38403
38437
|
|
|
38404
38438
|
if (otherFlightEntries) {
|
|
38405
38439
|
var _flightProfile$flight;
|
|
@@ -38409,7 +38443,7 @@ function getValidAlternatesAction({
|
|
|
38409
38443
|
} = getFlightProfile({
|
|
38410
38444
|
event
|
|
38411
38445
|
});
|
|
38412
|
-
const otherFlightEnteredParticipantIds = flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.filter(flight => flight.drawId !== drawId).map(flight => flight.drawEntries.filter(entry => entry.participantId && !drawEnteredParticpantIds.includes(entry.participantId)).map(({
|
|
38446
|
+
const otherFlightEnteredParticipantIds = flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.filter(flight => flight.drawId !== drawId).map(flight => flight.drawEntries.filter(entry => entry.participantId && ![WITHDRAWN, UNGROUPED, UNPAIRED].includes(entry.entryStatus) && !drawEnteredParticpantIds.includes(entry.participantId)).map(({
|
|
38413
38447
|
participantId
|
|
38414
38448
|
}) => participantId)).flat().filter(Boolean);
|
|
38415
38449
|
|