tods-competition-factory 0.128.2 → 0.131.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 +97 -75
- 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 +4 -4
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.131.0';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
function isPowerOf2(n) {
|
|
@@ -11157,6 +11157,51 @@ function getDrawMatchUps({
|
|
|
11157
11157
|
return matchUpGroups;
|
|
11158
11158
|
}
|
|
11159
11159
|
|
|
11160
|
+
/**
|
|
11161
|
+
*
|
|
11162
|
+
* @param {string} eventId - indicates that invocation is via tournamentEngine
|
|
11163
|
+
* @param {object} event - an event object, attached automatically by tournamentEngine
|
|
11164
|
+
* @returns {object} flightProfile containg flights for each draw either generated or to be generated
|
|
11165
|
+
*/
|
|
11166
|
+
|
|
11167
|
+
function getFlightProfile({
|
|
11168
|
+
event,
|
|
11169
|
+
eventId
|
|
11170
|
+
}) {
|
|
11171
|
+
if (!event) return {
|
|
11172
|
+
error: MISSING_EVENT
|
|
11173
|
+
};
|
|
11174
|
+
const {
|
|
11175
|
+
extension
|
|
11176
|
+
} = findEventExtension({
|
|
11177
|
+
event,
|
|
11178
|
+
name: FLIGHT_PROFILE
|
|
11179
|
+
}); // eventId indicates that `getFlightProfile()` has been called via `tournamentEngine`
|
|
11180
|
+
// a deep copy is made and drawDefinitions are attached for client convenience
|
|
11181
|
+
|
|
11182
|
+
const flightProfile = eventId ? makeDeepCopy(extension === null || extension === void 0 ? void 0 : extension.value, false, true) : extension === null || extension === void 0 ? void 0 : extension.value;
|
|
11183
|
+
|
|
11184
|
+
if (eventId) {
|
|
11185
|
+
var _event$drawDefinition;
|
|
11186
|
+
|
|
11187
|
+
(_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.forEach(drawDefinition => {
|
|
11188
|
+
var _flightProfile$flight;
|
|
11189
|
+
|
|
11190
|
+
flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.forEach(flight => {
|
|
11191
|
+
if (flight.drawId === drawDefinition.drawId) {
|
|
11192
|
+
Object.assign(flight, {
|
|
11193
|
+
drawDefinition
|
|
11194
|
+
});
|
|
11195
|
+
}
|
|
11196
|
+
});
|
|
11197
|
+
});
|
|
11198
|
+
}
|
|
11199
|
+
|
|
11200
|
+
return {
|
|
11201
|
+
flightProfile
|
|
11202
|
+
};
|
|
11203
|
+
}
|
|
11204
|
+
|
|
11160
11205
|
function allTournamentMatchUps({
|
|
11161
11206
|
scheduleVisibilityFilters,
|
|
11162
11207
|
participantsProfile,
|
|
@@ -11391,22 +11436,33 @@ function tournamentMatchUps({
|
|
|
11391
11436
|
tournamentRecord
|
|
11392
11437
|
});
|
|
11393
11438
|
const filteredEventIds = contextFilters && contextFilters.eventIds || [];
|
|
11394
|
-
const eventsDrawsMatchUps = events.filter(event => !filteredEventIds.includes(event.eventId)).map(event =>
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11439
|
+
const eventsDrawsMatchUps = events.filter(event => !filteredEventIds.includes(event.eventId)).map(event => {
|
|
11440
|
+
var _flightProfile$flight, _event$drawDefinition2;
|
|
11441
|
+
|
|
11442
|
+
const flightProfile = getFlightProfile({
|
|
11443
|
+
event
|
|
11444
|
+
}).flightProfile;
|
|
11445
|
+
const additionalContext = {
|
|
11446
|
+
eventDrawsCount: (flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.length) || ((_event$drawDefinition2 = event.drawDefinitions) === null || _event$drawDefinition2 === void 0 ? void 0 : _event$drawDefinition2.length) || 0,
|
|
11447
|
+
...context
|
|
11448
|
+
};
|
|
11449
|
+
return eventMatchUps({
|
|
11450
|
+
context: additionalContext,
|
|
11451
|
+
tournamentAppliedPolicies,
|
|
11452
|
+
scheduleVisibilityFilters,
|
|
11453
|
+
participantsProfile,
|
|
11454
|
+
policyDefinitions,
|
|
11455
|
+
tournamentRecord,
|
|
11456
|
+
matchUpFilters,
|
|
11457
|
+
contextFilters,
|
|
11458
|
+
contextProfile,
|
|
11459
|
+
participants,
|
|
11460
|
+
tournamentId,
|
|
11461
|
+
nextMatchUps,
|
|
11462
|
+
inContext,
|
|
11463
|
+
event
|
|
11464
|
+
});
|
|
11465
|
+
});
|
|
11410
11466
|
const matchUpGroupings = eventsDrawsMatchUps.reduce((matchUps, eventMatchUps) => {
|
|
11411
11467
|
const keys = eventMatchUps && Object.keys(eventMatchUps).filter(key => !['success', 'matchUpsMap'].includes(key));
|
|
11412
11468
|
keys === null || keys === void 0 ? void 0 : keys.forEach(key => {
|
|
@@ -17725,51 +17781,6 @@ function updateAssignmentParticipantResults({
|
|
|
17725
17781
|
};
|
|
17726
17782
|
}
|
|
17727
17783
|
|
|
17728
|
-
/**
|
|
17729
|
-
*
|
|
17730
|
-
* @param {string} eventId - indicates that invocation is via tournamentEngine
|
|
17731
|
-
* @param {object} event - an event object, attached automatically by tournamentEngine
|
|
17732
|
-
* @returns {object} flightProfile containg flights for each draw either generated or to be generated
|
|
17733
|
-
*/
|
|
17734
|
-
|
|
17735
|
-
function getFlightProfile({
|
|
17736
|
-
event,
|
|
17737
|
-
eventId
|
|
17738
|
-
}) {
|
|
17739
|
-
if (!event) return {
|
|
17740
|
-
error: MISSING_EVENT
|
|
17741
|
-
};
|
|
17742
|
-
const {
|
|
17743
|
-
extension
|
|
17744
|
-
} = findEventExtension({
|
|
17745
|
-
event,
|
|
17746
|
-
name: FLIGHT_PROFILE
|
|
17747
|
-
}); // eventId indicates that `getFlightProfile()` has been called via `tournamentEngine`
|
|
17748
|
-
// a deep copy is made and drawDefinitions are attached for client convenience
|
|
17749
|
-
|
|
17750
|
-
const flightProfile = eventId ? makeDeepCopy(extension === null || extension === void 0 ? void 0 : extension.value, false, true) : extension === null || extension === void 0 ? void 0 : extension.value;
|
|
17751
|
-
|
|
17752
|
-
if (eventId) {
|
|
17753
|
-
var _event$drawDefinition;
|
|
17754
|
-
|
|
17755
|
-
(_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.forEach(drawDefinition => {
|
|
17756
|
-
var _flightProfile$flight;
|
|
17757
|
-
|
|
17758
|
-
flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.forEach(flight => {
|
|
17759
|
-
if (flight.drawId === drawDefinition.drawId) {
|
|
17760
|
-
Object.assign(flight, {
|
|
17761
|
-
drawDefinition
|
|
17762
|
-
});
|
|
17763
|
-
}
|
|
17764
|
-
});
|
|
17765
|
-
});
|
|
17766
|
-
}
|
|
17767
|
-
|
|
17768
|
-
return {
|
|
17769
|
-
flightProfile
|
|
17770
|
-
};
|
|
17771
|
-
}
|
|
17772
|
-
|
|
17773
17784
|
const toBePlayed = {
|
|
17774
17785
|
matchUpStatus: TO_BE_PLAYED,
|
|
17775
17786
|
matchUpStatusCodes: [],
|
|
@@ -19581,6 +19592,8 @@ function getAffectedTargetStructureIds({
|
|
|
19581
19592
|
structure,
|
|
19582
19593
|
matchUp
|
|
19583
19594
|
}) {
|
|
19595
|
+
var _getStructureLinks, _getStructureLinks$li;
|
|
19596
|
+
|
|
19584
19597
|
const {
|
|
19585
19598
|
drawPositions
|
|
19586
19599
|
} = matchUp;
|
|
@@ -19592,7 +19605,7 @@ function getAffectedTargetStructureIds({
|
|
|
19592
19605
|
});
|
|
19593
19606
|
const relevantAssignments = positionAssignments.filter(({
|
|
19594
19607
|
drawPosition
|
|
19595
|
-
}) => drawPositions.includes(drawPosition));
|
|
19608
|
+
}) => drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.includes(drawPosition));
|
|
19596
19609
|
const finishingPositions = relevantAssignments.map(assignment => {
|
|
19597
19610
|
var _extension$value;
|
|
19598
19611
|
|
|
@@ -19610,14 +19623,10 @@ function getAffectedTargetStructureIds({
|
|
|
19610
19623
|
drawDefinition
|
|
19611
19624
|
});
|
|
19612
19625
|
const structureId = containerStructures[structure.structureId];
|
|
19613
|
-
const {
|
|
19614
|
-
links: {
|
|
19615
|
-
source: links
|
|
19616
|
-
}
|
|
19617
|
-
} = getStructureLinks({
|
|
19626
|
+
const links = (_getStructureLinks = getStructureLinks({
|
|
19618
19627
|
drawDefinition,
|
|
19619
19628
|
structureId
|
|
19620
|
-
});
|
|
19629
|
+
})) === null || _getStructureLinks === void 0 ? void 0 : (_getStructureLinks$li = _getStructureLinks.links) === null || _getStructureLinks$li === void 0 ? void 0 : _getStructureLinks$li.source;
|
|
19621
19630
|
const structureIds = links === null || links === void 0 ? void 0 : links.filter(link => {
|
|
19622
19631
|
var _link$source;
|
|
19623
19632
|
|
|
@@ -19762,6 +19771,7 @@ function allPlayoffPositionsFilled(params) {
|
|
|
19762
19771
|
|
|
19763
19772
|
function checkConnectedStructures({
|
|
19764
19773
|
drawDefinition,
|
|
19774
|
+
matchUpsMap,
|
|
19765
19775
|
structure,
|
|
19766
19776
|
matchUp
|
|
19767
19777
|
}) {
|
|
@@ -19779,6 +19789,7 @@ function checkConnectedStructures({
|
|
|
19779
19789
|
structureIds
|
|
19780
19790
|
} = getAffectedTargetStructureIds({
|
|
19781
19791
|
drawDefinition,
|
|
19792
|
+
matchUpsMap,
|
|
19782
19793
|
structure,
|
|
19783
19794
|
matchUp
|
|
19784
19795
|
});
|
|
@@ -21241,7 +21252,8 @@ function attemptToSetWinningSide(params) {
|
|
|
21241
21252
|
drawDefinition,
|
|
21242
21253
|
winningSide,
|
|
21243
21254
|
structure,
|
|
21244
|
-
matchUp
|
|
21255
|
+
matchUp,
|
|
21256
|
+
matchUpsMap
|
|
21245
21257
|
} = params;
|
|
21246
21258
|
let connectedStructures;
|
|
21247
21259
|
|
|
@@ -21251,6 +21263,7 @@ function attemptToSetWinningSide(params) {
|
|
|
21251
21263
|
connectedStructureIds
|
|
21252
21264
|
} = checkConnectedStructures({
|
|
21253
21265
|
drawDefinition,
|
|
21266
|
+
matchUpsMap,
|
|
21254
21267
|
structure,
|
|
21255
21268
|
matchUp
|
|
21256
21269
|
});
|
|
@@ -24304,10 +24317,13 @@ function addParticipantContext(params) {
|
|
|
24304
24317
|
|
|
24305
24318
|
// loop through all filtered events and capture events played
|
|
24306
24319
|
(_params$tournamentEve = params.tournamentEvents) === null || _params$tournamentEve === void 0 ? void 0 : _params$tournamentEve.forEach(rawEvent => {
|
|
24307
|
-
var _event$drawDefinition, _timeItem$itemValue, _event$drawDefinition2, _eventInfo$_flightPro, _eventInfo$_flightPro2;
|
|
24320
|
+
var _flightProfile$flight, _event$drawDefinition, _timeItem$itemValue, _event$drawDefinition2, _eventInfo$_flightPro, _eventInfo$_flightPro2;
|
|
24308
24321
|
|
|
24309
24322
|
const event = makeDeepCopy(rawEvent, true, true);
|
|
24310
|
-
const
|
|
24323
|
+
const flightProfile = getFlightProfile({
|
|
24324
|
+
event
|
|
24325
|
+
}).flightProfile;
|
|
24326
|
+
const eventDrawsCount = (flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.length) || ((_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.length) || 0;
|
|
24311
24327
|
|
|
24312
24328
|
if ((event === null || event === void 0 ? void 0 : event.eventType) === TEAM$3) {
|
|
24313
24329
|
// add back lineUps extension for team resolution when { matchUpType: TEAM } is missing side.lineUps
|
|
@@ -38291,6 +38307,7 @@ function addDrawEntry({
|
|
|
38291
38307
|
entryStatus = DIRECT_ACCEPTANCE,
|
|
38292
38308
|
entryStageSequence,
|
|
38293
38309
|
entryStage = MAIN,
|
|
38310
|
+
ignoreStageSpace,
|
|
38294
38311
|
drawDefinition,
|
|
38295
38312
|
entryPosition,
|
|
38296
38313
|
participantId,
|
|
@@ -38319,7 +38336,7 @@ function addDrawEntry({
|
|
|
38319
38336
|
entryStatus
|
|
38320
38337
|
});
|
|
38321
38338
|
|
|
38322
|
-
if (!spaceAvailable.success) {
|
|
38339
|
+
if (!ignoreStageSpace && !spaceAvailable.success) {
|
|
38323
38340
|
return {
|
|
38324
38341
|
error: spaceAvailable.error
|
|
38325
38342
|
};
|
|
@@ -38376,6 +38393,7 @@ function addDrawEntry({
|
|
|
38376
38393
|
function addDrawEntries$1({
|
|
38377
38394
|
entryStatus = DIRECT_ACCEPTANCE,
|
|
38378
38395
|
autoEntryPositions = true,
|
|
38396
|
+
ignoreStageSpace,
|
|
38379
38397
|
drawDefinition,
|
|
38380
38398
|
participantIds,
|
|
38381
38399
|
stageSequence,
|
|
@@ -38407,14 +38425,14 @@ function addDrawEntries$1({
|
|
|
38407
38425
|
stage
|
|
38408
38426
|
});
|
|
38409
38427
|
|
|
38410
|
-
if (!spaceAvailable.success) {
|
|
38428
|
+
if (!ignoreStageSpace && !spaceAvailable.success) {
|
|
38411
38429
|
return {
|
|
38412
38430
|
error: spaceAvailable.error
|
|
38413
38431
|
};
|
|
38414
38432
|
}
|
|
38415
38433
|
|
|
38416
38434
|
const positionsAvailable = spaceAvailable.positionsAvailable || 0;
|
|
38417
|
-
if (positionsAvailable < participantIds.length) return {
|
|
38435
|
+
if (!ignoreStageSpace && positionsAvailable < participantIds.length) return {
|
|
38418
38436
|
error: MORE_PARTICIPANTS_THAN_DRAW_POSITIONS
|
|
38419
38437
|
};
|
|
38420
38438
|
const participantIdsNotAdded = participantIds.reduce((notAdded, participantId) => {
|
|
@@ -38470,6 +38488,7 @@ function addDrawEntries$1({
|
|
|
38470
38488
|
function addDrawEntries({
|
|
38471
38489
|
autoEntryPositions = true,
|
|
38472
38490
|
entryStageSequence,
|
|
38491
|
+
ignoreStageSpace,
|
|
38473
38492
|
drawDefinition,
|
|
38474
38493
|
participantIds,
|
|
38475
38494
|
entryStatus,
|
|
@@ -38494,6 +38513,7 @@ function addDrawEntries({
|
|
|
38494
38513
|
stageSequence: entryStageSequence,
|
|
38495
38514
|
autoEntryPositions,
|
|
38496
38515
|
stage: entryStage,
|
|
38516
|
+
ignoreStageSpace,
|
|
38497
38517
|
drawDefinition,
|
|
38498
38518
|
participantIds,
|
|
38499
38519
|
entryStatus
|
|
@@ -38579,6 +38599,7 @@ function addEventEntries(params) {
|
|
|
38579
38599
|
entryStageSequence,
|
|
38580
38600
|
entryStage = MAIN,
|
|
38581
38601
|
tournamentRecord,
|
|
38602
|
+
ignoreStageSpace,
|
|
38582
38603
|
drawDefinition,
|
|
38583
38604
|
drawId,
|
|
38584
38605
|
event
|
|
@@ -38636,6 +38657,7 @@ function addEventEntries(params) {
|
|
|
38636
38657
|
participantIds: validParticipantIds,
|
|
38637
38658
|
autoEntryPositions,
|
|
38638
38659
|
entryStageSequence,
|
|
38660
|
+
ignoreStageSpace,
|
|
38639
38661
|
drawDefinition,
|
|
38640
38662
|
entryStatus,
|
|
38641
38663
|
entryStage,
|