tods-competition-factory 1.8.44 → 1.8.45
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 +30 -16
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/transform.mjs +11 -10
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +65 -38
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +86 -54
- 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.45';
|
|
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) || [];
|
|
@@ -36016,7 +36026,10 @@ function modifyCollectionDefinition$1(_a) {
|
|
|
36016
36026
|
modifications.push({ collectionId: collectionId, gender: gender });
|
|
36017
36027
|
}
|
|
36018
36028
|
var modifiedTieFormat = definedAttributes(tieFormat);
|
|
36019
|
-
result = validateTieFormat({
|
|
36029
|
+
result = validateTieFormat({
|
|
36030
|
+
tieFormat: modifiedTieFormat,
|
|
36031
|
+
eventType: event === null || event === void 0 ? void 0 : event.eventType,
|
|
36032
|
+
});
|
|
36020
36033
|
if (result.error) {
|
|
36021
36034
|
return decorateResult({ result: result, stack: stack });
|
|
36022
36035
|
}
|
|
@@ -36309,7 +36322,8 @@ function removeCollectionDefinition$1(_a) {
|
|
|
36309
36322
|
matchUp = matchUp !== null && matchUp !== void 0 ? matchUp : result === null || result === void 0 ? void 0 : result.matchUp;
|
|
36310
36323
|
var existingTieFormat = result === null || result === void 0 ? void 0 : result.tieFormat;
|
|
36311
36324
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
36312
|
-
|
|
36325
|
+
var eventType = event === null || event === void 0 ? void 0 : event.eventType;
|
|
36326
|
+
result = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
36313
36327
|
if (result.error)
|
|
36314
36328
|
return decorateResult({ result: result, stack: stack });
|
|
36315
36329
|
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 +36514,7 @@ function removeCollectionDefinition$1(_a) {
|
|
|
36500
36514
|
});
|
|
36501
36515
|
}
|
|
36502
36516
|
var prunedTieFormat = definedAttributes(tieFormat);
|
|
36503
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
36517
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat, eventType: eventType });
|
|
36504
36518
|
if (result.error)
|
|
36505
36519
|
return decorateResult({ result: result, stack: stack });
|
|
36506
36520
|
// TODO: implement use of tieFormats and tieFormatId
|
|
@@ -36584,7 +36598,8 @@ function addCollectionDefinition$1(_a) {
|
|
|
36584
36598
|
matchUp = matchUp !== null && matchUp !== void 0 ? matchUp : result === null || result === void 0 ? void 0 : result.matchUp;
|
|
36585
36599
|
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
36600
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
36587
|
-
|
|
36601
|
+
var eventType = event === null || event === void 0 ? void 0 : event.eventType;
|
|
36602
|
+
result = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
36588
36603
|
if (result === null || result === void 0 ? void 0 : result.error) {
|
|
36589
36604
|
return decorateResult({ result: { error: result.error }, stack: stack });
|
|
36590
36605
|
}
|
|
@@ -36628,7 +36643,7 @@ function addCollectionDefinition$1(_a) {
|
|
|
36628
36643
|
var addedMatchUps = [];
|
|
36629
36644
|
var targetMatchUps = [];
|
|
36630
36645
|
var prunedTieFormat = definedAttributes(tieFormat);
|
|
36631
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
36646
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat, eventType: eventType });
|
|
36632
36647
|
if (result === null || result === void 0 ? void 0 : result.error) {
|
|
36633
36648
|
return decorateResult({ result: { error: result.error }, stack: stack });
|
|
36634
36649
|
}
|
|
@@ -36950,7 +36965,10 @@ function collectionGroupUpdate(_a) {
|
|
|
36950
36965
|
event: event,
|
|
36951
36966
|
});
|
|
36952
36967
|
var prunedTieFormat = definedAttributes(tieFormat);
|
|
36953
|
-
var result = validateTieFormat({
|
|
36968
|
+
var result = validateTieFormat({
|
|
36969
|
+
eventType: event === null || event === void 0 ? void 0 : event.eventType,
|
|
36970
|
+
tieFormat: prunedTieFormat,
|
|
36971
|
+
});
|
|
36954
36972
|
if (result.error)
|
|
36955
36973
|
return result;
|
|
36956
36974
|
// TODO: implement use of tieFormats and tieFormatId
|
|
@@ -36999,7 +37017,7 @@ function removeCollectionGroup$1(_a) {
|
|
|
36999
37017
|
var originalValueGoal = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.valueGoal;
|
|
37000
37018
|
var wasAggregateValue = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.aggregateValue;
|
|
37001
37019
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
37002
|
-
result = validateTieFormat({ tieFormat: tieFormat });
|
|
37020
|
+
result = validateTieFormat({ tieFormat: tieFormat, eventType: event === null || event === void 0 ? void 0 : event.eventType });
|
|
37003
37021
|
if (result.error)
|
|
37004
37022
|
return decorateResult({ result: result, stack: stack });
|
|
37005
37023
|
var modifiedCollectionIds = [];
|
|
@@ -37080,7 +37098,7 @@ function addCollectionGroup$1(_a) {
|
|
|
37080
37098
|
var existingTieFormat = result === null || result === void 0 ? void 0 : result.tieFormat;
|
|
37081
37099
|
var originalValueGoal = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.valueGoal;
|
|
37082
37100
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
37083
|
-
result = validateTieFormat({ tieFormat: tieFormat });
|
|
37101
|
+
result = validateTieFormat({ tieFormat: tieFormat, eventType: event.eventType });
|
|
37084
37102
|
if (result.error)
|
|
37085
37103
|
return decorateResult({ result: result, stack: stack });
|
|
37086
37104
|
try {
|
|
@@ -37145,7 +37163,10 @@ function modifyTieFormat$1(_a) {
|
|
|
37145
37163
|
var e_1, _b, e_2, _c, e_3, _d;
|
|
37146
37164
|
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
37165
|
var stack = 'modifyTieFormat';
|
|
37148
|
-
if (!validateTieFormat({
|
|
37166
|
+
if (!validateTieFormat({
|
|
37167
|
+
tieFormat: modifiedTieFormat,
|
|
37168
|
+
eventType: event === null || event === void 0 ? void 0 : event.eventType,
|
|
37169
|
+
}).valid) {
|
|
37149
37170
|
return decorateResult({
|
|
37150
37171
|
result: { error: INVALID_TIE_FORMAT },
|
|
37151
37172
|
info: 'falied validation',
|
|
@@ -46430,8 +46451,8 @@ function setStageQualifiersCount(_a) {
|
|
|
46430
46451
|
}
|
|
46431
46452
|
|
|
46432
46453
|
function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
46433
|
-
var _a, _b;
|
|
46434
|
-
var
|
|
46454
|
+
var _a, _b, _c;
|
|
46455
|
+
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
46456
|
var stack = 'generateDrawTypeAndModifyDrawDefinition';
|
|
46436
46457
|
if (!params.drawDefinition)
|
|
46437
46458
|
return decorateResult({
|
|
@@ -46443,11 +46464,12 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
46443
46464
|
: makeDeepCopy(params.drawDefinition, false, true);
|
|
46444
46465
|
var tieFormat = params.tieFormat, matchUpType = params.matchUpType;
|
|
46445
46466
|
if (tieFormat) {
|
|
46446
|
-
var
|
|
46467
|
+
var eventType = (_a = params.event) === null || _a === void 0 ? void 0 : _a.eventType;
|
|
46468
|
+
var result_1 = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
46447
46469
|
if (result_1.error)
|
|
46448
46470
|
return result_1;
|
|
46449
46471
|
}
|
|
46450
|
-
tieFormat = copyTieFormat(tieFormat || ((
|
|
46472
|
+
tieFormat = copyTieFormat(tieFormat || ((_b = resolveTieFormat({ drawDefinition: drawDefinition })) === null || _b === void 0 ? void 0 : _b.tieFormat));
|
|
46451
46473
|
matchUpType = matchUpType || drawDefinition.matchUpType || SINGLES$1;
|
|
46452
46474
|
params.tieFormat = tieFormat;
|
|
46453
46475
|
params.matchUpType = matchUpType;
|
|
@@ -46501,7 +46523,7 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
46501
46523
|
}
|
|
46502
46524
|
var drawSize = params.drawSize || mainStageDrawPositionsCount;
|
|
46503
46525
|
Object.assign(params, definedAttributes({ drawSize: drawSize, matchUpType: matchUpType, tieFormat: tieFormat }));
|
|
46504
|
-
var
|
|
46526
|
+
var _g = getAllDrawMatchUps({ drawDefinition: drawDefinition }), matchUps = _g.matchUps, matchUpsMap = _g.matchUpsMap;
|
|
46505
46527
|
if (tieFormat) {
|
|
46506
46528
|
// if there were exiting matchUps, exclude them from this step
|
|
46507
46529
|
matchUps === null || matchUps === void 0 ? void 0 : matchUps.forEach(function (matchUp) {
|
|
@@ -46513,7 +46535,7 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
46513
46535
|
}
|
|
46514
46536
|
var inContextDrawMatchUps = addGoesTo({ drawDefinition: drawDefinition, matchUpsMap: matchUpsMap }).inContextDrawMatchUps;
|
|
46515
46537
|
modifyDrawNotice({
|
|
46516
|
-
tournamentId: (
|
|
46538
|
+
tournamentId: (_c = params.tournamentRecord) === null || _c === void 0 ? void 0 : _c.tournamentId,
|
|
46517
46539
|
drawDefinition: drawDefinition,
|
|
46518
46540
|
});
|
|
46519
46541
|
return __assign(__assign({ inContextDrawMatchUps: inContextDrawMatchUps, drawDefinition: drawDefinition, matchUpsMap: matchUpsMap }, SUCCESS), { structures: structures, matchUps: matchUps, links: links });
|
|
@@ -48974,8 +48996,8 @@ function addVoluntaryConsolationStage$1(_a) {
|
|
|
48974
48996
|
|
|
48975
48997
|
function generateVoluntaryConsolation$1(params) {
|
|
48976
48998
|
var _a, _b;
|
|
48977
|
-
var _c, _d, _e, _f, _g, _h, _j;
|
|
48978
|
-
var
|
|
48999
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
49000
|
+
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
49001
|
automated = params.automated, placeByes = params.placeByes, isMock = params.isMock, event = params.event;
|
|
48980
49002
|
var drawDefinition = params === null || params === void 0 ? void 0 : params.drawDefinition;
|
|
48981
49003
|
if (!drawDefinition)
|
|
@@ -49006,12 +49028,13 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
49006
49028
|
return { error: INVALID_DRAW_SIZE };
|
|
49007
49029
|
var tieFormat = params.tieFormat, matchUpType = params.matchUpType;
|
|
49008
49030
|
if (tieFormat) {
|
|
49009
|
-
var
|
|
49031
|
+
var eventType = (_d = params.event) === null || _d === void 0 ? void 0 : _d.eventType;
|
|
49032
|
+
var result_1 = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
49010
49033
|
if (result_1.error)
|
|
49011
49034
|
return result_1;
|
|
49012
49035
|
}
|
|
49013
|
-
tieFormat = copyTieFormat(tieFormat !== null && tieFormat !== void 0 ? tieFormat : (
|
|
49014
|
-
matchUpType = (
|
|
49036
|
+
tieFormat = copyTieFormat(tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_e = resolveTieFormat({ drawDefinition: drawDefinition })) === null || _e === void 0 ? void 0 : _e.tieFormat);
|
|
49037
|
+
matchUpType = (_f = matchUpType !== null && matchUpType !== void 0 ? matchUpType : drawDefinition.matchUpType) !== null && _f !== void 0 ? _f : TypeEnum.Singles;
|
|
49015
49038
|
var stageStructures = getDrawStructures({
|
|
49016
49039
|
stageSequence: 1,
|
|
49017
49040
|
drawDefinition: drawDefinition,
|
|
@@ -49022,11 +49045,11 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
49022
49045
|
if (structureCount > 1)
|
|
49023
49046
|
return { error: STAGE_SEQUENCE_LIMIT };
|
|
49024
49047
|
// invalid to already have matchUps generated for any existing structure
|
|
49025
|
-
if ((
|
|
49048
|
+
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
49049
|
return { error: EXISTING_STRUCTURE };
|
|
49027
|
-
var structureId = (
|
|
49050
|
+
var structureId = (_j = stageStructures === null || stageStructures === void 0 ? void 0 : stageStructures[0]) === null || _j === void 0 ? void 0 : _j.structureId;
|
|
49028
49051
|
Object.assign(params, definedAttributes({
|
|
49029
|
-
structureName: (
|
|
49052
|
+
structureName: (_k = params.structureName) !== null && _k !== void 0 ? _k : constantToString(VOLUNTARY_CONSOLATION),
|
|
49030
49053
|
structureId: structureId,
|
|
49031
49054
|
matchUpType: matchUpType,
|
|
49032
49055
|
tieFormat: tieFormat,
|
|
@@ -58213,7 +58236,7 @@ var sortingConstants = { ASC: ASC, ASCENDING: ASCENDING, DESC: DESC, DESCENDING:
|
|
|
58213
58236
|
// by default if there are no scaleValues matching the scaleAccessor then participants will be assigned in the array order of [team].individidualParticipantIds
|
|
58214
58237
|
function generateLineUps(params) {
|
|
58215
58238
|
var e_1, _a, e_2, _b;
|
|
58216
|
-
var _c, _d, _e;
|
|
58239
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
58217
58240
|
var tieFormat = params.tieFormat;
|
|
58218
58241
|
var useDefaultEventRanking = params.useDefaultEventRanking, tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, scaleAccessor = params.scaleAccessor, // e.g. { scaleType: 'RANKINGS', scaleName: 'U18', accessor: 'wtnRating', sortOrder: 'ASC' }
|
|
58219
58242
|
singlesOnly = params.singlesOnly, // use singles scale for doubles events
|
|
@@ -58226,26 +58249,26 @@ function generateLineUps(params) {
|
|
|
58226
58249
|
if (!tieFormat && !drawDefinition)
|
|
58227
58250
|
return { error: DRAW_DEFINITION_NOT_FOUND };
|
|
58228
58251
|
tieFormat =
|
|
58229
|
-
tieFormat
|
|
58230
|
-
if (validateTieFormat({ tieFormat: tieFormat }).error)
|
|
58252
|
+
tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_c = resolveTieFormat({ drawDefinition: drawDefinition, event: event })) === null || _c === void 0 ? void 0 : _c.tieFormat;
|
|
58253
|
+
if (validateTieFormat({ tieFormat: tieFormat, eventType: (_d = params.event) === null || _d === void 0 ? void 0 : _d.eventType }).error)
|
|
58231
58254
|
return { error: INVALID_TIE_FORMAT };
|
|
58232
58255
|
if (typeof scaleAccessor !== 'object' && !useDefaultEventRanking)
|
|
58233
58256
|
return { error: INVALID_VALUES, context: { scaleAccessor: scaleAccessor } };
|
|
58234
58257
|
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; });
|
|
58258
|
+
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
58259
|
var participantIds = targetEntries.map(getParticipantId);
|
|
58237
|
-
var
|
|
58260
|
+
var _l = getParticipants$1({
|
|
58238
58261
|
withIndividualParticipants: true,
|
|
58239
58262
|
withScaleValues: true,
|
|
58240
58263
|
tournamentRecord: tournamentRecord,
|
|
58241
|
-
}).participants, participants =
|
|
58264
|
+
}).participants, participants = _l === void 0 ? [] : _l;
|
|
58242
58265
|
var teamParticipants = participants.filter(function (_a) {
|
|
58243
58266
|
var participantId = _a.participantId;
|
|
58244
58267
|
return participantIds.includes(participantId);
|
|
58245
58268
|
});
|
|
58246
58269
|
var formatScaleType = function (type) { return (type === RANKING$1 ? 'rankings' : 'ratings'); };
|
|
58247
|
-
var defaultScaleName = ((
|
|
58248
|
-
var
|
|
58270
|
+
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;
|
|
58271
|
+
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
58272
|
var formattedScaleType = formatScaleType(scaleType);
|
|
58250
58273
|
var getScaleValue = function (individualParticipant, matchUpType) {
|
|
58251
58274
|
var _a, _b, _c;
|
|
@@ -58273,9 +58296,9 @@ function generateLineUps(params) {
|
|
|
58273
58296
|
var singlesScaleSort = function (a, b) { return sortMethod(a, b, SINGLES_MATCHUP); };
|
|
58274
58297
|
var doublesScaleSort = function (a, b) { return sortMethod(a, b, DOUBLES_MATCHUP); };
|
|
58275
58298
|
var participantIdPairs = [];
|
|
58276
|
-
var collectionDefinitions = tieFormat.collectionDefinitions
|
|
58299
|
+
var collectionDefinitions = (_k = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions) !== null && _k !== void 0 ? _k : [];
|
|
58277
58300
|
var _loop_1 = function (teamParticipant) {
|
|
58278
|
-
var e_3,
|
|
58301
|
+
var e_3, _q;
|
|
58279
58302
|
var singlesSort = teamParticipant.individualParticipants.sort(singlesScaleSort);
|
|
58280
58303
|
var doublesSort = singlesOnly
|
|
58281
58304
|
? singlesSort
|
|
@@ -58291,8 +58314,9 @@ function generateLineUps(params) {
|
|
|
58291
58314
|
var participantIds = [];
|
|
58292
58315
|
generateRange(0, singlesMatchUp ? 1 : 2).forEach(function (i) {
|
|
58293
58316
|
var nextParticipantId = typeSort.find(function (participant) {
|
|
58294
|
-
var targetGender =
|
|
58295
|
-
(
|
|
58317
|
+
var targetGender = gender &&
|
|
58318
|
+
(([MALE, FEMALE].includes(gender) && gender) ||
|
|
58319
|
+
(gender === MIXED && [MALE, FEMALE][i]));
|
|
58296
58320
|
return ((!targetGender || targetGender === participant.person.sex) &&
|
|
58297
58321
|
!collectionParticipantIds.includes(participant.participantId));
|
|
58298
58322
|
}).participantId;
|
|
@@ -58321,7 +58345,7 @@ function generateLineUps(params) {
|
|
|
58321
58345
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
58322
58346
|
finally {
|
|
58323
58347
|
try {
|
|
58324
|
-
if (collectionDefinitions_1_1 && !collectionDefinitions_1_1.done && (
|
|
58348
|
+
if (collectionDefinitions_1_1 && !collectionDefinitions_1_1.done && (_q = collectionDefinitions_1.return)) _q.call(collectionDefinitions_1);
|
|
58325
58349
|
}
|
|
58326
58350
|
finally { if (e_3) throw e_3.error; }
|
|
58327
58351
|
}
|
|
@@ -62113,7 +62137,10 @@ function addEvent(_a) {
|
|
|
62113
62137
|
var eventRecord = __assign({ drawDefinitions: [], eventType: TypeEnum.Singles, entries: [], startDate: startDate, endDate: endDate }, event);
|
|
62114
62138
|
if (event.eventType === TypeEnum.Team) {
|
|
62115
62139
|
if (event.tieFormat) {
|
|
62116
|
-
var result = validateTieFormat({
|
|
62140
|
+
var result = validateTieFormat({
|
|
62141
|
+
tieFormat: event.tieFormat,
|
|
62142
|
+
eventType: event.eventType,
|
|
62143
|
+
});
|
|
62117
62144
|
if (result.error)
|
|
62118
62145
|
return result;
|
|
62119
62146
|
}
|
|
@@ -64749,6 +64776,7 @@ function generateDrawDefinition(params) {
|
|
|
64749
64776
|
gender: event === null || event === void 0 ? void 0 : event.gender,
|
|
64750
64777
|
enforceGender: enforceGender,
|
|
64751
64778
|
tieFormat: tieFormat,
|
|
64779
|
+
event: event,
|
|
64752
64780
|
});
|
|
64753
64781
|
if (result.error)
|
|
64754
64782
|
return decorateResult({ result: result, stack: stack });
|
|
@@ -64776,7 +64804,10 @@ function generateDrawDefinition(params) {
|
|
|
64776
64804
|
// there is no need to attach to the drawDefinition
|
|
64777
64805
|
if (!equivalentInScope) {
|
|
64778
64806
|
if (tieFormat) {
|
|
64779
|
-
var result = checkTieFormat(
|
|
64807
|
+
var result = checkTieFormat({
|
|
64808
|
+
eventType: event.eventType,
|
|
64809
|
+
tieFormat: tieFormat,
|
|
64810
|
+
});
|
|
64780
64811
|
if (result.error)
|
|
64781
64812
|
return decorateResult({ result: result, stack: stack });
|
|
64782
64813
|
drawDefinition.tieFormat = (_13 = result.tieFormat) !== null && _13 !== void 0 ? _13 : tieFormat;
|
|
@@ -65203,15 +65234,16 @@ function aggregateTieFormats(_a) {
|
|
|
65203
65234
|
addedCount += 1;
|
|
65204
65235
|
}
|
|
65205
65236
|
};
|
|
65206
|
-
|
|
65237
|
+
var eventType = event_1.eventType;
|
|
65238
|
+
checkTieFormat({ tieFormat: event_1.tieFormat, eventType: eventType });
|
|
65207
65239
|
try {
|
|
65208
65240
|
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
65241
|
var drawDefinition = _q.value;
|
|
65210
|
-
checkTieFormat(drawDefinition);
|
|
65242
|
+
checkTieFormat({ tieFormat: drawDefinition.tieFormat, eventType: eventType });
|
|
65211
65243
|
try {
|
|
65212
65244
|
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
65245
|
var structure = _s.value;
|
|
65214
|
-
checkTieFormat(structure);
|
|
65246
|
+
checkTieFormat({ tieFormat: structure.tieFormat, eventType: eventType });
|
|
65215
65247
|
}
|
|
65216
65248
|
}
|
|
65217
65249
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|