tods-competition-factory 1.6.19 → 1.6.20
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 +158 -83
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +1 -1
- package/dist/forge/query.mjs +30 -32
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +129 -36
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +139 -120
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +142 -129
- 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
package/dist/index.mjs
CHANGED
|
@@ -329,7 +329,7 @@ const matchUpFormatCode = {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
function factoryVersion() {
|
|
332
|
-
return "1.6.
|
|
332
|
+
return "1.6.20";
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
function getObjectTieFormat(obj) {
|
|
@@ -6195,15 +6195,15 @@ function getRoundMatchUps$1({
|
|
|
6195
6195
|
roundIndex += 1;
|
|
6196
6196
|
}
|
|
6197
6197
|
});
|
|
6198
|
-
const
|
|
6198
|
+
const roundsNotPowerOf2 = !!Object.values(roundProfile).find(
|
|
6199
6199
|
({ matchUpsCount }) => !isPowerOf2(matchUpsCount)
|
|
6200
6200
|
);
|
|
6201
6201
|
const hasNoRoundPositions = matchUps.some(
|
|
6202
6202
|
(matchUp) => !matchUp.roundPosition
|
|
6203
6203
|
);
|
|
6204
6204
|
return {
|
|
6205
|
-
isNotEliminationStructure,
|
|
6206
6205
|
hasNoRoundPositions,
|
|
6206
|
+
roundsNotPowerOf2,
|
|
6207
6207
|
maxMatchUpsCount,
|
|
6208
6208
|
roundMatchUps,
|
|
6209
6209
|
roundNumbers,
|
|
@@ -7527,31 +7527,29 @@ function filterMatchUps(params) {
|
|
|
7527
7527
|
}
|
|
7528
7528
|
|
|
7529
7529
|
function isLucky({
|
|
7530
|
-
|
|
7530
|
+
roundsNotPowerOf2,
|
|
7531
7531
|
drawDefinition,
|
|
7532
|
-
|
|
7533
|
-
|
|
7532
|
+
structure,
|
|
7533
|
+
matchUps
|
|
7534
7534
|
}) {
|
|
7535
7535
|
if (!structure)
|
|
7536
7536
|
return false;
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
}
|
|
7542
|
-
const hasFirstRoundDrawPositions = !!roundMatchUps?.[1]?.find(
|
|
7543
|
-
({ drawPositions }) => drawPositions
|
|
7544
|
-
);
|
|
7545
|
-
const noSecondRoundDrawPositions = !roundMatchUps?.[2]?.find(
|
|
7546
|
-
({ drawPositions }) => drawPositions
|
|
7547
|
-
);
|
|
7548
|
-
return isNotEliminationStructure && !structure?.structures && hasFirstRoundDrawPositions && noSecondRoundDrawPositions && !(drawDefinition?.drawType && drawDefinition.drawType !== LUCKY_DRAW);
|
|
7537
|
+
matchUps = matchUps ?? structure.matchUps ?? [];
|
|
7538
|
+
roundsNotPowerOf2 = roundsNotPowerOf2 ?? getRoundMatchUps$1({ matchUps }).roundsNotPowerOf2;
|
|
7539
|
+
const hasDrawPositions = !!structure.positionAssignments?.find(({ drawPosition }) => drawPosition) || !!matchUps?.find(({ drawPositions }) => drawPositions?.length);
|
|
7540
|
+
return (!drawDefinition?.drawType || drawDefinition.drawType !== LUCKY_DRAW) && !structure?.structures && roundsNotPowerOf2 && hasDrawPositions;
|
|
7549
7541
|
}
|
|
7550
7542
|
|
|
7551
7543
|
function isAdHoc({ drawDefinition, structure }) {
|
|
7552
7544
|
if (!structure)
|
|
7553
7545
|
return false;
|
|
7554
|
-
|
|
7546
|
+
const hasRoundPosition = structure?.matchUps?.find(
|
|
7547
|
+
(matchUp) => matchUp?.roundPosition
|
|
7548
|
+
);
|
|
7549
|
+
const hasDrawPosition = structure?.matchUps?.find(
|
|
7550
|
+
(matchUp) => matchUp?.drawPositions?.length
|
|
7551
|
+
);
|
|
7552
|
+
return !structure?.structures && !(drawDefinition?.drawType && drawDefinition.drawType !== AD_HOC) && !hasRoundPosition && !hasDrawPosition;
|
|
7555
7553
|
}
|
|
7556
7554
|
|
|
7557
7555
|
const POLICY_ROUND_NAMING_DEFAULT = {
|
|
@@ -7586,14 +7584,10 @@ function getRoundContextProfile({
|
|
|
7586
7584
|
structure,
|
|
7587
7585
|
matchUps
|
|
7588
7586
|
}) {
|
|
7589
|
-
const {
|
|
7587
|
+
const { roundProfile, roundMatchUps } = getRoundMatchUps$1({ matchUps });
|
|
7590
7588
|
const { structureAbbreviation, stage } = structure;
|
|
7591
7589
|
const isAdHocStructure = isAdHoc({ structure });
|
|
7592
|
-
const isLuckyStructure = isLucky({
|
|
7593
|
-
isNotEliminationStructure,
|
|
7594
|
-
roundMatchUps,
|
|
7595
|
-
structure
|
|
7596
|
-
});
|
|
7590
|
+
const isLuckyStructure = isLucky({ structure });
|
|
7597
7591
|
const isRoundRobin = structure.structures;
|
|
7598
7592
|
const roundNamingProfile = {};
|
|
7599
7593
|
const defaultRoundNamingPolicy = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING];
|
|
@@ -23020,7 +23014,7 @@ function getValidSeedBlocks({
|
|
|
23020
23014
|
let validSeedBlocks = [];
|
|
23021
23015
|
if (!structure)
|
|
23022
23016
|
return { error: MISSING_STRUCTURE };
|
|
23023
|
-
const { roundMatchUps } = getAllStructureMatchUps({
|
|
23017
|
+
const { matchUps, roundMatchUps } = getAllStructureMatchUps({
|
|
23024
23018
|
matchUpFilters: { roundNumbers: [1] },
|
|
23025
23019
|
provisionalPositioning,
|
|
23026
23020
|
structure
|
|
@@ -23053,12 +23047,16 @@ function getValidSeedBlocks({
|
|
|
23053
23047
|
const { stage, structureType, roundLimit } = structure;
|
|
23054
23048
|
const isContainer = structureType === CONTAINER;
|
|
23055
23049
|
const isFeedIn = !isContainer && uniqueDrawPositionsByRound?.length;
|
|
23056
|
-
const isLucky = firstRoundDrawPositions?.length && !isPowerOf2(baseDrawSize);
|
|
23057
23050
|
const qualifyingBlocks = !isContainer && stage === QUALIFYING && roundLimit;
|
|
23058
23051
|
const fedSeedBlockPositions = seedRangeDrawPositionBlocks.flat(Infinity);
|
|
23059
23052
|
const fedSeedNumberOffset = isFeedIn ? fedSeedBlockPositions?.length : 0;
|
|
23060
23053
|
const countLimit = allPositions ? positionsCount : seedsCount;
|
|
23061
|
-
const
|
|
23054
|
+
const isLuckyStructure = isLucky({
|
|
23055
|
+
drawDefinition,
|
|
23056
|
+
structure,
|
|
23057
|
+
matchUps
|
|
23058
|
+
});
|
|
23059
|
+
const firstRoundSeedsCount = isLuckyStructure ? 0 : !isFeedIn && countLimit || countLimit && fedSeedBlockPositions.length < countLimit && countLimit - fedSeedBlockPositions.length || 0;
|
|
23062
23060
|
if (qualifyingBlocks) {
|
|
23063
23061
|
const seedingBlocksCount = structure?.matchUps ? structure.matchUps.filter(
|
|
23064
23062
|
({ roundNumber }) => roundNumber === structure.roundLimit
|
|
@@ -23094,14 +23092,14 @@ function getValidSeedBlocks({
|
|
|
23094
23092
|
validSeedBlocks = seedRangeDrawPositionBlocks.map((block) => {
|
|
23095
23093
|
return { seedNumbers: block, drawPositions: block };
|
|
23096
23094
|
});
|
|
23097
|
-
} else if (
|
|
23095
|
+
} else if (isLuckyStructure) {
|
|
23098
23096
|
const blocks = chunkArray(firstRoundDrawPositions, 2).map((block, i) => ({
|
|
23099
23097
|
drawPositions: [block[0]],
|
|
23100
23098
|
seedNumbers: [i + 1]
|
|
23101
23099
|
}));
|
|
23102
23100
|
blocks.forEach((block) => validSeedBlocks.push(block));
|
|
23103
23101
|
}
|
|
23104
|
-
if (!isContainer && !
|
|
23102
|
+
if (!isContainer && !isLuckyStructure && !qualifyingBlocks) {
|
|
23105
23103
|
const { blocks } = constructPower2Blocks({
|
|
23106
23104
|
drawPositionOffset: firstRoundDrawPositionOffset,
|
|
23107
23105
|
seedNumberOffset: fedSeedNumberOffset,
|
|
@@ -23120,7 +23118,7 @@ function getValidSeedBlocks({
|
|
|
23120
23118
|
},
|
|
23121
23119
|
true
|
|
23122
23120
|
);
|
|
23123
|
-
if (!
|
|
23121
|
+
if (!isLuckyStructure && !isFeedIn && !isContainer && !validSeedPositions) {
|
|
23124
23122
|
return {
|
|
23125
23123
|
error: INVALID_SEED_POSITION,
|
|
23126
23124
|
validSeedBlocks: [],
|
|
@@ -23129,10 +23127,10 @@ function getValidSeedBlocks({
|
|
|
23129
23127
|
};
|
|
23130
23128
|
}
|
|
23131
23129
|
return {
|
|
23130
|
+
isLuckyStructure,
|
|
23132
23131
|
validSeedBlocks,
|
|
23133
23132
|
isContainer,
|
|
23134
|
-
isFeedIn
|
|
23135
|
-
isLucky
|
|
23133
|
+
isFeedIn
|
|
23136
23134
|
};
|
|
23137
23135
|
}
|
|
23138
23136
|
function getContainerBlocks({ seedingProfile, structure }) {
|
|
@@ -23475,6 +23473,75 @@ function getTargetMatchUps({
|
|
|
23475
23473
|
return { drawPositions, matchUps, targetMatchUps };
|
|
23476
23474
|
}
|
|
23477
23475
|
|
|
23476
|
+
function validateLineUp({ lineUp, tieFormat }) {
|
|
23477
|
+
const errors = [];
|
|
23478
|
+
if (!Array.isArray(lineUp)) {
|
|
23479
|
+
errors.push(mustBeAnArray("lineUp"));
|
|
23480
|
+
return { valid: false, errors, error: INVALID_VALUES };
|
|
23481
|
+
}
|
|
23482
|
+
const validItems = lineUp.every((item) => {
|
|
23483
|
+
if (typeof item !== "object") {
|
|
23484
|
+
errors.push(`lineUp entries must be objects`);
|
|
23485
|
+
return false;
|
|
23486
|
+
}
|
|
23487
|
+
const { participantId, collectionAssignments } = item;
|
|
23488
|
+
if (!participantId) {
|
|
23489
|
+
errors.push("Missing participantId");
|
|
23490
|
+
return false;
|
|
23491
|
+
}
|
|
23492
|
+
if (typeof participantId !== "string") {
|
|
23493
|
+
errors.push("participantIds must be strings");
|
|
23494
|
+
return false;
|
|
23495
|
+
}
|
|
23496
|
+
if (!Array.isArray(collectionAssignments)) {
|
|
23497
|
+
errors.push(mustBeAnArray("collectionAssignments"));
|
|
23498
|
+
return false;
|
|
23499
|
+
}
|
|
23500
|
+
return collectionAssignments.every((collectionAssignment) => {
|
|
23501
|
+
if (typeof collectionAssignment !== "object") {
|
|
23502
|
+
errors.push("collectionAssignments must be objects");
|
|
23503
|
+
return false;
|
|
23504
|
+
}
|
|
23505
|
+
const { collectionPosition } = collectionAssignment;
|
|
23506
|
+
if (typeof collectionPosition !== "number") {
|
|
23507
|
+
errors.push("collectionPosition must be a number");
|
|
23508
|
+
return false;
|
|
23509
|
+
}
|
|
23510
|
+
return true;
|
|
23511
|
+
});
|
|
23512
|
+
});
|
|
23513
|
+
const noDuplicates = unique(lineUp.map(getParticipantId)).length === lineUp.length;
|
|
23514
|
+
if (!noDuplicates)
|
|
23515
|
+
errors.push("Duplicated participantId(s)");
|
|
23516
|
+
const valid = validItems && noDuplicates;
|
|
23517
|
+
return { valid, errors, error: errors.length ? INVALID_VALUES : void 0 };
|
|
23518
|
+
}
|
|
23519
|
+
|
|
23520
|
+
function updateTeamLineUp({
|
|
23521
|
+
drawDefinition,
|
|
23522
|
+
participantId,
|
|
23523
|
+
tieFormat,
|
|
23524
|
+
lineUp
|
|
23525
|
+
}) {
|
|
23526
|
+
if (typeof drawDefinition !== "object")
|
|
23527
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
23528
|
+
if (typeof participantId !== "string")
|
|
23529
|
+
return { error: MISSING_PARTICIPANT_ID };
|
|
23530
|
+
const validation = validateLineUp({ lineUp, tieFormat });
|
|
23531
|
+
if (!validation.valid)
|
|
23532
|
+
return validation;
|
|
23533
|
+
const { extension: existingExtension } = findExtension({
|
|
23534
|
+
element: drawDefinition,
|
|
23535
|
+
name: LINEUPS
|
|
23536
|
+
});
|
|
23537
|
+
const value = existingExtension?.value || {};
|
|
23538
|
+
value[participantId] = removeLineUpSubstitutions({ lineUp });
|
|
23539
|
+
const extension = { name: LINEUPS, value };
|
|
23540
|
+
addExtension$1({ element: drawDefinition, extension });
|
|
23541
|
+
addDrawNotice({ drawDefinition });
|
|
23542
|
+
return { ...SUCCESS };
|
|
23543
|
+
}
|
|
23544
|
+
|
|
23478
23545
|
function resetLineUps({
|
|
23479
23546
|
inContextDrawMatchUps,
|
|
23480
23547
|
inheritance = true,
|
|
@@ -23502,10 +23569,18 @@ function resetLineUps({
|
|
|
23502
23569
|
({ matchUpId }) => matchUpId === inContextMatchUp.matchUpId
|
|
23503
23570
|
);
|
|
23504
23571
|
if (matchUp?.sides?.[sideIndex]) {
|
|
23505
|
-
|
|
23506
|
-
|
|
23507
|
-
|
|
23508
|
-
|
|
23572
|
+
delete matchUp.sides[sideIndex].lineUp;
|
|
23573
|
+
if (inheritance === false) {
|
|
23574
|
+
const tieFormat = inContextMatchUp.tieFormat;
|
|
23575
|
+
const participantId = side.participantId;
|
|
23576
|
+
if (tieFormat && participantId) {
|
|
23577
|
+
updateTeamLineUp({
|
|
23578
|
+
drawDefinition,
|
|
23579
|
+
participantId,
|
|
23580
|
+
lineUp: [],
|
|
23581
|
+
tieFormat
|
|
23582
|
+
});
|
|
23583
|
+
}
|
|
23509
23584
|
}
|
|
23510
23585
|
modifyMatchUpNotice({
|
|
23511
23586
|
tournamentId: tournamentRecord?.tournamentId,
|
|
@@ -40274,7 +40349,7 @@ function getSeedOrderByePositions({
|
|
|
40274
40349
|
structure
|
|
40275
40350
|
});
|
|
40276
40351
|
}
|
|
40277
|
-
const { isFeedIn,
|
|
40352
|
+
const { isFeedIn, isLuckyStructure, isContainer } = seedBlockInfo;
|
|
40278
40353
|
let { validSeedBlocks } = seedBlockInfo;
|
|
40279
40354
|
if (appliedPolicies?.seeding?.containerByesIgnoreSeeding)
|
|
40280
40355
|
validSeedBlocks = [];
|
|
@@ -40318,10 +40393,10 @@ function getSeedOrderByePositions({
|
|
|
40318
40393
|
return {
|
|
40319
40394
|
strictSeedOrderByePositions,
|
|
40320
40395
|
blockSeedOrderByePositions,
|
|
40396
|
+
isLuckyStructure,
|
|
40321
40397
|
positionedSeeds,
|
|
40322
40398
|
isContainer,
|
|
40323
|
-
isFeedIn
|
|
40324
|
-
isLucky
|
|
40399
|
+
isFeedIn
|
|
40325
40400
|
};
|
|
40326
40401
|
}
|
|
40327
40402
|
function getOrderedByePositions({
|
|
@@ -40348,12 +40423,12 @@ function getOrderedByePositions({
|
|
|
40348
40423
|
function getUnseededByePositions({
|
|
40349
40424
|
provisionalPositioning,
|
|
40350
40425
|
seedOrderByePositions,
|
|
40426
|
+
isLuckyStructure,
|
|
40351
40427
|
appliedPolicies,
|
|
40352
40428
|
drawDefinition,
|
|
40353
40429
|
seedLimit,
|
|
40354
40430
|
structure,
|
|
40355
|
-
isFeedIn
|
|
40356
|
-
isLucky
|
|
40431
|
+
isFeedIn
|
|
40357
40432
|
}) {
|
|
40358
40433
|
const seedingProfile = appliedPolicies?.seeding?.seedingProfile;
|
|
40359
40434
|
const isQualifying = structure.stage === QUALIFYING;
|
|
@@ -40571,8 +40646,8 @@ function positionByes({
|
|
|
40571
40646
|
const {
|
|
40572
40647
|
strictSeedOrderByePositions,
|
|
40573
40648
|
blockSeedOrderByePositions,
|
|
40574
|
-
|
|
40575
|
-
|
|
40649
|
+
isLuckyStructure,
|
|
40650
|
+
isFeedIn
|
|
40576
40651
|
} = getSeedOrderByePositions({
|
|
40577
40652
|
provisionalPositioning,
|
|
40578
40653
|
relevantMatchUps,
|
|
@@ -40587,12 +40662,12 @@ function positionByes({
|
|
|
40587
40662
|
let { unseededByePositions } = getUnseededByePositions({
|
|
40588
40663
|
provisionalPositioning,
|
|
40589
40664
|
seedOrderByePositions,
|
|
40665
|
+
isLuckyStructure,
|
|
40590
40666
|
appliedPolicies,
|
|
40591
40667
|
drawDefinition,
|
|
40592
40668
|
seedLimit,
|
|
40593
40669
|
structure,
|
|
40594
|
-
isFeedIn
|
|
40595
|
-
isLucky
|
|
40670
|
+
isFeedIn
|
|
40596
40671
|
});
|
|
40597
40672
|
const isOdd = (x) => x % 2;
|
|
40598
40673
|
const isNotPaired = (arr, c) => (arr || []).every((a) => isOdd(a) ? c !== a + 1 : c !== a - 1);
|
|
@@ -44598,9 +44673,9 @@ function roundRobinSwap({
|
|
|
44598
44673
|
}
|
|
44599
44674
|
|
|
44600
44675
|
function resetMatchUpLineUps$1({
|
|
44676
|
+
inheritance = true,
|
|
44601
44677
|
tournamentRecord,
|
|
44602
44678
|
drawDefinition,
|
|
44603
|
-
inheritance,
|
|
44604
44679
|
matchUpId,
|
|
44605
44680
|
event
|
|
44606
44681
|
}) {
|
|
@@ -44615,10 +44690,23 @@ function resetMatchUpLineUps$1({
|
|
|
44615
44690
|
let modificationsCount = 0;
|
|
44616
44691
|
(matchUp.sides || []).forEach((side) => {
|
|
44617
44692
|
modificationsCount += 1;
|
|
44618
|
-
|
|
44619
|
-
|
|
44620
|
-
|
|
44621
|
-
|
|
44693
|
+
delete side.lineUp;
|
|
44694
|
+
if (inheritance === false) {
|
|
44695
|
+
const inContextMatchUp = findMatchUp$1({
|
|
44696
|
+
inContext: true,
|
|
44697
|
+
drawDefinition,
|
|
44698
|
+
matchUpId
|
|
44699
|
+
})?.matchUp;
|
|
44700
|
+
const tieFormat = inContextMatchUp?.tieFormat;
|
|
44701
|
+
const participantId = side.participantId;
|
|
44702
|
+
if (tieFormat && participantId) {
|
|
44703
|
+
updateTeamLineUp({
|
|
44704
|
+
drawDefinition,
|
|
44705
|
+
participantId,
|
|
44706
|
+
lineUp: [],
|
|
44707
|
+
tieFormat
|
|
44708
|
+
});
|
|
44709
|
+
}
|
|
44622
44710
|
}
|
|
44623
44711
|
modifyMatchUpNotice({
|
|
44624
44712
|
tournamentId: tournamentRecord?.tournamentId,
|
|
@@ -51368,75 +51456,6 @@ function removeCollectionAssignments({
|
|
|
51368
51456
|
return { modifiedLineUp, assignmentsRemoved, previousParticipantIds };
|
|
51369
51457
|
}
|
|
51370
51458
|
|
|
51371
|
-
function validateLineUp({ lineUp, tieFormat }) {
|
|
51372
|
-
const errors = [];
|
|
51373
|
-
if (!Array.isArray(lineUp)) {
|
|
51374
|
-
errors.push(mustBeAnArray("lineUp"));
|
|
51375
|
-
return { valid: false, errors, error: INVALID_VALUES };
|
|
51376
|
-
}
|
|
51377
|
-
const validItems = lineUp.every((item) => {
|
|
51378
|
-
if (typeof item !== "object") {
|
|
51379
|
-
errors.push(`lineUp entries must be objects`);
|
|
51380
|
-
return false;
|
|
51381
|
-
}
|
|
51382
|
-
const { participantId, collectionAssignments } = item;
|
|
51383
|
-
if (!participantId) {
|
|
51384
|
-
errors.push("Missing participantId");
|
|
51385
|
-
return false;
|
|
51386
|
-
}
|
|
51387
|
-
if (typeof participantId !== "string") {
|
|
51388
|
-
errors.push("participantIds must be strings");
|
|
51389
|
-
return false;
|
|
51390
|
-
}
|
|
51391
|
-
if (!Array.isArray(collectionAssignments)) {
|
|
51392
|
-
errors.push(mustBeAnArray("collectionAssignments"));
|
|
51393
|
-
return false;
|
|
51394
|
-
}
|
|
51395
|
-
return collectionAssignments.every((collectionAssignment) => {
|
|
51396
|
-
if (typeof collectionAssignment !== "object") {
|
|
51397
|
-
errors.push("collectionAssignments must be objects");
|
|
51398
|
-
return false;
|
|
51399
|
-
}
|
|
51400
|
-
const { collectionPosition } = collectionAssignment;
|
|
51401
|
-
if (typeof collectionPosition !== "number") {
|
|
51402
|
-
errors.push("collectionPosition must be a number");
|
|
51403
|
-
return false;
|
|
51404
|
-
}
|
|
51405
|
-
return true;
|
|
51406
|
-
});
|
|
51407
|
-
});
|
|
51408
|
-
const noDuplicates = unique(lineUp.map(getParticipantId)).length === lineUp.length;
|
|
51409
|
-
if (!noDuplicates)
|
|
51410
|
-
errors.push("Duplicated participantId(s)");
|
|
51411
|
-
const valid = validItems && noDuplicates;
|
|
51412
|
-
return { valid, errors, error: errors.length ? INVALID_VALUES : void 0 };
|
|
51413
|
-
}
|
|
51414
|
-
|
|
51415
|
-
function updateTeamLineUp({
|
|
51416
|
-
drawDefinition,
|
|
51417
|
-
participantId,
|
|
51418
|
-
tieFormat,
|
|
51419
|
-
lineUp
|
|
51420
|
-
}) {
|
|
51421
|
-
if (typeof drawDefinition !== "object")
|
|
51422
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
51423
|
-
if (typeof participantId !== "string")
|
|
51424
|
-
return { error: MISSING_PARTICIPANT_ID };
|
|
51425
|
-
const validation = validateLineUp({ lineUp, tieFormat });
|
|
51426
|
-
if (!validation.valid)
|
|
51427
|
-
return validation;
|
|
51428
|
-
const { extension: existingExtension } = findExtension({
|
|
51429
|
-
element: drawDefinition,
|
|
51430
|
-
name: LINEUPS
|
|
51431
|
-
});
|
|
51432
|
-
const value = existingExtension?.value || {};
|
|
51433
|
-
value[participantId] = removeLineUpSubstitutions({ lineUp });
|
|
51434
|
-
const extension = { name: LINEUPS, value };
|
|
51435
|
-
addExtension$1({ element: drawDefinition, extension });
|
|
51436
|
-
addDrawNotice({ drawDefinition });
|
|
51437
|
-
return { ...SUCCESS };
|
|
51438
|
-
}
|
|
51439
|
-
|
|
51440
51459
|
function getTieMatchUpContext({
|
|
51441
51460
|
tournamentRecord,
|
|
51442
51461
|
drawDefinition,
|