tods-competition-factory 1.8.44 → 1.8.46
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/forge/generate.mjs +53 -22
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +12 -1
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +4956 -4942
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +95 -44
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +146 -90
- 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/package.json +1 -1
|
@@ -2929,7 +2929,7 @@ var matchUpFormatCode = {
|
|
|
2929
2929
|
};
|
|
2930
2930
|
|
|
2931
2931
|
function factoryVersion() {
|
|
2932
|
-
return '1.8.
|
|
2932
|
+
return '1.8.46';
|
|
2933
2933
|
}
|
|
2934
2934
|
|
|
2935
2935
|
function getObjectTieFormat(obj) {
|
|
@@ -3600,9 +3600,10 @@ var SexEnum;
|
|
|
3600
3600
|
|
|
3601
3601
|
var mixedGenderError = 'MIXED events can not contain mixed singles or { gender: ANY } collections';
|
|
3602
3602
|
var anyMixedError = 'events with { gender: ANY } can not contain MIXED singles collections';
|
|
3603
|
-
function tieFormatGenderValidityCheck(
|
|
3604
|
-
var
|
|
3603
|
+
function tieFormatGenderValidityCheck(params) {
|
|
3604
|
+
var _a, _b;
|
|
3605
3605
|
var stack = 'tieFormatGenderValidityCheck';
|
|
3606
|
+
var referenceGender = params.referenceGender, matchUpType = params.matchUpType, gender = params.gender;
|
|
3606
3607
|
if (referenceGender &&
|
|
3607
3608
|
gender &&
|
|
3608
3609
|
[GenderEnum.Male, GenderEnum.Female].includes(referenceGender) &&
|
|
@@ -3612,8 +3613,9 @@ function tieFormatGenderValidityCheck(_a) {
|
|
|
3612
3613
|
context: { gender: gender },
|
|
3613
3614
|
stack: stack,
|
|
3614
3615
|
});
|
|
3616
|
+
var eventType = (_a = params.eventType) !== null && _a !== void 0 ? _a : (_b = params.referenceEvent) === null || _b === void 0 ? void 0 : _b.eventType;
|
|
3615
3617
|
if (referenceGender === MIXED &&
|
|
3616
|
-
(
|
|
3618
|
+
(eventType !== TEAM$2 ||
|
|
3617
3619
|
gender === ANY ||
|
|
3618
3620
|
(gender === MIXED && matchUpType !== TypeEnum.Doubles))) {
|
|
3619
3621
|
return decorateResult({
|
|
@@ -3926,6 +3928,7 @@ function validateTieFormat(params) {
|
|
|
3926
3928
|
var checkGender = !!((params === null || params === void 0 ? void 0 : params.enforceGender) !== false && (params === null || params === void 0 ? void 0 : params.gender));
|
|
3927
3929
|
var checkCollectionIds = params === null || params === void 0 ? void 0 : params.checkCollectionIds;
|
|
3928
3930
|
var tieFormat = params === null || params === void 0 ? void 0 : params.tieFormat;
|
|
3931
|
+
var event = params === null || params === void 0 ? void 0 : params.event;
|
|
3929
3932
|
var stack = 'validateTieFormat';
|
|
3930
3933
|
var errors = [];
|
|
3931
3934
|
if (!params || !tieFormat || typeof tieFormat !== 'object') {
|
|
@@ -3960,10 +3963,12 @@ function validateTieFormat(params) {
|
|
|
3960
3963
|
var _a = validateCollectionDefinition({
|
|
3961
3964
|
referenceCategory: params.category,
|
|
3962
3965
|
referenceGender: params.gender,
|
|
3966
|
+
eventType: params.eventType,
|
|
3963
3967
|
collectionDefinition: collectionDefinition,
|
|
3964
3968
|
checkCollectionIds: checkCollectionIds,
|
|
3965
3969
|
checkCategory: checkCategory,
|
|
3966
3970
|
checkGender: checkGender,
|
|
3971
|
+
event: event,
|
|
3967
3972
|
}), valid = _a.valid, collectionDefinitionErrors = _a.errors;
|
|
3968
3973
|
if (valid) {
|
|
3969
3974
|
return true;
|
|
@@ -4008,7 +4013,7 @@ function validateTieFormat(params) {
|
|
|
4008
4013
|
return result;
|
|
4009
4014
|
}
|
|
4010
4015
|
function validateCollectionDefinition(_a) {
|
|
4011
|
-
var _b = _a.checkCategory, checkCategory = _b === void 0 ? true : _b, collectionDefinition = _a.collectionDefinition, checkCollectionIds = _a.checkCollectionIds, _c = _a.checkGender, checkGender = _c === void 0 ? true : _c, referenceCategory = _a.referenceCategory, referenceGender = _a.referenceGender, event = _a.event;
|
|
4016
|
+
var _b = _a.checkCategory, checkCategory = _b === void 0 ? true : _b, collectionDefinition = _a.collectionDefinition, checkCollectionIds = _a.checkCollectionIds, _c = _a.checkGender, checkGender = _c === void 0 ? true : _c, referenceCategory = _a.referenceCategory, referenceGender = _a.referenceGender, eventType = _a.eventType, event = _a.event;
|
|
4012
4017
|
referenceGender = referenceGender !== null && referenceGender !== void 0 ? referenceGender : event === null || event === void 0 ? void 0 : event.gender;
|
|
4013
4018
|
var stack = 'validateCollectionDefinition';
|
|
4014
4019
|
var errors = [];
|
|
@@ -4056,7 +4061,7 @@ function validateCollectionDefinition(_a) {
|
|
|
4056
4061
|
}
|
|
4057
4062
|
if (checkGender) {
|
|
4058
4063
|
var result = tieFormatGenderValidityCheck({
|
|
4059
|
-
|
|
4064
|
+
eventType: eventType !== null && eventType !== void 0 ? eventType : event === null || event === void 0 ? void 0 : event.eventType,
|
|
4060
4065
|
referenceGender: referenceGender,
|
|
4061
4066
|
matchUpType: matchUpType,
|
|
4062
4067
|
gender: gender,
|
|
@@ -4089,14 +4094,19 @@ function validateCollectionDefinition(_a) {
|
|
|
4089
4094
|
return { valid: true };
|
|
4090
4095
|
}
|
|
4091
4096
|
// add collectionIds if missing
|
|
4092
|
-
function checkTieFormat(
|
|
4093
|
-
var e_1,
|
|
4094
|
-
var
|
|
4097
|
+
function checkTieFormat(_a) {
|
|
4098
|
+
var e_1, _b;
|
|
4099
|
+
var tieFormat = _a.tieFormat, eventType = _a.eventType;
|
|
4100
|
+
var result = validateTieFormat({
|
|
4101
|
+
checkCollectionIds: false,
|
|
4102
|
+
eventType: eventType,
|
|
4103
|
+
tieFormat: tieFormat,
|
|
4104
|
+
});
|
|
4095
4105
|
if (result.error)
|
|
4096
4106
|
return result;
|
|
4097
4107
|
try {
|
|
4098
|
-
for (var
|
|
4099
|
-
var collectionDefinition =
|
|
4108
|
+
for (var _c = __values(tieFormat.collectionDefinitions), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
4109
|
+
var collectionDefinition = _d.value;
|
|
4100
4110
|
if (!collectionDefinition.collectionId)
|
|
4101
4111
|
collectionDefinition.collectionId = UUID();
|
|
4102
4112
|
}
|
|
@@ -4104,7 +4114,7 @@ function checkTieFormat(tieFormat) {
|
|
|
4104
4114
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4105
4115
|
finally {
|
|
4106
4116
|
try {
|
|
4107
|
-
if (
|
|
4117
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
4108
4118
|
}
|
|
4109
4119
|
finally { if (e_1) throw e_1.error; }
|
|
4110
4120
|
}
|
|
@@ -10259,7 +10269,7 @@ function generateTieMatchUpScore(params) {
|
|
|
10259
10269
|
var tieFormat = ((_c = resolveTieFormat({ matchUp: matchUp, drawDefinition: drawDefinition, structure: structure, event: event })) === null || _c === void 0 ? void 0 : _c.tieFormat) || (params === null || params === void 0 ? void 0 : params.tieFormat);
|
|
10260
10270
|
if (!tieFormat)
|
|
10261
10271
|
return { error: MISSING_TIE_FORMAT };
|
|
10262
|
-
var result = validateTieFormat({ tieFormat: tieFormat });
|
|
10272
|
+
var result = validateTieFormat({ tieFormat: tieFormat, eventType: event === null || event === void 0 ? void 0 : event.eventType });
|
|
10263
10273
|
if (result.error)
|
|
10264
10274
|
return result;
|
|
10265
10275
|
var collectionDefinitions = (tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions) || [];
|
|
@@ -10571,15 +10581,15 @@ function modifyPositionAssignmentsNotice(_a) {
|
|
|
10571
10581
|
}
|
|
10572
10582
|
|
|
10573
10583
|
function ensureSideLineUps(_a) {
|
|
10574
|
-
var _b, _c
|
|
10584
|
+
var _b, _c;
|
|
10575
10585
|
var inContextDualMatchUp = _a.inContextDualMatchUp, drawDefinition = _a.drawDefinition, tournamentId = _a.tournamentId, dualMatchUp = _a.dualMatchUp, eventId = _a.eventId;
|
|
10576
|
-
if (dualMatchUp
|
|
10586
|
+
if (dualMatchUp) {
|
|
10577
10587
|
if (!inContextDualMatchUp) {
|
|
10578
|
-
inContextDualMatchUp = (
|
|
10588
|
+
inContextDualMatchUp = (_b = findDrawMatchUp({
|
|
10579
10589
|
matchUpId: dualMatchUp.matchUpId,
|
|
10580
10590
|
inContext: true,
|
|
10581
10591
|
drawDefinition: drawDefinition,
|
|
10582
|
-
})) === null ||
|
|
10592
|
+
})) === null || _b === void 0 ? void 0 : _b.matchUp;
|
|
10583
10593
|
}
|
|
10584
10594
|
var extension = findExtension$2({
|
|
10585
10595
|
element: drawDefinition,
|
|
@@ -10590,9 +10600,18 @@ function ensureSideLineUps(_a) {
|
|
|
10590
10600
|
var displaySideNumber = _a.displaySideNumber, drawPosition = _a.drawPosition, sideNumber = _a.sideNumber;
|
|
10591
10601
|
return ({ drawPosition: drawPosition, sideNumber: sideNumber, displaySideNumber: displaySideNumber });
|
|
10592
10602
|
};
|
|
10593
|
-
dualMatchUp.sides = (
|
|
10594
|
-
var
|
|
10595
|
-
|
|
10603
|
+
dualMatchUp.sides = (_c = inContextDualMatchUp === null || inContextDualMatchUp === void 0 ? void 0 : inContextDualMatchUp.sides) === null || _c === void 0 ? void 0 : _c.map(function (contextSide) {
|
|
10604
|
+
var _a, _b;
|
|
10605
|
+
var participantId = contextSide.participantId;
|
|
10606
|
+
var referenceLineUp = (participantId && lineUps_1[participantId]) || undefined;
|
|
10607
|
+
var _c = (_b = (_a = dualMatchUp.sides) === null || _a === void 0 ? void 0 : _a.find(function (_a) {
|
|
10608
|
+
var sideNumber = _a.sideNumber;
|
|
10609
|
+
return sideNumber === contextSide.sideNumber;
|
|
10610
|
+
})) !== null && _b !== void 0 ? _b : {}, noContextLineUp = _c.lineUp, noContextSideDetail = __rest(_c, ["lineUp"]);
|
|
10611
|
+
var lineUp = (noContextLineUp === null || noContextLineUp === void 0 ? void 0 : noContextLineUp.length)
|
|
10612
|
+
? noContextLineUp
|
|
10613
|
+
: referenceLineUp;
|
|
10614
|
+
return __assign(__assign(__assign({}, extractSideDetail_1(contextSide)), noContextSideDetail), { lineUp: lineUp });
|
|
10596
10615
|
});
|
|
10597
10616
|
modifyMatchUpNotice({
|
|
10598
10617
|
context: 'ensureSidLineUps',
|
|
@@ -25958,7 +25977,7 @@ function processSides(params) {
|
|
|
25958
25977
|
|
|
25959
25978
|
function getParticipantEntries(params) {
|
|
25960
25979
|
var e_1, _a, e_2, _b;
|
|
25961
|
-
var _c, _d, _e, _f, _g, _h;
|
|
25980
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
25962
25981
|
var participantFilters = params.participantFilters, convertExtensions = params.convertExtensions, policyDefinitions = params.policyDefinitions, tournamentRecord = params.tournamentRecord, usePublishState = params.usePublishState, contextProfile = params.contextProfile, participantMap = params.participantMap, withPotentialMatchUps = params.withPotentialMatchUps, withRankingProfile = params.withRankingProfile, withScheduleItems = params.withScheduleItems, scheduleAnalysis = params.scheduleAnalysis, withTeamMatchUps = params.withTeamMatchUps, withStatistics = params.withStatistics, withOpponents = params.withOpponents, withMatchUps = params.withMatchUps, withSeeding = params.withSeeding, withEvents = params.withEvents, withDraws = params.withDraws;
|
|
25963
25982
|
var targetParticipantIds = participantFilters === null || participantFilters === void 0 ? void 0 : participantFilters.participantIds;
|
|
25964
25983
|
var getRelevantParticipantIds = function (participantId) {
|
|
@@ -25997,11 +26016,11 @@ function getParticipantEntries(params) {
|
|
|
25997
26016
|
return (_e = (_d = (_c = (_b = participantMap[participantId].participant) === null || _b === void 0 ? void 0 : _b.rankings) === null || _c === void 0 ? void 0 : _c[eventType]) === null || _d === void 0 ? void 0 : _d.find(function (ranking) { return scaleNames.includes(ranking.scaleName); })) === null || _e === void 0 ? void 0 : _e.scaleValue;
|
|
25998
26017
|
};
|
|
25999
26018
|
var _loop_1 = function (event_1) {
|
|
26000
|
-
var e_3,
|
|
26019
|
+
var e_3, _o, e_4, _p, e_5, _q;
|
|
26001
26020
|
if ((participantFilters === null || participantFilters === void 0 ? void 0 : participantFilters.eventIds) &&
|
|
26002
26021
|
!participantFilters.eventIds.includes(event_1.eventId))
|
|
26003
26022
|
return "continue";
|
|
26004
|
-
var
|
|
26023
|
+
var _r = event_1.drawDefinitions, drawDefinitions = _r === void 0 ? [] : _r, _s = event_1.extensions, extensions = _s === void 0 ? [] : _s, eventType = event_1.eventType, eventName = event_1.eventName, category = event_1.category, entries = event_1.entries, eventId = event_1.eventId, gender = event_1.gender;
|
|
26005
26024
|
var flightProfile = getFlightProfile({ event: event_1 }).flightProfile;
|
|
26006
26025
|
var flights = (_c = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) !== null && _c !== void 0 ? _c : [];
|
|
26007
26026
|
var publishStatuses = getEventPublishStatuses({ event: event_1 });
|
|
@@ -26017,7 +26036,7 @@ function getParticipantEntries(params) {
|
|
|
26017
26036
|
category === null || category === void 0 ? void 0 : category.ageCategoryCode,
|
|
26018
26037
|
].filter(Boolean);
|
|
26019
26038
|
var _loop_3 = function (entry) {
|
|
26020
|
-
var
|
|
26039
|
+
var _t;
|
|
26021
26040
|
var participantId = entry.participantId;
|
|
26022
26041
|
if (!participantId || !participantMap[participantId])
|
|
26023
26042
|
return "continue"; // handle bad data
|
|
@@ -26026,13 +26045,13 @@ function getParticipantEntries(params) {
|
|
|
26026
26045
|
var seedAssignments, seedValue;
|
|
26027
26046
|
if (withSeeding) {
|
|
26028
26047
|
var participant = participantMap[participantId].participant;
|
|
26029
|
-
(
|
|
26048
|
+
(_t = getEventSeedAssignments({
|
|
26030
26049
|
publishedSeeding: publishedSeeding,
|
|
26031
26050
|
usePublishState: usePublishState,
|
|
26032
26051
|
withSeeding: withSeeding,
|
|
26033
26052
|
participant: participant,
|
|
26034
26053
|
event: event_1,
|
|
26035
|
-
}), seedAssignments =
|
|
26054
|
+
}), seedAssignments = _t.seedAssignments, seedValue = _t.seedValue);
|
|
26036
26055
|
}
|
|
26037
26056
|
// IMPORTANT NOTE!
|
|
26038
26057
|
// id is the pair, team or individual participant currently being processed
|
|
@@ -26068,7 +26087,7 @@ function getParticipantEntries(params) {
|
|
|
26068
26087
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
26069
26088
|
finally {
|
|
26070
26089
|
try {
|
|
26071
|
-
if (entries_1_1 && !entries_1_1.done && (
|
|
26090
|
+
if (entries_1_1 && !entries_1_1.done && (_o = entries_1.return)) _o.call(entries_1);
|
|
26072
26091
|
}
|
|
26073
26092
|
finally { if (e_3) throw e_3.error; }
|
|
26074
26093
|
}
|
|
@@ -26087,11 +26106,11 @@ function getParticipantEntries(params) {
|
|
|
26087
26106
|
};
|
|
26088
26107
|
var drawIds = unique(__spreadArray(__spreadArray([], __read(drawDefinitions.map(extractAttributes('drawId'))), false), __read(flights.map(extractAttributes('drawId'))), false));
|
|
26089
26108
|
var _loop_4 = function (drawId) {
|
|
26090
|
-
var e_6,
|
|
26109
|
+
var e_6, _u;
|
|
26091
26110
|
var drawDefinition = drawDefinitions.find(function (drawDefinition) { return drawDefinition.drawId === drawId; });
|
|
26092
26111
|
var flight = flights === null || flights === void 0 ? void 0 : flights.find(function (flight) { return flight.drawId === drawId; });
|
|
26093
26112
|
var entries_2 = (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) || (flight === null || flight === void 0 ? void 0 : flight.drawEntries);
|
|
26094
|
-
var
|
|
26113
|
+
var _v = drawDefinition !== null && drawDefinition !== void 0 ? drawDefinition : {}, _w = _v.structures, structures = _w === void 0 ? [] : _w, drawOrder = _v.drawOrder, drawName = _v.drawName, drawType = _v.drawType;
|
|
26095
26114
|
var flightNumber = flight === null || flight === void 0 ? void 0 : flight.flightNumber;
|
|
26096
26115
|
var scaleNames = [
|
|
26097
26116
|
category === null || category === void 0 ? void 0 : category.categoryName,
|
|
@@ -26251,10 +26270,16 @@ function getParticipantEntries(params) {
|
|
|
26251
26270
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
26252
26271
|
finally {
|
|
26253
26272
|
try {
|
|
26254
|
-
if (relevantEntries_1_1 && !relevantEntries_1_1.done && (
|
|
26273
|
+
if (relevantEntries_1_1 && !relevantEntries_1_1.done && (_u = relevantEntries_1.return)) _u.call(relevantEntries_1);
|
|
26255
26274
|
}
|
|
26256
26275
|
finally { if (e_6) throw e_6.error; }
|
|
26257
26276
|
}
|
|
26277
|
+
var stages = ((_g = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) !== null && _g !== void 0 ? _g : []).reduce(function (stages, structure) {
|
|
26278
|
+
if (!stages.includes(structure.stage))
|
|
26279
|
+
stages.push(structure.stage);
|
|
26280
|
+
return stages;
|
|
26281
|
+
}, []);
|
|
26282
|
+
var linksCount = ((_h = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.links) !== null && _h !== void 0 ? _h : []).length;
|
|
26258
26283
|
derivedDrawInfo[drawId] = {
|
|
26259
26284
|
qualifyingPositionAssignments: qualifyingPositionAssignments,
|
|
26260
26285
|
qualifyingSeedAssignments: qualifyingSeedAssignments,
|
|
@@ -26264,11 +26289,13 @@ function getParticipantEntries(params) {
|
|
|
26264
26289
|
orderedStructureIds: orderedStructureIds,
|
|
26265
26290
|
mainSeedingMap: mainSeedingMap,
|
|
26266
26291
|
flightNumber: flightNumber,
|
|
26292
|
+
linksCount: linksCount,
|
|
26267
26293
|
drawOrder: drawOrder,
|
|
26268
26294
|
drawName: drawName,
|
|
26269
26295
|
drawType: drawType,
|
|
26270
26296
|
drawSize: drawSize,
|
|
26271
26297
|
drawId: drawId,
|
|
26298
|
+
stages: stages,
|
|
26272
26299
|
// qualifyingDrawSize,
|
|
26273
26300
|
};
|
|
26274
26301
|
};
|
|
@@ -26281,7 +26308,7 @@ function getParticipantEntries(params) {
|
|
|
26281
26308
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
26282
26309
|
finally {
|
|
26283
26310
|
try {
|
|
26284
|
-
if (drawIds_1_1 && !drawIds_1_1.done && (
|
|
26311
|
+
if (drawIds_1_1 && !drawIds_1_1.done && (_p = drawIds_1.return)) _p.call(drawIds_1);
|
|
26285
26312
|
}
|
|
26286
26313
|
finally { if (e_4) throw e_4.error; }
|
|
26287
26314
|
}
|
|
@@ -26294,7 +26321,7 @@ function getParticipantEntries(params) {
|
|
|
26294
26321
|
withMatchUps ||
|
|
26295
26322
|
withDraws) {
|
|
26296
26323
|
var nextMatchUps = !!scheduleAnalysis || withPotentialMatchUps;
|
|
26297
|
-
var eventMatchUps = (
|
|
26324
|
+
var eventMatchUps = (_k = (_j = allEventMatchUps({
|
|
26298
26325
|
afterRecoveryTimes: !!scheduleAnalysis,
|
|
26299
26326
|
policyDefinitions: policyDefinitions,
|
|
26300
26327
|
tournamentRecord: tournamentRecord,
|
|
@@ -26303,10 +26330,10 @@ function getParticipantEntries(params) {
|
|
|
26303
26330
|
participantMap: participantMap,
|
|
26304
26331
|
nextMatchUps: nextMatchUps,
|
|
26305
26332
|
event: event_1,
|
|
26306
|
-
})) === null ||
|
|
26333
|
+
})) === null || _j === void 0 ? void 0 : _j.matchUps) !== null && _k !== void 0 ? _k : [];
|
|
26307
26334
|
var _loop_5 = function (matchUp) {
|
|
26308
|
-
var e_7,
|
|
26309
|
-
var finishingPositionRange = matchUp.finishingPositionRange, potentialParticipants = matchUp.potentialParticipants,
|
|
26335
|
+
var e_7, _x;
|
|
26336
|
+
var finishingPositionRange = matchUp.finishingPositionRange, potentialParticipants = matchUp.potentialParticipants, _y = matchUp.tieMatchUps, tieMatchUps = _y === void 0 ? [] : _y, _z = matchUp.sides, sides = _z === void 0 ? [] : _z, winningSide = matchUp.winningSide, matchUpType = matchUp.matchUpType, matchUpId = matchUp.matchUpId, eventId_1 = matchUp.eventId, drawId = matchUp.drawId, collectionId = matchUp.collectionId, stageSequence = matchUp.stageSequence, finishingRound = matchUp.finishingRound, matchUpStatus = matchUp.matchUpStatus, roundPosition = matchUp.roundPosition, roundNumber = matchUp.roundNumber, structureId = matchUp.structureId, schedule = matchUp.schedule, score = matchUp.score, stage = matchUp.stage;
|
|
26310
26337
|
mappedMatchUps[matchUpId] = matchUp;
|
|
26311
26338
|
var baseAttrs = {
|
|
26312
26339
|
finishingPositionRange: finishingPositionRange,
|
|
@@ -26326,14 +26353,14 @@ function getParticipantEntries(params) {
|
|
|
26326
26353
|
try {
|
|
26327
26354
|
for (var tieMatchUps_1 = (e_7 = void 0, __values(tieMatchUps)), tieMatchUps_1_1 = tieMatchUps_1.next(); !tieMatchUps_1_1.done; tieMatchUps_1_1 = tieMatchUps_1.next()) {
|
|
26328
26355
|
var tieMatchUp = tieMatchUps_1_1.value;
|
|
26329
|
-
var tieMatchUpWinningSide = tieMatchUp.winningSide,
|
|
26356
|
+
var tieMatchUpWinningSide = tieMatchUp.winningSide, _0 = tieMatchUp.sides, tieMatchUpSides = _0 === void 0 ? [] : _0, tieMatchUpId = tieMatchUp.matchUpId, matchUpStatus_1 = tieMatchUp.matchUpStatus, matchUpType_1 = tieMatchUp.matchUpType;
|
|
26330
26357
|
processSides(__assign(__assign(__assign({}, baseAttrs), withOpts), { winningSide: tieMatchUpWinningSide, tieWinningSide: winningSide, matchUpTieId: matchUpId, matchUpId: tieMatchUpId, sides: tieMatchUpSides, matchUpSides: sides, matchUpStatus: matchUpStatus_1, matchUpType: matchUpType_1 }));
|
|
26331
26358
|
}
|
|
26332
26359
|
}
|
|
26333
26360
|
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
26334
26361
|
finally {
|
|
26335
26362
|
try {
|
|
26336
|
-
if (tieMatchUps_1_1 && !tieMatchUps_1_1.done && (
|
|
26363
|
+
if (tieMatchUps_1_1 && !tieMatchUps_1_1.done && (_x = tieMatchUps_1.return)) _x.call(tieMatchUps_1);
|
|
26337
26364
|
}
|
|
26338
26365
|
finally { if (e_7) throw e_7.error; }
|
|
26339
26366
|
}
|
|
@@ -26384,7 +26411,7 @@ function getParticipantEntries(params) {
|
|
|
26384
26411
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
26385
26412
|
finally {
|
|
26386
26413
|
try {
|
|
26387
|
-
if (eventMatchUps_1_1 && !eventMatchUps_1_1.done && (
|
|
26414
|
+
if (eventMatchUps_1_1 && !eventMatchUps_1_1.done && (_q = eventMatchUps_1.return)) _q.call(eventMatchUps_1);
|
|
26388
26415
|
}
|
|
26389
26416
|
finally { if (e_5) throw e_5.error; }
|
|
26390
26417
|
}
|
|
@@ -26392,23 +26419,23 @@ function getParticipantEntries(params) {
|
|
|
26392
26419
|
}
|
|
26393
26420
|
};
|
|
26394
26421
|
try {
|
|
26395
|
-
for (var
|
|
26396
|
-
var event_1 =
|
|
26422
|
+
for (var _l = __values((tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.events) || []), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
26423
|
+
var event_1 = _m.value;
|
|
26397
26424
|
_loop_1(event_1);
|
|
26398
26425
|
}
|
|
26399
26426
|
}
|
|
26400
26427
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
26401
26428
|
finally {
|
|
26402
26429
|
try {
|
|
26403
|
-
if (
|
|
26430
|
+
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
26404
26431
|
}
|
|
26405
26432
|
finally { if (e_1) throw e_1.error; }
|
|
26406
26433
|
}
|
|
26407
26434
|
if (withStatistics || withRankingProfile || !!scheduleAnalysis) {
|
|
26408
26435
|
var aggregators = Object.values(participantMap);
|
|
26409
26436
|
var _loop_2 = function (participantAggregator) {
|
|
26410
|
-
var e_8,
|
|
26411
|
-
var
|
|
26437
|
+
var e_8, _1, e_9, _2, e_10, _3;
|
|
26438
|
+
var _4 = participantAggregator.counters, wins = _4.wins, losses = _4.losses, _5 = SINGLES$1, _6 = _4[_5], singlesWins = _6.wins, singlesLosses = _6.losses, _7 = DOUBLES$1, _8 = _4[_7], doublesWins = _8.wins, doublesLosses = _8.losses;
|
|
26412
26439
|
var addStatValue = function (statCode, wins, losses) {
|
|
26413
26440
|
var denominator = wins + losses;
|
|
26414
26441
|
var numerator = wins;
|
|
@@ -26431,7 +26458,7 @@ function getParticipantEntries(params) {
|
|
|
26431
26458
|
return Math.abs(range[0] - range[1]);
|
|
26432
26459
|
};
|
|
26433
26460
|
var _loop_7 = function (drawId) {
|
|
26434
|
-
var
|
|
26461
|
+
var _11 = derivedDrawInfo[drawId] || {}, _12 = _11.orderedStructureIds, orderedStructureIds = _12 === void 0 ? [] : _12, flightNumber = _11.flightNumber;
|
|
26435
26462
|
if (participantAggregator.structureParticipation &&
|
|
26436
26463
|
orderedStructureIds.length) {
|
|
26437
26464
|
var finishingPositionRange_1;
|
|
@@ -26467,15 +26494,15 @@ function getParticipantEntries(params) {
|
|
|
26467
26494
|
}
|
|
26468
26495
|
};
|
|
26469
26496
|
try {
|
|
26470
|
-
for (var
|
|
26471
|
-
var drawId =
|
|
26497
|
+
for (var _9 = (e_8 = void 0, __values(Object.keys(participantAggregator.draws))), _10 = _9.next(); !_10.done; _10 = _9.next()) {
|
|
26498
|
+
var drawId = _10.value;
|
|
26472
26499
|
_loop_7(drawId);
|
|
26473
26500
|
}
|
|
26474
26501
|
}
|
|
26475
26502
|
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
26476
26503
|
finally {
|
|
26477
26504
|
try {
|
|
26478
|
-
if (
|
|
26505
|
+
if (_10 && !_10.done && (_1 = _9.return)) _1.call(_9);
|
|
26479
26506
|
}
|
|
26480
26507
|
finally { if (e_8) throw e_8.error; }
|
|
26481
26508
|
}
|
|
@@ -26546,7 +26573,7 @@ function getParticipantEntries(params) {
|
|
|
26546
26573
|
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
26547
26574
|
finally {
|
|
26548
26575
|
try {
|
|
26549
|
-
if (scheduleItemsToConsider_1_1 && !scheduleItemsToConsider_1_1.done && (
|
|
26576
|
+
if (scheduleItemsToConsider_1_1 && !scheduleItemsToConsider_1_1.done && (_3 = scheduleItemsToConsider_1.return)) _3.call(scheduleItemsToConsider_1);
|
|
26550
26577
|
}
|
|
26551
26578
|
finally { if (e_10) throw e_10.error; }
|
|
26552
26579
|
}
|
|
@@ -26555,7 +26582,7 @@ function getParticipantEntries(params) {
|
|
|
26555
26582
|
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
26556
26583
|
finally {
|
|
26557
26584
|
try {
|
|
26558
|
-
if (scheduleItems_1_1 && !scheduleItems_1_1.done && (
|
|
26585
|
+
if (scheduleItems_1_1 && !scheduleItems_1_1.done && (_2 = scheduleItems_1.return)) _2.call(scheduleItems_1);
|
|
26559
26586
|
}
|
|
26560
26587
|
finally { if (e_9) throw e_9.error; }
|
|
26561
26588
|
}
|
|
@@ -34081,6 +34108,13 @@ function setMatchUpStatus$2(params) {
|
|
|
34081
34108
|
score: score_1,
|
|
34082
34109
|
});
|
|
34083
34110
|
}
|
|
34111
|
+
ensureSideLineUps({
|
|
34112
|
+
tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
|
|
34113
|
+
inContextDualMatchUp: inContextMatchUp,
|
|
34114
|
+
eventId: event === null || event === void 0 ? void 0 : event.eventId,
|
|
34115
|
+
drawDefinition: drawDefinition,
|
|
34116
|
+
dualMatchUp: matchUp,
|
|
34117
|
+
});
|
|
34084
34118
|
}
|
|
34085
34119
|
if (matchUp.matchUpType === TEAM$2 &&
|
|
34086
34120
|
matchUpStatus &&
|
|
@@ -36016,7 +36050,10 @@ function modifyCollectionDefinition$1(_a) {
|
|
|
36016
36050
|
modifications.push({ collectionId: collectionId, gender: gender });
|
|
36017
36051
|
}
|
|
36018
36052
|
var modifiedTieFormat = definedAttributes(tieFormat);
|
|
36019
|
-
result = validateTieFormat({
|
|
36053
|
+
result = validateTieFormat({
|
|
36054
|
+
tieFormat: modifiedTieFormat,
|
|
36055
|
+
eventType: event === null || event === void 0 ? void 0 : event.eventType,
|
|
36056
|
+
});
|
|
36020
36057
|
if (result.error) {
|
|
36021
36058
|
return decorateResult({ result: result, stack: stack });
|
|
36022
36059
|
}
|
|
@@ -36309,7 +36346,8 @@ function removeCollectionDefinition$1(_a) {
|
|
|
36309
36346
|
matchUp = matchUp !== null && matchUp !== void 0 ? matchUp : result === null || result === void 0 ? void 0 : result.matchUp;
|
|
36310
36347
|
var existingTieFormat = result === null || result === void 0 ? void 0 : result.tieFormat;
|
|
36311
36348
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
36312
|
-
|
|
36349
|
+
var eventType = event === null || event === void 0 ? void 0 : event.eventType;
|
|
36350
|
+
result = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
36313
36351
|
if (result.error)
|
|
36314
36352
|
return decorateResult({ result: result, stack: stack });
|
|
36315
36353
|
var targetCollection = (_e = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions) === null || _e === void 0 ? void 0 : _e.find(function (collectionDefinition) { return collectionDefinition.collectionId === collectionId; });
|
|
@@ -36500,7 +36538,7 @@ function removeCollectionDefinition$1(_a) {
|
|
|
36500
36538
|
});
|
|
36501
36539
|
}
|
|
36502
36540
|
var prunedTieFormat = definedAttributes(tieFormat);
|
|
36503
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
36541
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat, eventType: eventType });
|
|
36504
36542
|
if (result.error)
|
|
36505
36543
|
return decorateResult({ result: result, stack: stack });
|
|
36506
36544
|
// TODO: implement use of tieFormats and tieFormatId
|
|
@@ -36584,7 +36622,8 @@ function addCollectionDefinition$1(_a) {
|
|
|
36584
36622
|
matchUp = matchUp !== null && matchUp !== void 0 ? matchUp : result === null || result === void 0 ? void 0 : result.matchUp;
|
|
36585
36623
|
var existingTieFormat = (_k = matchUp === null || matchUp === void 0 ? void 0 : matchUp.tieFormat) !== null && _k !== void 0 ? _k : result === null || result === void 0 ? void 0 : result.tieFormat;
|
|
36586
36624
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
36587
|
-
|
|
36625
|
+
var eventType = event === null || event === void 0 ? void 0 : event.eventType;
|
|
36626
|
+
result = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
36588
36627
|
if (result === null || result === void 0 ? void 0 : result.error) {
|
|
36589
36628
|
return decorateResult({ result: { error: result.error }, stack: stack });
|
|
36590
36629
|
}
|
|
@@ -36628,7 +36667,7 @@ function addCollectionDefinition$1(_a) {
|
|
|
36628
36667
|
var addedMatchUps = [];
|
|
36629
36668
|
var targetMatchUps = [];
|
|
36630
36669
|
var prunedTieFormat = definedAttributes(tieFormat);
|
|
36631
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
36670
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat, eventType: eventType });
|
|
36632
36671
|
if (result === null || result === void 0 ? void 0 : result.error) {
|
|
36633
36672
|
return decorateResult({ result: { error: result.error }, stack: stack });
|
|
36634
36673
|
}
|
|
@@ -36950,7 +36989,10 @@ function collectionGroupUpdate(_a) {
|
|
|
36950
36989
|
event: event,
|
|
36951
36990
|
});
|
|
36952
36991
|
var prunedTieFormat = definedAttributes(tieFormat);
|
|
36953
|
-
var result = validateTieFormat({
|
|
36992
|
+
var result = validateTieFormat({
|
|
36993
|
+
eventType: event === null || event === void 0 ? void 0 : event.eventType,
|
|
36994
|
+
tieFormat: prunedTieFormat,
|
|
36995
|
+
});
|
|
36954
36996
|
if (result.error)
|
|
36955
36997
|
return result;
|
|
36956
36998
|
// TODO: implement use of tieFormats and tieFormatId
|
|
@@ -36999,7 +37041,7 @@ function removeCollectionGroup$1(_a) {
|
|
|
36999
37041
|
var originalValueGoal = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.valueGoal;
|
|
37000
37042
|
var wasAggregateValue = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.aggregateValue;
|
|
37001
37043
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
37002
|
-
result = validateTieFormat({ tieFormat: tieFormat });
|
|
37044
|
+
result = validateTieFormat({ tieFormat: tieFormat, eventType: event === null || event === void 0 ? void 0 : event.eventType });
|
|
37003
37045
|
if (result.error)
|
|
37004
37046
|
return decorateResult({ result: result, stack: stack });
|
|
37005
37047
|
var modifiedCollectionIds = [];
|
|
@@ -37080,7 +37122,7 @@ function addCollectionGroup$1(_a) {
|
|
|
37080
37122
|
var existingTieFormat = result === null || result === void 0 ? void 0 : result.tieFormat;
|
|
37081
37123
|
var originalValueGoal = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.valueGoal;
|
|
37082
37124
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
37083
|
-
result = validateTieFormat({ tieFormat: tieFormat });
|
|
37125
|
+
result = validateTieFormat({ tieFormat: tieFormat, eventType: event.eventType });
|
|
37084
37126
|
if (result.error)
|
|
37085
37127
|
return decorateResult({ result: result, stack: stack });
|
|
37086
37128
|
try {
|
|
@@ -37145,7 +37187,10 @@ function modifyTieFormat$1(_a) {
|
|
|
37145
37187
|
var e_1, _b, e_2, _c, e_3, _d;
|
|
37146
37188
|
var _e = _a.updateInProgressMatchUps, updateInProgressMatchUps = _e === void 0 ? false : _e, tieFormatComparison = _a.tieFormatComparison, modifiedTieFormat = _a.modifiedTieFormat, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structureId = _a.structureId, matchUpId = _a.matchUpId, eventId = _a.eventId, uuids = _a.uuids, event = _a.event;
|
|
37147
37189
|
var stack = 'modifyTieFormat';
|
|
37148
|
-
if (!validateTieFormat({
|
|
37190
|
+
if (!validateTieFormat({
|
|
37191
|
+
tieFormat: modifiedTieFormat,
|
|
37192
|
+
eventType: event === null || event === void 0 ? void 0 : event.eventType,
|
|
37193
|
+
}).valid) {
|
|
37149
37194
|
return decorateResult({
|
|
37150
37195
|
result: { error: INVALID_TIE_FORMAT },
|
|
37151
37196
|
info: 'falied validation',
|
|
@@ -46430,8 +46475,8 @@ function setStageQualifiersCount(_a) {
|
|
|
46430
46475
|
}
|
|
46431
46476
|
|
|
46432
46477
|
function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
46433
|
-
var _a, _b;
|
|
46434
|
-
var
|
|
46478
|
+
var _a, _b, _c;
|
|
46479
|
+
var _d = params || {}, _e = _d.modifyOriginal, modifyOriginal = _e === void 0 ? true : _e, _f = _d.stageSequence, stageSequence = _f === void 0 ? 1 : _f, isMock = _d.isMock;
|
|
46435
46480
|
var stack = 'generateDrawTypeAndModifyDrawDefinition';
|
|
46436
46481
|
if (!params.drawDefinition)
|
|
46437
46482
|
return decorateResult({
|
|
@@ -46443,11 +46488,12 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
46443
46488
|
: makeDeepCopy(params.drawDefinition, false, true);
|
|
46444
46489
|
var tieFormat = params.tieFormat, matchUpType = params.matchUpType;
|
|
46445
46490
|
if (tieFormat) {
|
|
46446
|
-
var
|
|
46491
|
+
var eventType = (_a = params.event) === null || _a === void 0 ? void 0 : _a.eventType;
|
|
46492
|
+
var result_1 = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
46447
46493
|
if (result_1.error)
|
|
46448
46494
|
return result_1;
|
|
46449
46495
|
}
|
|
46450
|
-
tieFormat = copyTieFormat(tieFormat || ((
|
|
46496
|
+
tieFormat = copyTieFormat(tieFormat || ((_b = resolveTieFormat({ drawDefinition: drawDefinition })) === null || _b === void 0 ? void 0 : _b.tieFormat));
|
|
46451
46497
|
matchUpType = matchUpType || drawDefinition.matchUpType || SINGLES$1;
|
|
46452
46498
|
params.tieFormat = tieFormat;
|
|
46453
46499
|
params.matchUpType = matchUpType;
|
|
@@ -46501,7 +46547,7 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
46501
46547
|
}
|
|
46502
46548
|
var drawSize = params.drawSize || mainStageDrawPositionsCount;
|
|
46503
46549
|
Object.assign(params, definedAttributes({ drawSize: drawSize, matchUpType: matchUpType, tieFormat: tieFormat }));
|
|
46504
|
-
var
|
|
46550
|
+
var _g = getAllDrawMatchUps({ drawDefinition: drawDefinition }), matchUps = _g.matchUps, matchUpsMap = _g.matchUpsMap;
|
|
46505
46551
|
if (tieFormat) {
|
|
46506
46552
|
// if there were exiting matchUps, exclude them from this step
|
|
46507
46553
|
matchUps === null || matchUps === void 0 ? void 0 : matchUps.forEach(function (matchUp) {
|
|
@@ -46513,7 +46559,7 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
46513
46559
|
}
|
|
46514
46560
|
var inContextDrawMatchUps = addGoesTo({ drawDefinition: drawDefinition, matchUpsMap: matchUpsMap }).inContextDrawMatchUps;
|
|
46515
46561
|
modifyDrawNotice({
|
|
46516
|
-
tournamentId: (
|
|
46562
|
+
tournamentId: (_c = params.tournamentRecord) === null || _c === void 0 ? void 0 : _c.tournamentId,
|
|
46517
46563
|
drawDefinition: drawDefinition,
|
|
46518
46564
|
});
|
|
46519
46565
|
return __assign(__assign({ inContextDrawMatchUps: inContextDrawMatchUps, drawDefinition: drawDefinition, matchUpsMap: matchUpsMap }, SUCCESS), { structures: structures, matchUps: matchUps, links: links });
|
|
@@ -48974,8 +49020,8 @@ function addVoluntaryConsolationStage$1(_a) {
|
|
|
48974
49020
|
|
|
48975
49021
|
function generateVoluntaryConsolation$1(params) {
|
|
48976
49022
|
var _a, _b;
|
|
48977
|
-
var _c, _d, _e, _f, _g, _h, _j;
|
|
48978
|
-
var
|
|
49023
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
49024
|
+
var _l = params.drawType, drawType = _l === void 0 ? SINGLE_ELIMINATION : _l, _m = params.attachConsolation, attachConsolation = _m === void 0 ? true : _m, _o = params.applyPositioning, applyPositioning = _o === void 0 ? true : _o, tournamentRecord = params.tournamentRecord, staggeredEntry = params.staggeredEntry, // optional - specifies main structure FEED_IN for drawTypes CURTIS_CONSOLATION, FEED_IN_CHAMPIONSHIPS, FMLC
|
|
48979
49025
|
automated = params.automated, placeByes = params.placeByes, isMock = params.isMock, event = params.event;
|
|
48980
49026
|
var drawDefinition = params === null || params === void 0 ? void 0 : params.drawDefinition;
|
|
48981
49027
|
if (!drawDefinition)
|
|
@@ -49006,12 +49052,13 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
49006
49052
|
return { error: INVALID_DRAW_SIZE };
|
|
49007
49053
|
var tieFormat = params.tieFormat, matchUpType = params.matchUpType;
|
|
49008
49054
|
if (tieFormat) {
|
|
49009
|
-
var
|
|
49055
|
+
var eventType = (_d = params.event) === null || _d === void 0 ? void 0 : _d.eventType;
|
|
49056
|
+
var result_1 = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
49010
49057
|
if (result_1.error)
|
|
49011
49058
|
return result_1;
|
|
49012
49059
|
}
|
|
49013
|
-
tieFormat = copyTieFormat(tieFormat !== null && tieFormat !== void 0 ? tieFormat : (
|
|
49014
|
-
matchUpType = (
|
|
49060
|
+
tieFormat = copyTieFormat(tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_e = resolveTieFormat({ drawDefinition: drawDefinition })) === null || _e === void 0 ? void 0 : _e.tieFormat);
|
|
49061
|
+
matchUpType = (_f = matchUpType !== null && matchUpType !== void 0 ? matchUpType : drawDefinition.matchUpType) !== null && _f !== void 0 ? _f : TypeEnum.Singles;
|
|
49015
49062
|
var stageStructures = getDrawStructures({
|
|
49016
49063
|
stageSequence: 1,
|
|
49017
49064
|
drawDefinition: drawDefinition,
|
|
@@ -49022,11 +49069,11 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
49022
49069
|
if (structureCount > 1)
|
|
49023
49070
|
return { error: STAGE_SEQUENCE_LIMIT };
|
|
49024
49071
|
// invalid to already have matchUps generated for any existing structure
|
|
49025
|
-
if ((
|
|
49072
|
+
if ((_h = (_g = stageStructures === null || stageStructures === void 0 ? void 0 : stageStructures[0]) === null || _g === void 0 ? void 0 : _g.matchUps) === null || _h === void 0 ? void 0 : _h.length)
|
|
49026
49073
|
return { error: EXISTING_STRUCTURE };
|
|
49027
|
-
var structureId = (
|
|
49074
|
+
var structureId = (_j = stageStructures === null || stageStructures === void 0 ? void 0 : stageStructures[0]) === null || _j === void 0 ? void 0 : _j.structureId;
|
|
49028
49075
|
Object.assign(params, definedAttributes({
|
|
49029
|
-
structureName: (
|
|
49076
|
+
structureName: (_k = params.structureName) !== null && _k !== void 0 ? _k : constantToString(VOLUNTARY_CONSOLATION),
|
|
49030
49077
|
structureId: structureId,
|
|
49031
49078
|
matchUpType: matchUpType,
|
|
49032
49079
|
tieFormat: tieFormat,
|
|
@@ -58213,7 +58260,7 @@ var sortingConstants = { ASC: ASC, ASCENDING: ASCENDING, DESC: DESC, DESCENDING:
|
|
|
58213
58260
|
// by default if there are no scaleValues matching the scaleAccessor then participants will be assigned in the array order of [team].individidualParticipantIds
|
|
58214
58261
|
function generateLineUps(params) {
|
|
58215
58262
|
var e_1, _a, e_2, _b;
|
|
58216
|
-
var _c, _d, _e;
|
|
58263
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
58217
58264
|
var tieFormat = params.tieFormat;
|
|
58218
58265
|
var useDefaultEventRanking = params.useDefaultEventRanking, tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, scaleAccessor = params.scaleAccessor, // e.g. { scaleType: 'RANKINGS', scaleName: 'U18', accessor: 'wtnRating', sortOrder: 'ASC' }
|
|
58219
58266
|
singlesOnly = params.singlesOnly, // use singles scale for doubles events
|
|
@@ -58226,26 +58273,26 @@ function generateLineUps(params) {
|
|
|
58226
58273
|
if (!tieFormat && !drawDefinition)
|
|
58227
58274
|
return { error: DRAW_DEFINITION_NOT_FOUND };
|
|
58228
58275
|
tieFormat =
|
|
58229
|
-
tieFormat
|
|
58230
|
-
if (validateTieFormat({ tieFormat: tieFormat }).error)
|
|
58276
|
+
tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_c = resolveTieFormat({ drawDefinition: drawDefinition, event: event })) === null || _c === void 0 ? void 0 : _c.tieFormat;
|
|
58277
|
+
if (validateTieFormat({ tieFormat: tieFormat, eventType: (_d = params.event) === null || _d === void 0 ? void 0 : _d.eventType }).error)
|
|
58231
58278
|
return { error: INVALID_TIE_FORMAT };
|
|
58232
58279
|
if (typeof scaleAccessor !== 'object' && !useDefaultEventRanking)
|
|
58233
58280
|
return { error: INVALID_VALUES, context: { scaleAccessor: scaleAccessor } };
|
|
58234
58281
|
var lineUps = {};
|
|
58235
|
-
var targetEntries = ((drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) || event.entries).filter(function (entry) { return (entry === null || entry === void 0 ? void 0 : entry.entryStatus) === DIRECT_ACCEPTANCE; });
|
|
58282
|
+
var targetEntries = ((_f = (_e = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) !== null && _e !== void 0 ? _e : event === null || event === void 0 ? void 0 : event.entries) !== null && _f !== void 0 ? _f : []).filter(function (entry) { return (entry === null || entry === void 0 ? void 0 : entry.entryStatus) === DIRECT_ACCEPTANCE; });
|
|
58236
58283
|
var participantIds = targetEntries.map(getParticipantId);
|
|
58237
|
-
var
|
|
58284
|
+
var _l = getParticipants$1({
|
|
58238
58285
|
withIndividualParticipants: true,
|
|
58239
58286
|
withScaleValues: true,
|
|
58240
58287
|
tournamentRecord: tournamentRecord,
|
|
58241
|
-
}).participants, participants =
|
|
58288
|
+
}).participants, participants = _l === void 0 ? [] : _l;
|
|
58242
58289
|
var teamParticipants = participants.filter(function (_a) {
|
|
58243
58290
|
var participantId = _a.participantId;
|
|
58244
58291
|
return participantIds.includes(participantId);
|
|
58245
58292
|
});
|
|
58246
58293
|
var formatScaleType = function (type) { return (type === RANKING$1 ? 'rankings' : 'ratings'); };
|
|
58247
|
-
var defaultScaleName = ((
|
|
58248
|
-
var
|
|
58294
|
+
var defaultScaleName = (_h = (_g = event === null || event === void 0 ? void 0 : event.category) === null || _g === void 0 ? void 0 : _g.categoryName) !== null && _h !== void 0 ? _h : (_j = event === null || event === void 0 ? void 0 : event.category) === null || _j === void 0 ? void 0 : _j.ageCategoryCode;
|
|
58295
|
+
var _m = scaleAccessor || {}, _o = _m.scaleName, scaleName = _o === void 0 ? defaultScaleName : _o, _p = _m.scaleType, scaleType = _p === void 0 ? RANKING$1 : _p, sortOrder = _m.sortOrder, accessor = _m.accessor;
|
|
58249
58296
|
var formattedScaleType = formatScaleType(scaleType);
|
|
58250
58297
|
var getScaleValue = function (individualParticipant, matchUpType) {
|
|
58251
58298
|
var _a, _b, _c;
|
|
@@ -58273,9 +58320,9 @@ function generateLineUps(params) {
|
|
|
58273
58320
|
var singlesScaleSort = function (a, b) { return sortMethod(a, b, SINGLES_MATCHUP); };
|
|
58274
58321
|
var doublesScaleSort = function (a, b) { return sortMethod(a, b, DOUBLES_MATCHUP); };
|
|
58275
58322
|
var participantIdPairs = [];
|
|
58276
|
-
var collectionDefinitions = tieFormat.collectionDefinitions
|
|
58323
|
+
var collectionDefinitions = (_k = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions) !== null && _k !== void 0 ? _k : [];
|
|
58277
58324
|
var _loop_1 = function (teamParticipant) {
|
|
58278
|
-
var e_3,
|
|
58325
|
+
var e_3, _q;
|
|
58279
58326
|
var singlesSort = teamParticipant.individualParticipants.sort(singlesScaleSort);
|
|
58280
58327
|
var doublesSort = singlesOnly
|
|
58281
58328
|
? singlesSort
|
|
@@ -58291,8 +58338,9 @@ function generateLineUps(params) {
|
|
|
58291
58338
|
var participantIds = [];
|
|
58292
58339
|
generateRange(0, singlesMatchUp ? 1 : 2).forEach(function (i) {
|
|
58293
58340
|
var nextParticipantId = typeSort.find(function (participant) {
|
|
58294
|
-
var targetGender =
|
|
58295
|
-
(
|
|
58341
|
+
var targetGender = gender &&
|
|
58342
|
+
(([MALE, FEMALE].includes(gender) && gender) ||
|
|
58343
|
+
(gender === MIXED && [MALE, FEMALE][i]));
|
|
58296
58344
|
return ((!targetGender || targetGender === participant.person.sex) &&
|
|
58297
58345
|
!collectionParticipantIds.includes(participant.participantId));
|
|
58298
58346
|
}).participantId;
|
|
@@ -58321,7 +58369,7 @@ function generateLineUps(params) {
|
|
|
58321
58369
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
58322
58370
|
finally {
|
|
58323
58371
|
try {
|
|
58324
|
-
if (collectionDefinitions_1_1 && !collectionDefinitions_1_1.done && (
|
|
58372
|
+
if (collectionDefinitions_1_1 && !collectionDefinitions_1_1.done && (_q = collectionDefinitions_1.return)) _q.call(collectionDefinitions_1);
|
|
58325
58373
|
}
|
|
58326
58374
|
finally { if (e_3) throw e_3.error; }
|
|
58327
58375
|
}
|
|
@@ -62113,7 +62161,10 @@ function addEvent(_a) {
|
|
|
62113
62161
|
var eventRecord = __assign({ drawDefinitions: [], eventType: TypeEnum.Singles, entries: [], startDate: startDate, endDate: endDate }, event);
|
|
62114
62162
|
if (event.eventType === TypeEnum.Team) {
|
|
62115
62163
|
if (event.tieFormat) {
|
|
62116
|
-
var result = validateTieFormat({
|
|
62164
|
+
var result = validateTieFormat({
|
|
62165
|
+
tieFormat: event.tieFormat,
|
|
62166
|
+
eventType: event.eventType,
|
|
62167
|
+
});
|
|
62117
62168
|
if (result.error)
|
|
62118
62169
|
return result;
|
|
62119
62170
|
}
|
|
@@ -64749,6 +64800,7 @@ function generateDrawDefinition(params) {
|
|
|
64749
64800
|
gender: event === null || event === void 0 ? void 0 : event.gender,
|
|
64750
64801
|
enforceGender: enforceGender,
|
|
64751
64802
|
tieFormat: tieFormat,
|
|
64803
|
+
event: event,
|
|
64752
64804
|
});
|
|
64753
64805
|
if (result.error)
|
|
64754
64806
|
return decorateResult({ result: result, stack: stack });
|
|
@@ -64776,7 +64828,10 @@ function generateDrawDefinition(params) {
|
|
|
64776
64828
|
// there is no need to attach to the drawDefinition
|
|
64777
64829
|
if (!equivalentInScope) {
|
|
64778
64830
|
if (tieFormat) {
|
|
64779
|
-
var result = checkTieFormat(
|
|
64831
|
+
var result = checkTieFormat({
|
|
64832
|
+
eventType: event.eventType,
|
|
64833
|
+
tieFormat: tieFormat,
|
|
64834
|
+
});
|
|
64780
64835
|
if (result.error)
|
|
64781
64836
|
return decorateResult({ result: result, stack: stack });
|
|
64782
64837
|
drawDefinition.tieFormat = (_13 = result.tieFormat) !== null && _13 !== void 0 ? _13 : tieFormat;
|
|
@@ -65203,15 +65258,16 @@ function aggregateTieFormats(_a) {
|
|
|
65203
65258
|
addedCount += 1;
|
|
65204
65259
|
}
|
|
65205
65260
|
};
|
|
65206
|
-
|
|
65261
|
+
var eventType = event_1.eventType;
|
|
65262
|
+
checkTieFormat({ tieFormat: event_1.tieFormat, eventType: eventType });
|
|
65207
65263
|
try {
|
|
65208
65264
|
for (var _p = (e_2 = void 0, __values((_e = event_1.drawDefinitions) !== null && _e !== void 0 ? _e : [])), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
65209
65265
|
var drawDefinition = _q.value;
|
|
65210
|
-
checkTieFormat(drawDefinition);
|
|
65266
|
+
checkTieFormat({ tieFormat: drawDefinition.tieFormat, eventType: eventType });
|
|
65211
65267
|
try {
|
|
65212
65268
|
for (var _r = (e_3 = void 0, __values((_f = drawDefinition.structures) !== null && _f !== void 0 ? _f : [])), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
65213
65269
|
var structure = _s.value;
|
|
65214
|
-
checkTieFormat(structure);
|
|
65270
|
+
checkTieFormat({ tieFormat: structure.tieFormat, eventType: eventType });
|
|
65215
65271
|
}
|
|
65216
65272
|
}
|
|
65217
65273
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|