tods-competition-factory 2.1.15 → 2.1.17
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/index.mjs +8 -8
- package/dist/tods-competition-factory.d.ts +11 -13
- package/dist/tods-competition-factory.development.cjs.js +59 -43
- 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 +9 -9
|
@@ -2711,12 +2711,13 @@ declare function qualifierDrawPositionAssignment(params: any): ResultType | {
|
|
|
2711
2711
|
};
|
|
2712
2712
|
};
|
|
2713
2713
|
|
|
2714
|
-
declare function alternateDrawPositionAssignment({ alternateParticipantId, tournamentRecord, drawDefinition, drawPosition, structureId, }: {
|
|
2714
|
+
declare function alternateDrawPositionAssignment({ alternateParticipantId, tournamentRecord, drawDefinition, drawPosition, structureId, event, }: {
|
|
2715
2715
|
alternateParticipantId: any;
|
|
2716
2716
|
tournamentRecord: any;
|
|
2717
2717
|
drawDefinition: any;
|
|
2718
2718
|
drawPosition: any;
|
|
2719
2719
|
structureId: any;
|
|
2720
|
+
event: any;
|
|
2720
2721
|
}): ResultType | {
|
|
2721
2722
|
error: {
|
|
2722
2723
|
message: string;
|
|
@@ -4200,13 +4201,13 @@ type ModifyEventEntriesArgs = {
|
|
|
4200
4201
|
};
|
|
4201
4202
|
declare function modifyEventEntries({ entryStatus, unpairedParticipantIds, participantIdPairs, entryStage, tournamentRecord, event, }: ModifyEventEntriesArgs): any;
|
|
4202
4203
|
|
|
4203
|
-
declare function addDrawEntries({ suppressDuplicateEntries, autoEntryPositions, entryStageSequence, ignoreStageSpace,
|
|
4204
|
+
declare function addDrawEntries({ suppressDuplicateEntries, autoEntryPositions, entryStageSequence, ignoreStageSpace, participantIds, drawDefinition, entryStatus, roundTarget, entryStage, extension, drawId, event, }: {
|
|
4204
4205
|
suppressDuplicateEntries?: boolean | undefined;
|
|
4205
4206
|
autoEntryPositions?: boolean | undefined;
|
|
4206
4207
|
entryStageSequence: any;
|
|
4207
4208
|
ignoreStageSpace: any;
|
|
4208
|
-
drawDefinition: any;
|
|
4209
4209
|
participantIds: any;
|
|
4210
|
+
drawDefinition: any;
|
|
4210
4211
|
entryStatus: any;
|
|
4211
4212
|
roundTarget: any;
|
|
4212
4213
|
entryStage: any;
|
|
@@ -4451,15 +4452,7 @@ declare function refreshEventDrawOrder({ tournamentRecord, event }: {
|
|
|
4451
4452
|
info?: undefined;
|
|
4452
4453
|
};
|
|
4453
4454
|
|
|
4454
|
-
declare function modifyPairAssignment(
|
|
4455
|
-
replacementIndividualParticipantId: any;
|
|
4456
|
-
existingIndividualParticipantId: any;
|
|
4457
|
-
tournamentRecord: any;
|
|
4458
|
-
drawDefinition: any;
|
|
4459
|
-
participantId: any;
|
|
4460
|
-
event: any;
|
|
4461
|
-
uuids: any;
|
|
4462
|
-
}): any;
|
|
4455
|
+
declare function modifyPairAssignment(params: any): any;
|
|
4463
4456
|
|
|
4464
4457
|
declare function updateDrawIdsOrder({ event, orderedDrawIdsMap }: {
|
|
4465
4458
|
event: any;
|
|
@@ -6593,7 +6586,12 @@ declare function modifyPenalty(params: any): {
|
|
|
6593
6586
|
};
|
|
6594
6587
|
};
|
|
6595
6588
|
|
|
6596
|
-
|
|
6589
|
+
type DeleteParticipantsArgs = {
|
|
6590
|
+
addIndividualParticipantsToEvents?: boolean;
|
|
6591
|
+
tournamentRecord: Tournament;
|
|
6592
|
+
participantIds: string[];
|
|
6593
|
+
};
|
|
6594
|
+
declare function deleteParticipants(params: DeleteParticipantsArgs): {
|
|
6597
6595
|
participantsRemovedCount?: number;
|
|
6598
6596
|
success?: boolean;
|
|
6599
6597
|
error?: ErrorType;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.1.
|
|
6
|
+
return '2.1.17';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SINGLES_MATCHUP = 'SINGLES';
|
|
@@ -4442,6 +4442,7 @@ const ONE_OF = '_oneOf';
|
|
|
4442
4442
|
const validators = {
|
|
4443
4443
|
[ONLINE_RESOURCE]: (value) => intersection(Object.keys(value), [RESOURCE_SUB_TYPE, RESOURCE_TYPE, IDENTIFIER]).length === 3,
|
|
4444
4444
|
[TIE_FORMAT_NAME]: (value) => value && tieFormatDefaults({ namedFormat: value }),
|
|
4445
|
+
[UUIDS]: (value) => !value || (Array.isArray(value) && value.every(isString)),
|
|
4445
4446
|
[TIE_FORMAT]: (value) => !validateTieFormat({ tieFormat: value }).error,
|
|
4446
4447
|
[EVENT_TYPE]: (value) => [SINGLES, DOUBLES, TEAM$1].includes(value),
|
|
4447
4448
|
[ENTRY_STAGE]: (value) => validStages.includes(value),
|
|
@@ -10363,9 +10364,8 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
|
|
|
10363
10364
|
if (participant) {
|
|
10364
10365
|
if (drawDefinition?.entries) {
|
|
10365
10366
|
const entry = drawDefinition.entries.find((entry) => entry.participantId === side.participantId);
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
}
|
|
10367
|
+
const eEntry = event?.entries?.find((entry) => entry.participantId === side.participantId);
|
|
10368
|
+
participant.entryStatus = entry?.entryStatus || eEntry?.entryStatus;
|
|
10369
10369
|
if (entry?.entryStage) {
|
|
10370
10370
|
participant.entryStage = entry.entryStage;
|
|
10371
10371
|
}
|
|
@@ -12227,13 +12227,10 @@ function pushGlobalLog(value, devContextOverride) {
|
|
|
12227
12227
|
}
|
|
12228
12228
|
function getGlobalLog(purge) {
|
|
12229
12229
|
const globalLogCopy = globalLog.slice();
|
|
12230
|
-
if (purge) {
|
|
12231
|
-
globalLog.length = 0;
|
|
12232
|
-
}
|
|
12233
12230
|
return globalLogCopy;
|
|
12234
12231
|
}
|
|
12235
12232
|
function printGlobalLog(purge) {
|
|
12236
|
-
const globalLogCopy = getGlobalLog(
|
|
12233
|
+
const globalLogCopy = getGlobalLog();
|
|
12237
12234
|
const modifiedText = globalLogCopy.map((line) => {
|
|
12238
12235
|
const { color, keyColors, method, newline } = line;
|
|
12239
12236
|
const methodColor = Object.keys(logColors).includes(color) ? logColors[color] : logColors.cyan;
|
|
@@ -13852,11 +13849,11 @@ function getParticipantEntries(params) {
|
|
|
13852
13849
|
const drawIds = unique([...drawDefinitions.map(getDrawId), ...flights.map(getDrawId)]);
|
|
13853
13850
|
for (const drawId of drawIds) {
|
|
13854
13851
|
const drawDefinition = drawDefinitions.find((drawDefinition) => drawDefinition.drawId === drawId);
|
|
13852
|
+
const scaleNames = [category?.categoryName, category?.ageCategoryCode].filter(Boolean);
|
|
13853
|
+
const { structures = [], drawOrder, drawName, drawType } = drawDefinition ?? {};
|
|
13855
13854
|
const flight = flights?.find((flight) => flight.drawId === drawId);
|
|
13856
13855
|
const entries = drawDefinition?.entries || flight?.drawEntries;
|
|
13857
|
-
const { structures = [], drawOrder, drawName, drawType } = drawDefinition ?? {};
|
|
13858
13856
|
const flightNumber = flight?.flightNumber;
|
|
13859
|
-
const scaleNames = [category?.categoryName, category?.ageCategoryCode].filter(Boolean);
|
|
13860
13857
|
const orderedStructureIds = (drawDefinition?.structures || [])
|
|
13861
13858
|
.sort((a, b) => structureSort(a, b))
|
|
13862
13859
|
.map(({ structureId, structures }) => {
|
|
@@ -14730,7 +14727,7 @@ function addDrawEntries$1(params) {
|
|
|
14730
14727
|
: { ...SUCCESS };
|
|
14731
14728
|
}
|
|
14732
14729
|
|
|
14733
|
-
function addDrawEntries({ suppressDuplicateEntries = true, autoEntryPositions = true, entryStageSequence, ignoreStageSpace,
|
|
14730
|
+
function addDrawEntries({ suppressDuplicateEntries = true, autoEntryPositions = true, entryStageSequence, ignoreStageSpace, participantIds, drawDefinition, entryStatus, roundTarget, entryStage, extension, drawId, event, }) {
|
|
14734
14731
|
if (!participantIds?.length)
|
|
14735
14732
|
return { error: MISSING_PARTICIPANT_IDS };
|
|
14736
14733
|
if (!event)
|
|
@@ -14748,8 +14745,8 @@ function addDrawEntries({ suppressDuplicateEntries = true, autoEntryPositions =
|
|
|
14748
14745
|
autoEntryPositions,
|
|
14749
14746
|
stage: entryStage,
|
|
14750
14747
|
ignoreStageSpace,
|
|
14751
|
-
drawDefinition,
|
|
14752
14748
|
participantIds,
|
|
14749
|
+
drawDefinition,
|
|
14753
14750
|
entryStatus,
|
|
14754
14751
|
roundTarget,
|
|
14755
14752
|
extension,
|
|
@@ -15234,10 +15231,12 @@ function removeParticipantIdsFromAllTeams({ participantRole = COMPETITOR, indivi
|
|
|
15234
15231
|
}
|
|
15235
15232
|
|
|
15236
15233
|
function deleteParticipants(params) {
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15234
|
+
const paramsCheck = checkRequiredParameters(params, [
|
|
15235
|
+
{ [TOURNAMENT_RECORD]: true },
|
|
15236
|
+
{ participantIds: true, [OF_TYPE]: ARRAY, [ERROR]: MISSING_PARTICIPANT_IDS },
|
|
15237
|
+
]);
|
|
15238
|
+
if (paramsCheck.error)
|
|
15239
|
+
return paramsCheck;
|
|
15241
15240
|
const { addIndividualParticipantsToEvents, tournamentRecord, participantIds } = params;
|
|
15242
15241
|
const participantsCount = tournamentRecord.participants?.length || 0;
|
|
15243
15242
|
if (!participantsCount)
|
|
@@ -15251,18 +15250,17 @@ function deleteParticipants(params) {
|
|
|
15251
15250
|
tournamentRecord,
|
|
15252
15251
|
withDraws: true,
|
|
15253
15252
|
}).participants ?? [];
|
|
15254
|
-
const getPlacedPairParticipantIds = () => {
|
|
15253
|
+
const getPlacedPairParticipantIds = (teamDrawIds) => {
|
|
15255
15254
|
const matchUps = allTournamentMatchUps({
|
|
15256
15255
|
matchUpFilters: { drawIds: teamDrawIds, matchUpTypes: [DOUBLES$1] },
|
|
15257
15256
|
tournamentRecord,
|
|
15258
15257
|
}).matchUps ?? [];
|
|
15259
15258
|
const placedPairParticipantIds = matchUps
|
|
15260
|
-
.
|
|
15261
|
-
.flat()
|
|
15259
|
+
.flatMap(({ sides }) => sides?.map(({ participantId }) => participantId || []))
|
|
15262
15260
|
.filter(Boolean);
|
|
15263
15261
|
return intersection(placedPairParticipantIds, participantIds);
|
|
15264
15262
|
};
|
|
15265
|
-
const placedPairParticipantIds = teamDrawIds?.length
|
|
15263
|
+
const placedPairParticipantIds = teamDrawIds?.length ? getPlacedPairParticipantIds(teamDrawIds) : [];
|
|
15266
15264
|
const participantsInDraws = tournamentParticipants.filter((participant) => participant.draws?.filter((drawInfo) => (!teamDrawIds?.length || !teamDrawIds?.includes(drawInfo.drawId)) && drawInfo.positionAssignments).length);
|
|
15267
15265
|
if (placedPairParticipantIds?.length || participantsInDraws.length) {
|
|
15268
15266
|
return { error: EXISTING_PARTICIPANT_DRAW_POSITION_ASSIGNMENT };
|
|
@@ -15278,17 +15276,18 @@ function deleteParticipants(params) {
|
|
|
15278
15276
|
return result;
|
|
15279
15277
|
eventParticipantIdsRemoved[event.eventId] = result.participantIdsRemoved;
|
|
15280
15278
|
}
|
|
15281
|
-
tournamentRecord.participants = tournamentRecord.participants.filter((participant) => {
|
|
15279
|
+
tournamentRecord.participants = (tournamentRecord.participants ?? []).filter((participant) => {
|
|
15282
15280
|
const participantToRemove = participantIds.includes(participant.participantId) ||
|
|
15283
15281
|
(participant.participantType === PAIR &&
|
|
15284
|
-
participant.individualParticipantIds
|
|
15282
|
+
participant.individualParticipantIds?.some((id) => participantIds.includes(id)));
|
|
15285
15283
|
if (!participantToRemove &&
|
|
15286
15284
|
participant.participantType === TEAM$1 &&
|
|
15287
|
-
participant.individualParticipantIds
|
|
15285
|
+
participant.individualParticipantIds?.some((id) => participantIds.includes(id))) {
|
|
15288
15286
|
participant.individualParticipantIds = participant.individualParticipantIds.filter((id) => !participantIds.includes(id));
|
|
15289
15287
|
}
|
|
15290
15288
|
if (participantToRemove &&
|
|
15291
15289
|
addIndividualParticipantsToEvents &&
|
|
15290
|
+
participant.participantType &&
|
|
15292
15291
|
[PAIR, TEAM].includes(participant.participantType)) {
|
|
15293
15292
|
for (const individualParticipantId of participant.individualParticipantIds || []) {
|
|
15294
15293
|
if (!participantIds.includes(individualParticipantId)) {
|
|
@@ -17038,6 +17037,18 @@ function assignDrawPosition$1({ provisionalPositioning, inContextDrawMatchUps, i
|
|
|
17038
17037
|
});
|
|
17039
17038
|
}
|
|
17040
17039
|
}
|
|
17040
|
+
const drawEntry = drawDefinition.entries?.find((entry) => entry.participantId === participantId);
|
|
17041
|
+
const eventEntry = event?.entries?.find((entry) => entry.participantId === participantId);
|
|
17042
|
+
if (!drawEntry && eventEntry) {
|
|
17043
|
+
addDrawEntry({
|
|
17044
|
+
entryStatus: eventEntry.entryStatus,
|
|
17045
|
+
entryStage: structure.stage,
|
|
17046
|
+
ignoreStageSpace: true,
|
|
17047
|
+
drawDefinition,
|
|
17048
|
+
participantId,
|
|
17049
|
+
event,
|
|
17050
|
+
});
|
|
17051
|
+
}
|
|
17041
17052
|
modifyPositionAssignmentsNotice({
|
|
17042
17053
|
tournamentId: tournamentRecord?.tournamentId,
|
|
17043
17054
|
drawDefinition,
|
|
@@ -17382,7 +17393,7 @@ function qualifierDrawPositionAssignment(params) {
|
|
|
17382
17393
|
return qualifierDrawPositionAssignment$1(params);
|
|
17383
17394
|
}
|
|
17384
17395
|
|
|
17385
|
-
function alternateDrawPositionAssignment({ alternateParticipantId, tournamentRecord, drawDefinition, drawPosition, structureId, }) {
|
|
17396
|
+
function alternateDrawPositionAssignment({ alternateParticipantId, tournamentRecord, drawDefinition, drawPosition, structureId, event, }) {
|
|
17386
17397
|
return positionParticipantAction({
|
|
17387
17398
|
positionActionName: 'alternateDrawPositionAssignment',
|
|
17388
17399
|
participantIdAttributeName: 'alternateParticipantid',
|
|
@@ -17391,6 +17402,7 @@ function alternateDrawPositionAssignment({ alternateParticipantId, tournamentRec
|
|
|
17391
17402
|
drawDefinition,
|
|
17392
17403
|
drawPosition,
|
|
17393
17404
|
structureId,
|
|
17405
|
+
event,
|
|
17394
17406
|
});
|
|
17395
17407
|
}
|
|
17396
17408
|
|
|
@@ -25654,9 +25666,7 @@ function getValidAlternatesAction({ tournamentParticipants = [], possiblyDisabli
|
|
|
25654
25666
|
.sort((a, b) => (a.entryPosition ?? Infinity) - (b.entryPosition ?? Infinity))
|
|
25655
25667
|
.map(({ participantId }) => participantId)
|
|
25656
25668
|
.filter(Boolean);
|
|
25657
|
-
const { allPositionedParticipantIds } = getAllPositionedParticipantIds({
|
|
25658
|
-
drawDefinition,
|
|
25659
|
-
});
|
|
25669
|
+
const { allPositionedParticipantIds } = getAllPositionedParticipantIds({ drawDefinition });
|
|
25660
25670
|
const assignedParticipantIds = positionAssignments.map((assignment) => assignment.participantId).filter(Boolean);
|
|
25661
25671
|
const availableDrawEnteredParticipantIds = drawEnteredParticipantIds.filter((participantId) => structure.stage && [QUALIFYING, MAIN, PLAY_OFF].includes(structure.stage)
|
|
25662
25672
|
? !allPositionedParticipantIds?.includes(participantId)
|
|
@@ -39904,18 +39914,22 @@ function deleteFlightAndFlightDraw({ autoPublish = true, tournamentRecord, audit
|
|
|
39904
39914
|
return refreshEventDrawOrder({ tournamentRecord, event });
|
|
39905
39915
|
}
|
|
39906
39916
|
|
|
39907
|
-
function modifyPairAssignment(
|
|
39908
|
-
|
|
39909
|
-
|
|
39917
|
+
function modifyPairAssignment(params) {
|
|
39918
|
+
const paramsCheck = checkRequiredParameters(params, [
|
|
39919
|
+
{ [EVENT]: true, [TOURNAMENT_RECORD]: true, [UUIDS]: false },
|
|
39920
|
+
{
|
|
39921
|
+
replacementIndividualParticipantId: true,
|
|
39922
|
+
[VALIDATE]: (value) => isString(value),
|
|
39923
|
+
existingIndividualParticipantId: true,
|
|
39924
|
+
[ERROR]: MISSING_PARTICIPANT_ID,
|
|
39925
|
+
participantId: true,
|
|
39926
|
+
},
|
|
39927
|
+
]);
|
|
39928
|
+
const { replacementIndividualParticipantId, existingIndividualParticipantId, tournamentRecord, drawDefinition, participantId, event, uuids, } = params;
|
|
39929
|
+
if (paramsCheck.error)
|
|
39930
|
+
return paramsCheck;
|
|
39910
39931
|
if (event?.eventType !== DOUBLES)
|
|
39911
39932
|
return { error: INVALID_EVENT_TYPE };
|
|
39912
|
-
if (uuids && !Array.isArray(uuids))
|
|
39913
|
-
return { error: INVALID_VALUES };
|
|
39914
|
-
if (!tournamentRecord)
|
|
39915
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
39916
|
-
if (![replacementIndividualParticipantId, existingIndividualParticipantId, participantId].every((id) => typeof id === 'string')) {
|
|
39917
|
-
return { error: MISSING_PARTICIPANT_ID };
|
|
39918
|
-
}
|
|
39919
39933
|
const availableIndividualParticipantIds = event?.entries
|
|
39920
39934
|
?.filter(({ entryStatus }) => [UNGROUPED, UNPAIRED].includes(entryStatus))
|
|
39921
39935
|
.map(({ participantId }) => participantId) || [];
|
|
@@ -39962,18 +39976,19 @@ function modifyPairAssignment({ replacementIndividualParticipantId, existingIndi
|
|
|
39962
39976
|
}
|
|
39963
39977
|
drawDefinition.entries = drawDefinition.entries.map((entry) => entry.participantId === participantId ? { ...entry, participantId: newPairParticipantId } : entry);
|
|
39964
39978
|
for (const structure of drawDefinition.structures || []) {
|
|
39965
|
-
if (structure.
|
|
39966
|
-
structure.positionAssignments =
|
|
39967
|
-
? { ...assignment, participantId: newPairParticipantId }
|
|
39968
|
-
: assignment);
|
|
39969
|
-
}
|
|
39970
|
-
else if (structure.structures) {
|
|
39979
|
+
if (structure.structures) {
|
|
39980
|
+
structure.positionAssignments = undefined;
|
|
39971
39981
|
for (const subStructure of structure.structures) {
|
|
39972
39982
|
subStructure.positionAssignments = subStructure.positionAssignments.map((assignment) => assignment.participantId === participantId
|
|
39973
39983
|
? { ...assignment, participantId: newPairParticipantId }
|
|
39974
39984
|
: assignment);
|
|
39975
39985
|
}
|
|
39976
39986
|
}
|
|
39987
|
+
else if (structure.positionAssignments) {
|
|
39988
|
+
structure.positionAssignments = structure.positionAssignments.map((assignment) => assignment.participantId === participantId
|
|
39989
|
+
? { ...assignment, participantId: newPairParticipantId }
|
|
39990
|
+
: assignment);
|
|
39991
|
+
}
|
|
39977
39992
|
}
|
|
39978
39993
|
}
|
|
39979
39994
|
event.entries = event.entries.map((entry) => (entry.participantId === participantId && {
|
|
@@ -48273,6 +48288,7 @@ var lastNames = [
|
|
|
48273
48288
|
"Cassidy",
|
|
48274
48289
|
"Catton",
|
|
48275
48290
|
"Calvino",
|
|
48291
|
+
"Carlin",
|
|
48276
48292
|
"Carson",
|
|
48277
48293
|
"Chip",
|
|
48278
48294
|
"Constant",
|