tods-competition-factory 1.8.34 → 1.8.36
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 +26 -12
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +1 -2
- package/dist/forge/query.mjs.map +1 -1
- package/dist/index.mjs +91 -45
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +216 -150
- 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 +5 -5
|
@@ -2929,7 +2929,7 @@ var matchUpFormatCode = {
|
|
|
2929
2929
|
};
|
|
2930
2930
|
|
|
2931
2931
|
function factoryVersion() {
|
|
2932
|
-
return '1.8.
|
|
2932
|
+
return '1.8.36';
|
|
2933
2933
|
}
|
|
2934
2934
|
|
|
2935
2935
|
function getObjectTieFormat(obj) {
|
|
@@ -5628,14 +5628,14 @@ var ROUTINE = 'ROUTINE';
|
|
|
5628
5628
|
var DECISIVE = 'DECISIVE';
|
|
5629
5629
|
var WIN_RATIO$1 = 'winRatio';
|
|
5630
5630
|
|
|
5631
|
-
var _a$j, _b$
|
|
5631
|
+
var _a$j, _b$7;
|
|
5632
5632
|
var POLICY_COMPETITIVE_BANDS_DEFAULT = (_a$j = {},
|
|
5633
5633
|
_a$j[POLICY_TYPE_COMPETITIVE_BANDS] = {
|
|
5634
5634
|
policyName: 'Competitive Bands Default',
|
|
5635
|
-
profileBands: (_b$
|
|
5636
|
-
_b$
|
|
5637
|
-
_b$
|
|
5638
|
-
_b$
|
|
5635
|
+
profileBands: (_b$7 = {},
|
|
5636
|
+
_b$7[DECISIVE] = 20,
|
|
5637
|
+
_b$7[ROUTINE] = 50,
|
|
5638
|
+
_b$7),
|
|
5639
5639
|
},
|
|
5640
5640
|
_a$j);
|
|
5641
5641
|
|
|
@@ -7827,7 +7827,7 @@ function getMatchUpType(params) {
|
|
|
7827
7827
|
return { matchUpType: matchUpType };
|
|
7828
7828
|
}
|
|
7829
7829
|
|
|
7830
|
-
var _a$i, _b$
|
|
7830
|
+
var _a$i, _b$6, _c$1;
|
|
7831
7831
|
// stage types
|
|
7832
7832
|
var MAIN = 'MAIN';
|
|
7833
7833
|
var QUALIFYING = 'QUALIFYING';
|
|
@@ -7850,13 +7850,13 @@ var stageOrder$1 = (_a$i = {},
|
|
|
7850
7850
|
_a$i);
|
|
7851
7851
|
var FINISHING_POSITIONS = 'finishingPositions';
|
|
7852
7852
|
var AGGREGATE_EVENT_STRUCTURES = 'aggregateEventStructures';
|
|
7853
|
-
var finishOrder = (_b$
|
|
7854
|
-
_b$
|
|
7855
|
-
_b$
|
|
7856
|
-
_b$
|
|
7857
|
-
_b$
|
|
7858
|
-
_b$
|
|
7859
|
-
_b$
|
|
7853
|
+
var finishOrder = (_b$6 = {},
|
|
7854
|
+
_b$6[MAIN] = 1,
|
|
7855
|
+
_b$6[PLAY_OFF] = 2,
|
|
7856
|
+
_b$6[CONSOLATION] = 3,
|
|
7857
|
+
_b$6[QUALIFYING] = 4,
|
|
7858
|
+
_b$6[VOLUNTARY_CONSOLATION] = 5,
|
|
7859
|
+
_b$6);
|
|
7860
7860
|
// for aggregateOrder { stage: MAIN, stageSequence: 1 } is always first
|
|
7861
7861
|
var aggregateOrder = (_c$1 = {},
|
|
7862
7862
|
_c$1[PLAY_OFF] = 1,
|
|
@@ -9318,7 +9318,7 @@ function isAdHoc(_a) {
|
|
|
9318
9318
|
!hasDrawPosition);
|
|
9319
9319
|
}
|
|
9320
9320
|
|
|
9321
|
-
var _a$h, _b$
|
|
9321
|
+
var _a$h, _b$5;
|
|
9322
9322
|
var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
9323
9323
|
_a$h[POLICY_TYPE_ROUND_NAMING] = {
|
|
9324
9324
|
policyName: 'Round Naming Default',
|
|
@@ -9345,12 +9345,12 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
|
9345
9345
|
preFeedRound: 'Q',
|
|
9346
9346
|
preQualifying: 'P',
|
|
9347
9347
|
},
|
|
9348
|
-
stageConstants: (_b$
|
|
9349
|
-
_b$
|
|
9350
|
-
_b$
|
|
9351
|
-
_b$
|
|
9352
|
-
_b$
|
|
9353
|
-
_b$
|
|
9348
|
+
stageConstants: (_b$5 = {},
|
|
9349
|
+
_b$5[MAIN] = '',
|
|
9350
|
+
_b$5[PLAY_OFF] = 'P',
|
|
9351
|
+
_b$5[QUALIFYING] = 'Q',
|
|
9352
|
+
_b$5[CONSOLATION] = 'C',
|
|
9353
|
+
_b$5),
|
|
9354
9354
|
},
|
|
9355
9355
|
_a$h);
|
|
9356
9356
|
|
|
@@ -16851,7 +16851,7 @@ var POLICY_PRIVACY_DEFAULT = (_a$a = {},
|
|
|
16851
16851
|
},
|
|
16852
16852
|
_a$a);
|
|
16853
16853
|
|
|
16854
|
-
var _a$9, _b$
|
|
16854
|
+
var _a$9, _b$4, _c, _d, _e;
|
|
16855
16855
|
// categoryTypes
|
|
16856
16856
|
var ADULT = 'ADULT';
|
|
16857
16857
|
var JUNIOR = 'JUNIOR';
|
|
@@ -16863,7 +16863,7 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
|
|
|
16863
16863
|
_a$9[POLICY_TYPE_SCHEDULING] = {
|
|
16864
16864
|
defaultTimes: {
|
|
16865
16865
|
averageTimes: [{ categoryNames: [], minutes: { default: 90 } }],
|
|
16866
|
-
recoveryTimes: [{ minutes: (_b$
|
|
16866
|
+
recoveryTimes: [{ minutes: (_b$4 = {}, _b$4[DOUBLES$1] = 30, _b$4.default = 60, _b$4) }],
|
|
16867
16867
|
},
|
|
16868
16868
|
defaultDailyLimits: (_c = {},
|
|
16869
16869
|
_c[SINGLES$1] = 2,
|
|
@@ -17032,19 +17032,19 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
|
|
|
17032
17032
|
},
|
|
17033
17033
|
_a$9);
|
|
17034
17034
|
|
|
17035
|
-
var _a$8, _b$
|
|
17035
|
+
var _a$8, _b$3;
|
|
17036
17036
|
var POLICY_SCORING_USTA = (_a$8 = {},
|
|
17037
17037
|
_a$8[POLICY_TYPE_SCORING] = {
|
|
17038
17038
|
requireAllPositionsAssigned: false,
|
|
17039
|
-
stage: (_b$
|
|
17040
|
-
_b$
|
|
17039
|
+
stage: (_b$3 = {},
|
|
17040
|
+
_b$3[MAIN] = {
|
|
17041
17041
|
stageSequence: {
|
|
17042
17042
|
1: {
|
|
17043
17043
|
requireAllPositionsAssigned: true,
|
|
17044
17044
|
},
|
|
17045
17045
|
},
|
|
17046
17046
|
},
|
|
17047
|
-
_b$
|
|
17047
|
+
_b$3),
|
|
17048
17048
|
defaultMatchUpFormat: FORMAT_STANDARD,
|
|
17049
17049
|
matchUpFormats: [
|
|
17050
17050
|
{
|
|
@@ -17129,7 +17129,7 @@ var POLICY_SCORING_USTA = (_a$8 = {},
|
|
|
17129
17129
|
},
|
|
17130
17130
|
_a$8);
|
|
17131
17131
|
|
|
17132
|
-
var _a$7, _b$
|
|
17132
|
+
var _a$7, _b$2;
|
|
17133
17133
|
/**
|
|
17134
17134
|
* without a SCORING_POLICY which sets { requireAllPositionsAssigned: false }, all stage:MAIN, stageSequence:1 drawPositions must be assigned **BEFORE** scoring is enabled,
|
|
17135
17135
|
* scoring is enabled in consolation and compass/playoff structures when not all drawPositions have been filled
|
|
@@ -17141,15 +17141,15 @@ var POLICY_SCORING_DEFAULT = (_a$7 = {},
|
|
|
17141
17141
|
processCodes: {
|
|
17142
17142
|
incompleteAssignmentsOnDefault: ['RANKING.IGNORE'],
|
|
17143
17143
|
},
|
|
17144
|
-
stage: (_b$
|
|
17145
|
-
_b$
|
|
17144
|
+
stage: (_b$2 = {},
|
|
17145
|
+
_b$2[MAIN] = {
|
|
17146
17146
|
stageSequence: {
|
|
17147
17147
|
1: {
|
|
17148
17148
|
requireAllPositionsAssigned: true,
|
|
17149
17149
|
},
|
|
17150
17150
|
},
|
|
17151
17151
|
},
|
|
17152
|
-
_b$
|
|
17152
|
+
_b$2),
|
|
17153
17153
|
},
|
|
17154
17154
|
_a$7);
|
|
17155
17155
|
|
|
@@ -17172,13 +17172,19 @@ var POLICY_SEEDING_ITF = (_a$6 = {},
|
|
|
17172
17172
|
},
|
|
17173
17173
|
_a$6);
|
|
17174
17174
|
|
|
17175
|
-
var _a$5;
|
|
17175
|
+
var _a$5, _b$1;
|
|
17176
17176
|
var POLICY_SEEDING_USTA = (_a$5 = {},
|
|
17177
17177
|
_a$5[POLICY_TYPE_SEEDING] = {
|
|
17178
17178
|
validSeedPositions: { ignore: true },
|
|
17179
17179
|
duplicateSeedNumbers: true,
|
|
17180
17180
|
drawSizeProgression: true,
|
|
17181
|
-
seedingProfile: {
|
|
17181
|
+
seedingProfile: {
|
|
17182
|
+
drawTypes: (_b$1 = {},
|
|
17183
|
+
_b$1[ROUND_ROBIN_WITH_PLAYOFF] = { positioning: WATERFALL },
|
|
17184
|
+
_b$1[ROUND_ROBIN] = { positioning: WATERFALL },
|
|
17185
|
+
_b$1),
|
|
17186
|
+
positioning: SEPARATE,
|
|
17187
|
+
},
|
|
17182
17188
|
policyName: 'USTA SEEDING',
|
|
17183
17189
|
seedsCountThresholds: [
|
|
17184
17190
|
{ drawSize: 4, minimumParticipantCount: 3, seedsCount: 2 },
|
|
@@ -21675,6 +21681,23 @@ function tidyScore(params) {
|
|
|
21675
21681
|
};
|
|
21676
21682
|
}
|
|
21677
21683
|
|
|
21684
|
+
function capitalizeFirst(str) {
|
|
21685
|
+
return !isString(str)
|
|
21686
|
+
? str
|
|
21687
|
+
: str
|
|
21688
|
+
.split(' ')
|
|
21689
|
+
.map(function (name) {
|
|
21690
|
+
return name
|
|
21691
|
+
.split('')
|
|
21692
|
+
.map(function (c, i) { return (i ? c.toLowerCase() : c.toUpperCase()); })
|
|
21693
|
+
.join('');
|
|
21694
|
+
})
|
|
21695
|
+
.join(' ');
|
|
21696
|
+
}
|
|
21697
|
+
function constantToString(str) {
|
|
21698
|
+
return !isString(str) ? str : capitalizeFirst(str.replace(/_/g, ' '));
|
|
21699
|
+
}
|
|
21700
|
+
|
|
21678
21701
|
var FACTORY = extensionConstants.FACTORY;
|
|
21679
21702
|
function updateFactoryExtension(_a) {
|
|
21680
21703
|
var tournamentRecord = _a.tournamentRecord, value = _a.value;
|
|
@@ -25557,23 +25580,6 @@ function getNumericSeedValue(seedValue) {
|
|
|
25557
25580
|
return Infinity;
|
|
25558
25581
|
}
|
|
25559
25582
|
|
|
25560
|
-
function capitalizeFirst(str) {
|
|
25561
|
-
return !isString(str)
|
|
25562
|
-
? str
|
|
25563
|
-
: str
|
|
25564
|
-
.split(' ')
|
|
25565
|
-
.map(function (name) {
|
|
25566
|
-
return name
|
|
25567
|
-
.split('')
|
|
25568
|
-
.map(function (c, i) { return (i ? c.toLowerCase() : c.toUpperCase()); })
|
|
25569
|
-
.join('');
|
|
25570
|
-
})
|
|
25571
|
-
.join(' ');
|
|
25572
|
-
}
|
|
25573
|
-
function constantToString(str) {
|
|
25574
|
-
return !isString(str) ? str : capitalizeFirst(str.replace(/_/g, ' '));
|
|
25575
|
-
}
|
|
25576
|
-
|
|
25577
25583
|
var structureTemplate = function (_a) {
|
|
25578
25584
|
var _b = _a.finishingPosition, finishingPosition = _b === void 0 ? ROUND_OUTCOME : _b, qualifyingRoundNumber = _a.qualifyingRoundNumber, structureAbbreviation = _a.structureAbbreviation, _c = _a.seedAssignments, seedAssignments = _c === void 0 ? [] : _c, _d = _a.stageSequence, stageSequence = _d === void 0 ? 1 : _d, structureOrder = _a.structureOrder, seedingProfile = _a.seedingProfile, matchUpFormat = _a.matchUpFormat, structureType = _a.structureType, structureName = _a.structureName, matchUpType = _a.matchUpType, _e = _a.matchUps, matchUps = _e === void 0 ? [] : _e, structureId = _a.structureId, roundOffset = _a.roundOffset, roundLimit = _a.roundLimit, stageOrder = _a.stageOrder, structures = _a.structures, stage = _a.stage;
|
|
25579
25585
|
var structure = {
|
|
@@ -29701,14 +29707,10 @@ function getParticipantEntries(params) {
|
|
|
29701
29707
|
var getRelevantParticipantIds = function (participantId) {
|
|
29702
29708
|
var _a, _b;
|
|
29703
29709
|
var relevantParticipantIds = [participantId];
|
|
29704
|
-
relevantParticipantIds.push(participantId);
|
|
29705
29710
|
(_b = (_a = participantMap[participantId]) === null || _a === void 0 ? void 0 : _a.participant.individualParticipantIds) === null || _b === void 0 ? void 0 : _b.forEach(function (individualParticiapntId) {
|
|
29706
29711
|
return relevantParticipantIds.push(individualParticiapntId);
|
|
29707
29712
|
});
|
|
29708
|
-
return relevantParticipantIds.some(function (
|
|
29709
|
-
return !(targetParticipantIds === null || targetParticipantIds === void 0 ? void 0 : targetParticipantIds.length) ||
|
|
29710
|
-
targetParticipantIds.includes(obj.relevantParticipantId);
|
|
29711
|
-
})
|
|
29713
|
+
return relevantParticipantIds.some(function (id) { return !(targetParticipantIds === null || targetParticipantIds === void 0 ? void 0 : targetParticipantIds.length) || targetParticipantIds.includes(id); })
|
|
29712
29714
|
? relevantParticipantIds
|
|
29713
29715
|
: [];
|
|
29714
29716
|
};
|
|
@@ -45220,6 +45222,7 @@ function generatePositioningCandidate(params) {
|
|
|
45220
45222
|
};
|
|
45221
45223
|
}
|
|
45222
45224
|
function swapAssignedPositions(_a) {
|
|
45225
|
+
var _b;
|
|
45223
45226
|
var candidatePositionAssignments = _a.candidatePositionAssignments, swapOptions = _a.swapOptions;
|
|
45224
45227
|
var swapOption = randomPop(swapOptions);
|
|
45225
45228
|
if (!swapOption)
|
|
@@ -45227,11 +45230,11 @@ function swapAssignedPositions(_a) {
|
|
|
45227
45230
|
var firstPosition = swapOption.drawPosition;
|
|
45228
45231
|
var secondPosition = randomPop(swapOption.possibleDrawPositions);
|
|
45229
45232
|
var firstAssignment = candidatePositionAssignments.find(function (assignment) { return assignment.drawPosition === firstPosition; });
|
|
45230
|
-
var secondAssignment = candidatePositionAssignments.find(function (assignment) { return assignment.drawPosition === secondPosition; });
|
|
45233
|
+
var secondAssignment = (_b = candidatePositionAssignments.find(function (assignment) { return assignment.drawPosition === secondPosition; })) !== null && _b !== void 0 ? _b : {};
|
|
45231
45234
|
var updatedFirstAssignmentAttributes = {
|
|
45232
|
-
participantId: secondAssignment.participantId,
|
|
45233
|
-
qualifier: secondAssignment.qualifier,
|
|
45234
|
-
bye: secondAssignment.bye,
|
|
45235
|
+
participantId: secondAssignment === null || secondAssignment === void 0 ? void 0 : secondAssignment.participantId,
|
|
45236
|
+
qualifier: secondAssignment === null || secondAssignment === void 0 ? void 0 : secondAssignment.qualifier,
|
|
45237
|
+
bye: secondAssignment === null || secondAssignment === void 0 ? void 0 : secondAssignment.bye,
|
|
45235
45238
|
};
|
|
45236
45239
|
var updatedSecondAssignmentAttributes = {
|
|
45237
45240
|
participantId: firstAssignment.participantId,
|
|
@@ -45377,7 +45380,7 @@ function randomUnseededSeparation(_a) {
|
|
|
45377
45380
|
if (result.error)
|
|
45378
45381
|
return decorateResult({ result: result, stack: stack });
|
|
45379
45382
|
}
|
|
45380
|
-
else {
|
|
45383
|
+
else if (assignment.participantId) {
|
|
45381
45384
|
var result = assignDrawPosition$1(__assign({ automaticPlacement: true, inContextDrawMatchUps: inContextDrawMatchUps, tournamentRecord: tournamentRecord, drawDefinition: drawDefinition, seedBlockInfo: seedBlockInfo, structureId: structureId, matchUpsMap: matchUpsMap, event: event }, assignment));
|
|
45382
45385
|
if (result.error) {
|
|
45383
45386
|
return decorateResult({ result: result, stack: stack, context: { assignment: assignment } });
|
|
@@ -48129,7 +48132,9 @@ function removeStructure(_a) {
|
|
|
48129
48132
|
return link.source.structureId !== idBeingRemoved &&
|
|
48130
48133
|
link.target.structureId !== idBeingRemoved;
|
|
48131
48134
|
})) || [];
|
|
48132
|
-
if (!isMainStageSequence1 ||
|
|
48135
|
+
if (!isMainStageSequence1 ||
|
|
48136
|
+
(isMainStageSequence1 && qualifyingStructureIds.length) ||
|
|
48137
|
+
idBeingRemoved !== structureId) {
|
|
48133
48138
|
drawDefinition.structures = ((_c = drawDefinition.structures) !== null && _c !== void 0 ? _c : []).filter(function (structure) {
|
|
48134
48139
|
if (idBeingRemoved && idBeingRemoved === structure.structureId)
|
|
48135
48140
|
removedStructureIds.push(idBeingRemoved);
|
|
@@ -49588,9 +49593,6 @@ function removeEventEntries(_a) {
|
|
|
49588
49593
|
return __assign(__assign({}, SUCCESS), { participantIdsRemoved: participantIdsRemoved });
|
|
49589
49594
|
}
|
|
49590
49595
|
|
|
49591
|
-
/**
|
|
49592
|
-
* Add entries into an event; optionally add to specified drawDefinition/flightProfile, if possible.
|
|
49593
|
-
*/
|
|
49594
49596
|
function addEventEntries(params) {
|
|
49595
49597
|
var _a, _b, _c, _d, _e;
|
|
49596
49598
|
var _f = params.entryStatus, entryStatus = _f === void 0 ? DIRECT_ACCEPTANCE : _f, _g = params.autoEntryPositions, autoEntryPositions = _g === void 0 ? true : _g, _h = params.enforceGender, enforceGender = _h === void 0 ? true : _h, _j = params.participantIds, participantIds = _j === void 0 ? [] : _j, entryStageSequence = params.entryStageSequence, policyDefinitions = params.policyDefinitions, _k = params.entryStage, entryStage = _k === void 0 ? MAIN : _k, tournamentRecord = params.tournamentRecord, ignoreStageSpace = params.ignoreStageSpace, drawDefinition = params.drawDefinition, roundTarget = params.roundTarget, extensions = params.extensions, extension = params.extension, drawId = params.drawId, event = params.event;
|
|
@@ -49612,7 +49614,8 @@ function addEventEntries(params) {
|
|
|
49612
49614
|
var addedParticipantIdEntries = [];
|
|
49613
49615
|
var removedEntries = [];
|
|
49614
49616
|
if ((extensions &&
|
|
49615
|
-
(!Array.isArray(extensions) ||
|
|
49617
|
+
(!Array.isArray(extensions) ||
|
|
49618
|
+
!extensions.every(function (extension) { return isValidExtension({ extension: extension }); }))) ||
|
|
49616
49619
|
(extension && !isValidExtension({ extension: extension }))) {
|
|
49617
49620
|
return decorateResult({
|
|
49618
49621
|
context: definedAttributes({ extension: extension, extensions: extensions }),
|
|
@@ -49689,7 +49692,7 @@ function addEventEntries(params) {
|
|
|
49689
49692
|
if (entryStageSequence)
|
|
49690
49693
|
entry.entryStageSequence = entryStageSequence;
|
|
49691
49694
|
addedParticipantIdEntries.push(entry.participantId);
|
|
49692
|
-
event.entries.push(entry);
|
|
49695
|
+
event.entries && event.entries.push(entry);
|
|
49693
49696
|
}
|
|
49694
49697
|
});
|
|
49695
49698
|
if (drawId && !isUngrouped(entryStage)) {
|
|
@@ -49713,7 +49716,8 @@ function addEventEntries(params) {
|
|
|
49713
49716
|
}
|
|
49714
49717
|
}
|
|
49715
49718
|
// now remove any ungrouped participantIds which exist as part of added grouped participants
|
|
49716
|
-
if (
|
|
49719
|
+
if (event.eventType &&
|
|
49720
|
+
[TypeEnum.Doubles, TypeEnum.Team].includes(event.eventType)) {
|
|
49717
49721
|
var enteredParticipantIds_1 = (event.entries || []).map(function (entry) { return entry.participantId; });
|
|
49718
49722
|
var ungroupedIndividualParticipantIds = (event.entries || [])
|
|
49719
49723
|
.filter(function (entry) { return isUngrouped(entry.entryStatus); })
|
|
@@ -49722,6 +49726,7 @@ function addEventEntries(params) {
|
|
|
49722
49726
|
var groupedIndividualParticipantIds_1 = tournamentParticipants
|
|
49723
49727
|
.filter(function (participant) {
|
|
49724
49728
|
return enteredParticipantIds_1.includes(participant.participantId) &&
|
|
49729
|
+
participant.participantType &&
|
|
49725
49730
|
[PAIR, TEAM].includes(participant.participantType);
|
|
49726
49731
|
})
|
|
49727
49732
|
.map(function (participant) { return participant.individualParticipantIds; })
|
|
@@ -61080,7 +61085,7 @@ function getPositionAssignments(_a) {
|
|
|
61080
61085
|
function deleteDrawDefinitions(_a) {
|
|
61081
61086
|
var e_1, _b;
|
|
61082
61087
|
var _c, _d, _e;
|
|
61083
|
-
var _f = _a.autoPublish, autoPublish = _f === void 0 ? true : _f, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, _g = _a.drawIds, drawIds = _g === void 0 ? [] : _g, auditData = _a.auditData, eventId = _a.eventId, event = _a.event;
|
|
61088
|
+
var _f = _a.autoPublish, autoPublish = _f === void 0 ? true : _f, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, _g = _a.drawIds, drawIds = _g === void 0 ? [] : _g, auditData = _a.auditData, eventId = _a.eventId, event = _a.event, force = _a.force;
|
|
61084
61089
|
if (!tournamentRecord)
|
|
61085
61090
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
61086
61091
|
var stack = 'deleteDrawDefinitions';
|
|
@@ -61123,21 +61128,31 @@ function deleteDrawDefinitions(_a) {
|
|
|
61123
61128
|
var participantId = _a.participantId, drawPosition = _a.drawPosition, qualifier = _a.qualifier, bye = _a.bye;
|
|
61124
61129
|
return ({ bye: bye, qualifier: qualifier, drawPosition: drawPosition, participantId: participantId });
|
|
61125
61130
|
};
|
|
61131
|
+
var drawIdsWithScoresPresent = [];
|
|
61126
61132
|
var filteredDrawDefinitions = event.drawDefinitions.filter(function (drawDefinition) {
|
|
61127
|
-
var _a, _b, _c, _d, _e, _f;
|
|
61133
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
61128
61134
|
if (drawIds.includes(drawDefinition.drawId)) {
|
|
61135
|
+
var matchUps = (_b = (_a = allDrawMatchUps$1({ event: event, drawDefinition: drawDefinition })) === null || _a === void 0 ? void 0 : _a.matchUps) !== null && _b !== void 0 ? _b : [];
|
|
61136
|
+
var scoresPresent = matchUps.some(function (_a) {
|
|
61137
|
+
var score = _a.score;
|
|
61138
|
+
return scoreHasValue({ score: score });
|
|
61139
|
+
});
|
|
61140
|
+
if (scoresPresent && !force) {
|
|
61141
|
+
drawIdsWithScoresPresent.push(drawDefinition.drawId);
|
|
61142
|
+
return true;
|
|
61143
|
+
}
|
|
61129
61144
|
var drawId_1 = drawDefinition.drawId, drawType = drawDefinition.drawType, drawName = drawDefinition.drawName;
|
|
61130
|
-
var flight = (
|
|
61145
|
+
var flight = (_c = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _c === void 0 ? void 0 : _c.find(function (flight) { return flight.drawId === drawDefinition.drawId; });
|
|
61131
61146
|
if (flight) {
|
|
61132
|
-
flight.drawEntries = (
|
|
61147
|
+
flight.drawEntries = (_d = flight.drawEntries) === null || _d === void 0 ? void 0 : _d.filter(function (entry) {
|
|
61133
61148
|
return STRUCTURE_ENTERED_TYPES.includes(entry.entryStatus);
|
|
61134
61149
|
});
|
|
61135
61150
|
}
|
|
61136
|
-
var mainStructure = (
|
|
61151
|
+
var mainStructure = (_f = (_e = getDrawStructures({
|
|
61137
61152
|
stageSequence: 1,
|
|
61138
61153
|
drawDefinition: drawDefinition,
|
|
61139
61154
|
stage: MAIN,
|
|
61140
|
-
})) === null ||
|
|
61155
|
+
})) === null || _e === void 0 ? void 0 : _e.structures) === null || _f === void 0 ? void 0 : _f[0];
|
|
61141
61156
|
var pa = mainStructure
|
|
61142
61157
|
? getPositionAssignments({
|
|
61143
61158
|
structureId: mainStructure.structureId,
|
|
@@ -61145,11 +61160,11 @@ function deleteDrawDefinitions(_a) {
|
|
|
61145
61160
|
drawDefinition: drawDefinition,
|
|
61146
61161
|
})
|
|
61147
61162
|
: undefined;
|
|
61148
|
-
var positionAssignments = (
|
|
61149
|
-
var qualifyingStructures = (
|
|
61163
|
+
var positionAssignments = (_g = pa === null || pa === void 0 ? void 0 : pa.positionAssignments) === null || _g === void 0 ? void 0 : _g.map(positionAssignmentMap);
|
|
61164
|
+
var qualifyingStructures = (_h = getDrawStructures({
|
|
61150
61165
|
stage: QUALIFYING,
|
|
61151
61166
|
drawDefinition: drawDefinition,
|
|
61152
|
-
})) === null ||
|
|
61167
|
+
})) === null || _h === void 0 ? void 0 : _h.structures;
|
|
61153
61168
|
var qualifyingPositionAssignments = (qualifyingStructures === null || qualifyingStructures === void 0 ? void 0 : qualifyingStructures.length)
|
|
61154
61169
|
? qualifyingStructures.map(function (qualifyingStructure) {
|
|
61155
61170
|
var stageSequence = qualifyingStructure.stageSequence;
|
|
@@ -61181,7 +61196,6 @@ function deleteDrawDefinitions(_a) {
|
|
|
61181
61196
|
drawName: drawName,
|
|
61182
61197
|
drawId: drawId_1,
|
|
61183
61198
|
}));
|
|
61184
|
-
var matchUps = allDrawMatchUps$1({ event: event, drawDefinition: drawDefinition }).matchUps;
|
|
61185
61199
|
matchUps === null || matchUps === void 0 ? void 0 : matchUps.forEach(function (_a) {
|
|
61186
61200
|
var matchUpId = _a.matchUpId;
|
|
61187
61201
|
return matchUpIds.push(matchUpId);
|
|
@@ -61189,6 +61203,13 @@ function deleteDrawDefinitions(_a) {
|
|
|
61189
61203
|
}
|
|
61190
61204
|
return !drawIds.includes(drawDefinition.drawId);
|
|
61191
61205
|
});
|
|
61206
|
+
if (drawIdsWithScoresPresent.length && !force) {
|
|
61207
|
+
return decorateResult({
|
|
61208
|
+
context: { drawIdsWithScoresPresent: drawIdsWithScoresPresent },
|
|
61209
|
+
result: { error: SCORES_PRESENT },
|
|
61210
|
+
stack: stack,
|
|
61211
|
+
});
|
|
61212
|
+
}
|
|
61192
61213
|
event.drawDefinitions = filteredDrawDefinitions;
|
|
61193
61214
|
if (flightProfile) {
|
|
61194
61215
|
var extension = {
|
|
@@ -61397,30 +61418,63 @@ function assignDrawPosition(_a) {
|
|
|
61397
61418
|
}
|
|
61398
61419
|
|
|
61399
61420
|
function addEventEntryPairs(_a) {
|
|
61400
|
-
var _b;
|
|
61401
|
-
var
|
|
61421
|
+
var e_1, _b;
|
|
61422
|
+
var _c;
|
|
61423
|
+
var allowDuplicateParticipantIdPairs = _a.allowDuplicateParticipantIdPairs, _d = _a.entryStage, entryStage = _d === void 0 ? StageTypeEnum.Main : _d, _e = _a.entryStatus, entryStatus = _e === void 0 ? ALTERNATE : _e, _f = _a.participantIdPairs, participantIdPairs = _f === void 0 ? [] : _f, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, event = _a.event, uuids = _a.uuids;
|
|
61402
61424
|
if (!tournamentRecord)
|
|
61403
61425
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
61404
61426
|
if (!event)
|
|
61405
61427
|
return { error: MISSING_EVENT };
|
|
61406
61428
|
if (event.eventType !== DOUBLES$1)
|
|
61407
61429
|
return { error: INVALID_EVENT_TYPE };
|
|
61408
|
-
var
|
|
61409
|
-
var
|
|
61410
|
-
|
|
61411
|
-
|
|
61412
|
-
|
|
61413
|
-
|
|
61414
|
-
|
|
61415
|
-
|
|
61430
|
+
var existingParticipantIdPairs = [];
|
|
61431
|
+
var genderMap = new Map();
|
|
61432
|
+
try {
|
|
61433
|
+
for (var _g = __values((_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : []), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
61434
|
+
var participant = _h.value;
|
|
61435
|
+
var participantType = participant.participantType, participantId = participant.participantId, person = participant.person, individualParticipantIds = participant.individualParticipantIds;
|
|
61436
|
+
if (participantType === INDIVIDUAL && (person === null || person === void 0 ? void 0 : person.sex)) {
|
|
61437
|
+
genderMap.set(participantId, person.sex);
|
|
61438
|
+
}
|
|
61439
|
+
else if (participantType === PAIR && individualParticipantIds) {
|
|
61440
|
+
existingParticipantIdPairs.push(individualParticipantIds);
|
|
61441
|
+
}
|
|
61442
|
+
}
|
|
61443
|
+
}
|
|
61444
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61445
|
+
finally {
|
|
61446
|
+
try {
|
|
61447
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
61448
|
+
}
|
|
61449
|
+
finally { if (e_1) throw e_1.error; }
|
|
61450
|
+
}
|
|
61416
61451
|
// ensure all participantIdPairs have two individual participantIds
|
|
61417
|
-
var invalidParticipantIdPairs = participantIdPairs.filter(function (pair) {
|
|
61452
|
+
var invalidParticipantIdPairs = participantIdPairs.filter(function (pair) {
|
|
61453
|
+
// invalid if not two participantIds
|
|
61454
|
+
if (pair.length !== 2)
|
|
61455
|
+
return true;
|
|
61456
|
+
// invalid if either participantId does not exist
|
|
61457
|
+
if (!genderMap.has(pair[0]) || !genderMap.has(pair[1]))
|
|
61458
|
+
return true;
|
|
61459
|
+
// NOT invalid if event.gender is ANY or no gender is specified
|
|
61460
|
+
if (!event.gender || event.gender === ANY)
|
|
61461
|
+
return false;
|
|
61462
|
+
var participantGenders = pair.map(function (id) { return genderMap.get(id); });
|
|
61463
|
+
// invalid if event.gender is MALE/FEMALE and both participants do not match
|
|
61464
|
+
var invalidParticiapntGenders = (event.gender === MALE &&
|
|
61465
|
+
(participantGenders[0] !== MALE || participantGenders[1] !== MALE)) ||
|
|
61466
|
+
(event.gender === FEMALE &&
|
|
61467
|
+
(participantGenders[0] !== FEMALE || participantGenders[1] !== FEMALE));
|
|
61468
|
+
// invalid if event.gender is MIXED and participant genders are not different
|
|
61469
|
+
if (event.gender === MIXED) {
|
|
61470
|
+
participantGenders.sort();
|
|
61471
|
+
if (participantGenders[0] !== FEMALE || participantGenders[1] !== MALE)
|
|
61472
|
+
invalidParticiapntGenders = true;
|
|
61473
|
+
}
|
|
61474
|
+
return invalidParticiapntGenders;
|
|
61475
|
+
});
|
|
61418
61476
|
if (invalidParticipantIdPairs.length)
|
|
61419
61477
|
return { error: INVALID_PARTICIPANT_IDS, invalidParticipantIdPairs: invalidParticipantIdPairs };
|
|
61420
|
-
// make an array of all existing PAIR participantIds
|
|
61421
|
-
var existingParticipantIdPairs = tournamentParticipants
|
|
61422
|
-
.filter(function (participant) { return participant.participantType === PAIR; })
|
|
61423
|
-
.map(function (participant) { return participant.individualParticipantIds; });
|
|
61424
61478
|
// create provisional participant objects
|
|
61425
61479
|
var provisionalParticipants = participantIdPairs.map(function (individualParticipantIds) {
|
|
61426
61480
|
var _a;
|
|
@@ -64396,43 +64450,53 @@ function prepareStage(params) {
|
|
|
64396
64450
|
|
|
64397
64451
|
function generateDrawDefinition(params) {
|
|
64398
64452
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, _e, e_5, _f, e_6, _g, _h;
|
|
64399
|
-
var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
|
|
64453
|
+
var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33;
|
|
64400
64454
|
var stack = 'generateDrawDefinition';
|
|
64401
|
-
var
|
|
64402
|
-
ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections,
|
|
64455
|
+
var _34 = params.considerEventEntries, considerEventEntries = _34 === void 0 ? true : _34, // in the absence of drawSize and drawEntries, look to event.entries
|
|
64456
|
+
ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections, ignoreStageSpace = params.ignoreStageSpace, tournamentRecord = params.tournamentRecord, qualifyingOnly = params.qualifyingOnly, tieFormatName = params.tieFormatName, drawEntries = params.drawEntries, addToEvent = params.addToEvent, placeByes = params.placeByes, event = params.event;
|
|
64403
64457
|
var appliedPolicies = (_j = getAppliedPolicies({
|
|
64404
64458
|
tournamentRecord: tournamentRecord,
|
|
64405
64459
|
event: event,
|
|
64406
64460
|
}).appliedPolicies) !== null && _j !== void 0 ? _j : {};
|
|
64407
|
-
var
|
|
64461
|
+
var policyDefinitions = (_k = params.policyDefinitions) !== null && _k !== void 0 ? _k : {};
|
|
64462
|
+
var drawTypeCoercion = (_q = (_o = (_l = params.drawTypeCoercion) !== null && _l !== void 0 ? _l : (_m = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_DRAWS]) === null || _m === void 0 ? void 0 : _m.drawTypeCoercion) !== null && _o !== void 0 ? _o : (_p = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_DRAWS]) === null || _p === void 0 ? void 0 : _p.drawTypeCoercion) !== null && _q !== void 0 ? _q : true;
|
|
64408
64463
|
var drawType = (drawTypeCoercion &&
|
|
64409
64464
|
params.drawSize === 2 &&
|
|
64410
64465
|
DrawTypeEnum.SingleElimination) ||
|
|
64411
64466
|
params.drawType ||
|
|
64412
64467
|
DrawTypeEnum.SingleElimination;
|
|
64468
|
+
var seedingPolicy = (_r = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_SEEDING]) !== null && _r !== void 0 ? _r : appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SEEDING];
|
|
64469
|
+
var seedingProfile = (_v = (_s = params.seedingProfile) !== null && _s !== void 0 ? _s : (_u = (_t = seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile) === null || _t === void 0 ? void 0 : _t.drawTypes) === null || _u === void 0 ? void 0 : _u[drawType]) !== null && _v !== void 0 ? _v : seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile;
|
|
64470
|
+
// extend policyDefinitions only if a seedingProfile was specified in params
|
|
64471
|
+
if (params.seedingProfile) {
|
|
64472
|
+
if (!policyDefinitions[POLICY_TYPE_SEEDING]) {
|
|
64473
|
+
policyDefinitions[POLICY_TYPE_SEEDING] = __assign({}, POLICY_SEEDING_USTA[POLICY_TYPE_SEEDING]);
|
|
64474
|
+
}
|
|
64475
|
+
policyDefinitions[POLICY_TYPE_SEEDING].seedingProfile = seedingProfile;
|
|
64476
|
+
}
|
|
64413
64477
|
// get participants both for entry validation and for automated placement
|
|
64414
64478
|
// automated placement requires them to be "inContext" for avoidance policies to work
|
|
64415
|
-
var
|
|
64479
|
+
var _35 = getParticipants$1({
|
|
64416
64480
|
withIndividualParticipants: true,
|
|
64417
64481
|
tournamentRecord: tournamentRecord,
|
|
64418
|
-
}), participants =
|
|
64419
|
-
var enforceGender = (
|
|
64482
|
+
}), participants = _35.participants, participantMap = _35.participantMap;
|
|
64483
|
+
var enforceGender = (_z = (_w = params.enforceGender) !== null && _w !== void 0 ? _w : (_y = (_x = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _x === void 0 ? void 0 : _x.participants) === null || _y === void 0 ? void 0 : _y.enforceGender) !== null && _z !== void 0 ? _z : (_1 = (_0 = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _0 === void 0 ? void 0 : _0.participants) === null || _1 === void 0 ? void 0 : _1.enforceGender;
|
|
64420
64484
|
// if tournamentRecord is provided, and unless instructed to ignore valid types,
|
|
64421
64485
|
// check for restrictions on allowed drawTypes
|
|
64422
64486
|
var allowedDrawTypes = !ignoreAllowedDrawTypes &&
|
|
64423
64487
|
tournamentRecord &&
|
|
64424
64488
|
getAllowedDrawTypes({
|
|
64425
64489
|
tournamentRecord: tournamentRecord,
|
|
64426
|
-
categoryType: (
|
|
64427
|
-
categoryName: (
|
|
64490
|
+
categoryType: (_2 = event === null || event === void 0 ? void 0 : event.category) === null || _2 === void 0 ? void 0 : _2.categoryType,
|
|
64491
|
+
categoryName: (_3 = event === null || event === void 0 ? void 0 : event.category) === null || _3 === void 0 ? void 0 : _3.categoryName,
|
|
64428
64492
|
});
|
|
64429
64493
|
if ((allowedDrawTypes === null || allowedDrawTypes === void 0 ? void 0 : allowedDrawTypes.length) && !allowedDrawTypes.includes(drawType)) {
|
|
64430
64494
|
return decorateResult({ result: { error: INVALID_DRAW_TYPE }, stack: stack });
|
|
64431
64495
|
}
|
|
64432
|
-
var eventEntries = (
|
|
64496
|
+
var eventEntries = (_5 = (_4 = event === null || event === void 0 ? void 0 : event.entries) === null || _4 === void 0 ? void 0 : _4.filter(function (entry) {
|
|
64433
64497
|
return entry.entryStatus &&
|
|
64434
64498
|
__spreadArray(__spreadArray([], __read(STRUCTURE_ENTERED_TYPES), false), [QUALIFIER], false).includes(entry.entryStatus);
|
|
64435
|
-
})) !== null &&
|
|
64499
|
+
})) !== null && _5 !== void 0 ? _5 : [];
|
|
64436
64500
|
var consideredEntries = ((qualifyingOnly && []) ||
|
|
64437
64501
|
drawEntries ||
|
|
64438
64502
|
(considerEventEntries ? eventEntries : [])).filter(function (_a) {
|
|
@@ -64476,12 +64540,12 @@ function generateDrawDefinition(params) {
|
|
|
64476
64540
|
});
|
|
64477
64541
|
}
|
|
64478
64542
|
var seedsCount = typeof params.seedsCount !== 'number'
|
|
64479
|
-
? ensureInt((
|
|
64480
|
-
: (
|
|
64543
|
+
? ensureInt((_6 = params.seedsCount) !== null && _6 !== void 0 ? _6 : 0)
|
|
64544
|
+
: (_7 = params.seedsCount) !== null && _7 !== void 0 ? _7 : 0;
|
|
64481
64545
|
var eventType = event === null || event === void 0 ? void 0 : event.eventType;
|
|
64482
|
-
var matchUpType = (
|
|
64546
|
+
var matchUpType = (_8 = params.matchUpType) !== null && _8 !== void 0 ? _8 : eventType;
|
|
64483
64547
|
var existingDrawDefinition = params.drawId
|
|
64484
|
-
? (
|
|
64548
|
+
? (_9 = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _9 === void 0 ? void 0 : _9.find(function (d) { return d.drawId === params.drawId; })
|
|
64485
64549
|
: undefined;
|
|
64486
64550
|
// drawDefinition cannot have both tieFormat and matchUpFormat
|
|
64487
64551
|
var tieFormat = params.tieFormat, matchUpFormat = params.matchUpFormat;
|
|
@@ -64489,16 +64553,16 @@ function generateDrawDefinition(params) {
|
|
|
64489
64553
|
if (matchUpType === TEAM$2 && eventType === TEAM$2) {
|
|
64490
64554
|
// if there is an existingDrawDefinition which has a tieFormat on MAIN structure
|
|
64491
64555
|
// use this tieFormat ONLY when no tieFormat is specified in params
|
|
64492
|
-
var existingMainTieFormat = (
|
|
64556
|
+
var existingMainTieFormat = (_11 = (_10 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _10 === void 0 ? void 0 : _10.find(function (_a) {
|
|
64493
64557
|
var stage = _a.stage;
|
|
64494
64558
|
return stage === MAIN;
|
|
64495
|
-
})) === null ||
|
|
64559
|
+
})) === null || _11 === void 0 ? void 0 : _11.tieFormat;
|
|
64496
64560
|
tieFormat =
|
|
64497
64561
|
tieFormat ||
|
|
64498
64562
|
existingMainTieFormat ||
|
|
64499
64563
|
// if tieFormatName is provided and it matches the name of the tieFormat attached to parent event...
|
|
64500
64564
|
(tieFormatName &&
|
|
64501
|
-
((
|
|
64565
|
+
((_12 = event === null || event === void 0 ? void 0 : event.tieFormat) === null || _12 === void 0 ? void 0 : _12.tieFormatName) === tieFormatName &&
|
|
64502
64566
|
event.tieFormat) ||
|
|
64503
64567
|
// if the tieFormatName is not found in the factory then will use default
|
|
64504
64568
|
(tieFormatName &&
|
|
@@ -64554,7 +64618,7 @@ function generateDrawDefinition(params) {
|
|
|
64554
64618
|
var result = checkTieFormat(tieFormat);
|
|
64555
64619
|
if (result.error)
|
|
64556
64620
|
return decorateResult({ result: result, stack: stack });
|
|
64557
|
-
drawDefinition.tieFormat = (
|
|
64621
|
+
drawDefinition.tieFormat = (_13 = result.tieFormat) !== null && _13 !== void 0 ? _13 : tieFormat;
|
|
64558
64622
|
}
|
|
64559
64623
|
else if (matchUpFormat) {
|
|
64560
64624
|
var result = setMatchUpFormat$1({
|
|
@@ -64585,8 +64649,8 @@ function generateDrawDefinition(params) {
|
|
|
64585
64649
|
else {
|
|
64586
64650
|
var policiesToAttach = {};
|
|
64587
64651
|
try {
|
|
64588
|
-
for (var
|
|
64589
|
-
var key =
|
|
64652
|
+
for (var _36 = __values(Object.keys(policyDefinitions)), _37 = _36.next(); !_37.done; _37 = _36.next()) {
|
|
64653
|
+
var key = _37.value;
|
|
64590
64654
|
if (JSON.stringify(appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[key]) !==
|
|
64591
64655
|
JSON.stringify(policyDefinitions[key])) {
|
|
64592
64656
|
policiesToAttach[key] = policyDefinitions[key];
|
|
@@ -64596,7 +64660,7 @@ function generateDrawDefinition(params) {
|
|
|
64596
64660
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
64597
64661
|
finally {
|
|
64598
64662
|
try {
|
|
64599
|
-
if (
|
|
64663
|
+
if (_37 && !_37.done && (_a = _36.return)) _a.call(_36);
|
|
64600
64664
|
}
|
|
64601
64665
|
finally { if (e_1) throw e_1.error; }
|
|
64602
64666
|
}
|
|
@@ -64607,24 +64671,25 @@ function generateDrawDefinition(params) {
|
|
|
64607
64671
|
}
|
|
64608
64672
|
}
|
|
64609
64673
|
}
|
|
64610
|
-
if (!appliedPolicies[POLICY_TYPE_SEEDING]
|
|
64674
|
+
if (!appliedPolicies[POLICY_TYPE_SEEDING] &&
|
|
64675
|
+
!policyDefinitions[POLICY_TYPE_SEEDING]) {
|
|
64611
64676
|
attachPolicies({ drawDefinition: drawDefinition, policyDefinitions: POLICY_SEEDING_USTA });
|
|
64612
64677
|
Object.assign(appliedPolicies, POLICY_SEEDING_USTA);
|
|
64613
64678
|
}
|
|
64614
64679
|
// find existing MAIN structureId if existingDrawDefinition
|
|
64615
|
-
var structureId = (
|
|
64680
|
+
var structureId = (_15 = (_14 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _14 === void 0 ? void 0 : _14.find(function (structure) { return structure.stage === MAIN && structure.stageSequence === 1; })) === null || _15 === void 0 ? void 0 : _15.structureId;
|
|
64616
64681
|
var entries = drawEntries !== null && drawEntries !== void 0 ? drawEntries : eventEntries;
|
|
64617
64682
|
var positioningReports = [];
|
|
64618
64683
|
var drawTypeResult;
|
|
64619
64684
|
var conflicts = [];
|
|
64620
64685
|
var generateQualifyingPlaceholder = params.qualifyingPlaceholder &&
|
|
64621
|
-
!((
|
|
64686
|
+
!((_16 = params.qualifyingProfiles) === null || _16 === void 0 ? void 0 : _16.length) &&
|
|
64622
64687
|
!existingDrawDefinition;
|
|
64623
64688
|
var existingQualifyingStructures = existingDrawDefinition
|
|
64624
|
-
? (
|
|
64689
|
+
? (_17 = existingDrawDefinition.structures) === null || _17 === void 0 ? void 0 : _17.filter(function (structure) { return structure.stage === QUALIFYING; })
|
|
64625
64690
|
: [];
|
|
64626
64691
|
var existingQualifyingPlaceholderStructureId = (existingQualifyingStructures === null || existingQualifyingStructures === void 0 ? void 0 : existingQualifyingStructures.length) === 1 &&
|
|
64627
|
-
!((
|
|
64692
|
+
!((_18 = existingQualifyingStructures[0].matchUps) === null || _18 === void 0 ? void 0 : _18.length) &&
|
|
64628
64693
|
existingQualifyingStructures[0].structureId;
|
|
64629
64694
|
if (existingQualifyingPlaceholderStructureId) {
|
|
64630
64695
|
var qualifyingProfiles = params.qualifyingProfiles;
|
|
@@ -64640,24 +64705,24 @@ function generateDrawDefinition(params) {
|
|
|
64640
64705
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.error) {
|
|
64641
64706
|
return qualifyingResult;
|
|
64642
64707
|
}
|
|
64643
|
-
drawDefinition.structures = (
|
|
64708
|
+
drawDefinition.structures = (_19 = drawDefinition.structures) === null || _19 === void 0 ? void 0 : _19.filter(function (_a) {
|
|
64644
64709
|
var structureId = _a.structureId;
|
|
64645
64710
|
return structureId !== existingQualifyingPlaceholderStructureId;
|
|
64646
64711
|
});
|
|
64647
|
-
drawDefinition.links = (
|
|
64712
|
+
drawDefinition.links = (_20 = drawDefinition.links) === null || _20 === void 0 ? void 0 : _20.filter(function (_a) {
|
|
64648
64713
|
var source = _a.source;
|
|
64649
64714
|
return source.structureId !== existingQualifyingPlaceholderStructureId;
|
|
64650
64715
|
});
|
|
64651
|
-
var
|
|
64716
|
+
var _38 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _38.qualifiersCount, qualifyingDrawPositionsCount = _38.qualifyingDrawPositionsCount, qualifyingDetails = _38.qualifyingDetails;
|
|
64652
64717
|
if (qualifyingDrawPositionsCount) {
|
|
64653
64718
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.structures) {
|
|
64654
|
-
(
|
|
64719
|
+
(_21 = drawDefinition.structures) === null || _21 === void 0 ? void 0 : _21.push.apply(_21, __spreadArray([], __read(qualifyingResult.structures), false));
|
|
64655
64720
|
}
|
|
64656
64721
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.links) {
|
|
64657
|
-
(
|
|
64722
|
+
(_22 = drawDefinition.links) === null || _22 === void 0 ? void 0 : _22.push.apply(_22, __spreadArray([], __read(qualifyingResult.links), false));
|
|
64658
64723
|
}
|
|
64659
64724
|
}
|
|
64660
|
-
var mainStructure = (
|
|
64725
|
+
var mainStructure = (_23 = drawDefinition.structures) === null || _23 === void 0 ? void 0 : _23.find(function (_a) {
|
|
64661
64726
|
var stage = _a.stage, stageSequence = _a.stageSequence;
|
|
64662
64727
|
return stage === MAIN && stageSequence === 1;
|
|
64663
64728
|
});
|
|
@@ -64683,12 +64748,12 @@ function generateDrawDefinition(params) {
|
|
|
64683
64748
|
if (result.error)
|
|
64684
64749
|
return result;
|
|
64685
64750
|
try {
|
|
64686
|
-
for (var
|
|
64751
|
+
for (var _39 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
|
|
64687
64752
|
var entryStage = _a.entryStage;
|
|
64688
64753
|
return entryStage === StageTypeEnum.Qualifying;
|
|
64689
|
-
})),
|
|
64690
|
-
var entry =
|
|
64691
|
-
var entryData = __assign(__assign({}, entry), { entryStage: (
|
|
64754
|
+
})), _40 = _39.next(); !_40.done; _40 = _39.next()) {
|
|
64755
|
+
var entry = _40.value;
|
|
64756
|
+
var entryData = __assign(__assign({}, entry), { entryStage: (_24 = entry.entryStage) !== null && _24 !== void 0 ? _24 : StageTypeEnum.Main, drawDefinition: drawDefinition });
|
|
64692
64757
|
// ignore errors (EXITING_PARTICIPANT)
|
|
64693
64758
|
addDrawEntry(entryData);
|
|
64694
64759
|
}
|
|
@@ -64696,23 +64761,23 @@ function generateDrawDefinition(params) {
|
|
|
64696
64761
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
64697
64762
|
finally {
|
|
64698
64763
|
try {
|
|
64699
|
-
if (
|
|
64764
|
+
if (_40 && !_40.done && (_b = _39.return)) _b.call(_39);
|
|
64700
64765
|
}
|
|
64701
64766
|
finally { if (e_2) throw e_2.error; }
|
|
64702
64767
|
}
|
|
64703
64768
|
try {
|
|
64704
|
-
for (var
|
|
64705
|
-
var qualifyingDetail =
|
|
64769
|
+
for (var _41 = __values(qualifyingDetails || []), _42 = _41.next(); !_42.done; _42 = _41.next()) {
|
|
64770
|
+
var qualifyingDetail = _42.value;
|
|
64706
64771
|
var qualifyingRoundNumber = qualifyingDetail.finalQualifyingRoundNumber, qualifyingStructureId = qualifyingDetail.finalQualifyingStructureId, targetEntryRound = qualifyingDetail.roundTarget, finishingPositions = qualifyingDetail.finishingPositions, linkType = qualifyingDetail.linkType;
|
|
64707
64772
|
var link = mainStructure &&
|
|
64708
|
-
((
|
|
64773
|
+
((_25 = generateQualifyingLink({
|
|
64709
64774
|
targetStructureId: mainStructure.structureId,
|
|
64710
64775
|
sourceStructureId: qualifyingStructureId,
|
|
64711
64776
|
sourceRoundNumber: qualifyingRoundNumber,
|
|
64712
64777
|
finishingPositions: finishingPositions,
|
|
64713
64778
|
targetEntryRound: targetEntryRound,
|
|
64714
64779
|
linkType: linkType,
|
|
64715
|
-
})) === null ||
|
|
64780
|
+
})) === null || _25 === void 0 ? void 0 : _25.link);
|
|
64716
64781
|
if (link === null || link === void 0 ? void 0 : link.error)
|
|
64717
64782
|
return link;
|
|
64718
64783
|
if (link) {
|
|
@@ -64725,7 +64790,7 @@ function generateDrawDefinition(params) {
|
|
|
64725
64790
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
64726
64791
|
finally {
|
|
64727
64792
|
try {
|
|
64728
|
-
if (
|
|
64793
|
+
if (_42 && !_42.done && (_c = _41.return)) _c.call(_41);
|
|
64729
64794
|
}
|
|
64730
64795
|
finally { if (e_3) throw e_3.error; }
|
|
64731
64796
|
}
|
|
@@ -64746,7 +64811,7 @@ function generateDrawDefinition(params) {
|
|
|
64746
64811
|
entry.entryStage &&
|
|
64747
64812
|
entry.entryStage !== StageTypeEnum.Main)
|
|
64748
64813
|
continue;
|
|
64749
|
-
var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (
|
|
64814
|
+
var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (_26 = entry.entryStage) !== null && _26 !== void 0 ? _26 : StageTypeEnum.Main, drawDefinition: drawDefinition, drawType: drawType });
|
|
64750
64815
|
var result = addDrawEntry(entryData);
|
|
64751
64816
|
if (drawEntries && result.error) {
|
|
64752
64817
|
// only report errors with drawEntries
|
|
@@ -64770,13 +64835,13 @@ function generateDrawDefinition(params) {
|
|
|
64770
64835
|
if (structureResult.error && !structureResult.conflicts) {
|
|
64771
64836
|
return structureResult;
|
|
64772
64837
|
}
|
|
64773
|
-
if ((
|
|
64838
|
+
if ((_27 = structureResult.positioningReport) === null || _27 === void 0 ? void 0 : _27.length)
|
|
64774
64839
|
positioningReports.push((_e = {}, _e[MAIN] = structureResult.positioningReport, _e));
|
|
64775
64840
|
structureId = structureResult.structureId;
|
|
64776
64841
|
if (structureResult.conflicts)
|
|
64777
64842
|
conflicts = structureResult.conflicts;
|
|
64778
64843
|
if (drawType === AD_HOC && params.roundsCount) {
|
|
64779
|
-
var entries_2 = (
|
|
64844
|
+
var entries_2 = (_28 = event === null || event === void 0 ? void 0 : event.entries) === null || _28 === void 0 ? void 0 : _28.filter(function (_a) {
|
|
64780
64845
|
var entryStage = _a.entryStage, entryStatus = _a.entryStatus;
|
|
64781
64846
|
return (!entryStage || entryStage === MAIN) &&
|
|
64782
64847
|
entryStatus &&
|
|
@@ -64823,8 +64888,8 @@ function generateDrawDefinition(params) {
|
|
|
64823
64888
|
var roundTarget = 1;
|
|
64824
64889
|
params.qualifyingProfiles.sort(roundTargetSort);
|
|
64825
64890
|
try {
|
|
64826
|
-
for (var
|
|
64827
|
-
var roundTargetProfile =
|
|
64891
|
+
for (var _43 = __values(params.qualifyingProfiles), _44 = _43.next(); !_44.done; _44 = _43.next()) {
|
|
64892
|
+
var roundTargetProfile = _44.value;
|
|
64828
64893
|
if (!Array.isArray(roundTargetProfile.structureProfiles))
|
|
64829
64894
|
return decorateResult({
|
|
64830
64895
|
info: mustBeAnArray('structureProfiles'),
|
|
@@ -64832,13 +64897,13 @@ function generateDrawDefinition(params) {
|
|
|
64832
64897
|
stack: stack,
|
|
64833
64898
|
});
|
|
64834
64899
|
roundTarget = roundTargetProfile.roundTarget || roundTarget;
|
|
64835
|
-
var sortedStructureProfiles = ((
|
|
64900
|
+
var sortedStructureProfiles = ((_29 = roundTargetProfile.structureProfiles) === null || _29 === void 0 ? void 0 : _29.sort(sequenceSort)) || [];
|
|
64836
64901
|
var sequence = 1;
|
|
64837
64902
|
try {
|
|
64838
64903
|
for (var sortedStructureProfiles_1 = (e_6 = void 0, __values(sortedStructureProfiles)), sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next(); !sortedStructureProfiles_1_1.done; sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next()) {
|
|
64839
64904
|
var structureProfile = sortedStructureProfiles_1_1.value;
|
|
64840
|
-
var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName,
|
|
64841
|
-
var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { seedingProfile: (
|
|
64905
|
+
var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _45 = structureProfile.seedsCount, seedsCount_1 = _45 === void 0 ? 0 : _45, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
|
|
64906
|
+
var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { seedingProfile: (_30 = structureProfile.seedingProfile) !== null && _30 !== void 0 ? _30 : seedingProfile, stageSequence: sequence, qualifyingRoundNumber: qualifyingRoundNumber, preparedStructureIds: preparedStructureIds, qualifyingPositions: qualifyingPositions, seededParticipants: seededParticipants, stage: QUALIFYING, seedingScaleName: seedingScaleName, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, qualifyingOnly: qualifyingOnly, seedByRanking: seedByRanking, participants: participants, roundTarget: roundTarget, seedsCount: seedsCount_1, placeByes: placeByes_1, drawSize: drawSize_1, entries: entries }));
|
|
64842
64907
|
if (qualifyingStageResult.error) {
|
|
64843
64908
|
return qualifyingStageResult;
|
|
64844
64909
|
}
|
|
@@ -64846,9 +64911,9 @@ function generateDrawDefinition(params) {
|
|
|
64846
64911
|
preparedStructureIds.push(qualifyingStageResult.structureId);
|
|
64847
64912
|
}
|
|
64848
64913
|
sequence += 1;
|
|
64849
|
-
if ((
|
|
64914
|
+
if ((_31 = qualifyingStageResult.conflicts) === null || _31 === void 0 ? void 0 : _31.length)
|
|
64850
64915
|
qualifyingConflicts.push.apply(qualifyingConflicts, __spreadArray([], __read(qualifyingStageResult.conflicts), false));
|
|
64851
|
-
if ((
|
|
64916
|
+
if ((_32 = qualifyingStageResult.positioningReport) === null || _32 === void 0 ? void 0 : _32.length)
|
|
64852
64917
|
positioningReports.push((_h = {},
|
|
64853
64918
|
_h[QUALIFYING] = qualifyingStageResult.positioningReport,
|
|
64854
64919
|
_h));
|
|
@@ -64867,7 +64932,7 @@ function generateDrawDefinition(params) {
|
|
|
64867
64932
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
64868
64933
|
finally {
|
|
64869
64934
|
try {
|
|
64870
|
-
if (
|
|
64935
|
+
if (_44 && !_44.done && (_f = _43.return)) _f.call(_43);
|
|
64871
64936
|
}
|
|
64872
64937
|
finally { if (e_5) throw e_5.error; }
|
|
64873
64938
|
}
|
|
@@ -64891,7 +64956,7 @@ function generateDrawDefinition(params) {
|
|
|
64891
64956
|
drawDefinition.links.push(link);
|
|
64892
64957
|
}
|
|
64893
64958
|
drawDefinition.drawName =
|
|
64894
|
-
(
|
|
64959
|
+
(_33 = params.drawName) !== null && _33 !== void 0 ? _33 : (drawType && constantToString(drawType));
|
|
64895
64960
|
if (typeof voluntaryConsolation === 'object') {
|
|
64896
64961
|
addVoluntaryConsolationStructure(__assign(__assign({}, voluntaryConsolation), { tournamentRecord: tournamentRecord, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, matchUpType: matchUpType }));
|
|
64897
64962
|
}
|
|
@@ -69788,8 +69853,8 @@ function generateFlight(_a) {
|
|
|
69788
69853
|
var result_1 = addEventEntries({
|
|
69789
69854
|
participantIds: drawParticipantIds,
|
|
69790
69855
|
autoEntryPositions: autoEntryPositions,
|
|
69856
|
+
entryStage: stage,
|
|
69791
69857
|
tournamentRecord: tournamentRecord,
|
|
69792
|
-
stage: stage,
|
|
69793
69858
|
event: event,
|
|
69794
69859
|
});
|
|
69795
69860
|
if (result_1.error)
|
|
@@ -69986,9 +70051,9 @@ function generateEventWithFlights(params) {
|
|
|
69986
70051
|
if (eventParticipantIds.length) {
|
|
69987
70052
|
var result = addEventEntries({
|
|
69988
70053
|
participantIds: eventParticipantIds,
|
|
70054
|
+
entryStage: StageTypeEnum.Main,
|
|
69989
70055
|
autoEntryPositions: autoEntryPositions,
|
|
69990
70056
|
tournamentRecord: tournamentRecord,
|
|
69991
|
-
stage: MAIN,
|
|
69992
70057
|
event: event,
|
|
69993
70058
|
});
|
|
69994
70059
|
if (result.error)
|
|
@@ -70214,7 +70279,7 @@ function generateEventWithDraw(params) {
|
|
|
70214
70279
|
var participantsCount_1 = drawSize_1 - (qualifyingPositions_1 || 0); // minus qualifyingPositions
|
|
70215
70280
|
var participantIds_1 = qualifyingParticipantIds.slice(qualifyingIndex, qualifyingIndex + participantsCount_1);
|
|
70216
70281
|
var result_5 = addEventEntries({
|
|
70217
|
-
entryStage:
|
|
70282
|
+
entryStage: StageTypeEnum.Qualifying,
|
|
70218
70283
|
entryStageSequence: entryStageSequence,
|
|
70219
70284
|
autoEntryPositions: autoEntryPositions,
|
|
70220
70285
|
tournamentRecord: tournamentRecord,
|
|
@@ -71181,6 +71246,7 @@ var utilities = {
|
|
|
71181
71246
|
categoryCanContain: categoryCanContain,
|
|
71182
71247
|
chunkArray: chunkArray,
|
|
71183
71248
|
compareTieFormats: compareTieFormats,
|
|
71249
|
+
constantToString: constantToString,
|
|
71184
71250
|
countValues: countValues,
|
|
71185
71251
|
createMap: createMap,
|
|
71186
71252
|
dateRange: dateRange,
|