tods-competition-factory 2.0.60 → 2.1.0
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 +6 -6
- package/dist/tods-competition-factory.d.ts +43 -4
- package/dist/tods-competition-factory.development.cjs.js +235 -81
- 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 +6 -6
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.0
|
|
6
|
+
return '2.1.0';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -446,6 +446,10 @@ const MISSING_VALUE = {
|
|
|
446
446
|
message: 'Missing value',
|
|
447
447
|
code: 'ERR_MISSING_VALUE',
|
|
448
448
|
};
|
|
449
|
+
const MISSING_BIRTH_DATE = {
|
|
450
|
+
message: 'Missing birthdate',
|
|
451
|
+
code: 'ERR_MISSING_BIRTH_DATE',
|
|
452
|
+
};
|
|
449
453
|
const MISSING_DATE = {
|
|
450
454
|
message: 'Missing date',
|
|
451
455
|
code: 'ERR_MISSING_DATE',
|
|
@@ -506,6 +510,10 @@ const CANNOT_REMOVE_PARTICIPANTS = {
|
|
|
506
510
|
message: 'Cannot remove participants',
|
|
507
511
|
code: 'ERR_UNCHANGED_CANNOT_REMOVE_PARTICIPANTS',
|
|
508
512
|
};
|
|
513
|
+
const CATEGORY_MISMATCH = {
|
|
514
|
+
message: 'Participant category mismatch',
|
|
515
|
+
code: 'ERR_CATEGORY_MISMATCH',
|
|
516
|
+
};
|
|
509
517
|
const CANNOT_CHANGE_WINNING_SIDE = {
|
|
510
518
|
message: 'Cannot change winningSide',
|
|
511
519
|
code: 'ERR_UNCHANGED_CANNOT_CHANGE_WINNING_SIDE',
|
|
@@ -818,6 +826,7 @@ const errorConditionConstants = {
|
|
|
818
826
|
CANNOT_MODIFY_PARTICIPANT_TYPE,
|
|
819
827
|
CANNOT_REMOVE_MAIN_STRUCTURE,
|
|
820
828
|
CANNOT_REMOVE_PARTICIPANTS,
|
|
829
|
+
CATEGORY_MISMATCH,
|
|
821
830
|
COURT_EXISTS,
|
|
822
831
|
COURT_NOT_FOUND,
|
|
823
832
|
DRAW_DEFINITION_NOT_FOUND,
|
|
@@ -900,6 +909,7 @@ const errorConditionConstants = {
|
|
|
900
909
|
MISSING_ASSIGNMENTS,
|
|
901
910
|
MISSING_ASYNC_STATE_PROVIDER,
|
|
902
911
|
MISSING_AVOIDANCE_POLICY,
|
|
912
|
+
MISSING_BIRTH_DATE,
|
|
903
913
|
MISSING_COLLECTION_DEFINITION,
|
|
904
914
|
MISSING_COURT_ID,
|
|
905
915
|
MISSING_COURTS_INFO,
|
|
@@ -3414,9 +3424,11 @@ const MUTATIONS = 'mutations';
|
|
|
3414
3424
|
const PUBLISH_EVENT = 'publishEvent';
|
|
3415
3425
|
const PUBLISH_EVENT_SEEDING = 'publishEventSeeding';
|
|
3416
3426
|
const PUBLISH_ORDER_OF_PLAY = 'publishOrderOfPlay';
|
|
3427
|
+
const PUBLISH_PARTICIPANTS = 'publishParticipants';
|
|
3417
3428
|
const UNPUBLISH_EVENT = 'unPublishEvent';
|
|
3418
3429
|
const UNPUBLISH_EVENT_SEEDING = 'unPublishEventSeeding';
|
|
3419
3430
|
const UNPUBLISH_ORDER_OF_PLAY = 'unPublishOrderOfPlay';
|
|
3431
|
+
const UNPUBLISH_PARTICIPANTS = 'unPublishParticipants';
|
|
3420
3432
|
const UPDATE_INCONTEXT_MATCHUP = 'updateInContextMatchUp';
|
|
3421
3433
|
const topicConstants = {
|
|
3422
3434
|
ADD_DRAW_DEFINITION,
|
|
@@ -3443,6 +3455,7 @@ const topicConstants = {
|
|
|
3443
3455
|
PUBLISH_EVENT_SEEDING,
|
|
3444
3456
|
PUBLISH_EVENT,
|
|
3445
3457
|
PUBLISH_ORDER_OF_PLAY,
|
|
3458
|
+
PUBLISH_PARTICIPANTS,
|
|
3446
3459
|
UNPUBLISH_EVENT_SEEDING,
|
|
3447
3460
|
UNPUBLISH_EVENT,
|
|
3448
3461
|
UNPUBLISH_ORDER_OF_PLAY,
|
|
@@ -11537,12 +11550,16 @@ function addScheduleItem(params) {
|
|
|
11537
11550
|
}
|
|
11538
11551
|
}
|
|
11539
11552
|
|
|
11540
|
-
function getTournamentPublishStatus(
|
|
11553
|
+
function getTournamentPublishStatus(params) {
|
|
11554
|
+
const paramsCheck = checkRequiredParameters(params, [{ [TOURNAMENT_RECORD]: true }]);
|
|
11555
|
+
if (paramsCheck.error)
|
|
11556
|
+
return paramsCheck;
|
|
11557
|
+
const { tournamentRecord, status = PUBLIC } = params;
|
|
11541
11558
|
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
11542
|
-
return getTournamentTimeItem({
|
|
11559
|
+
return makeDeepCopy(getTournamentTimeItem({
|
|
11543
11560
|
tournamentRecord,
|
|
11544
11561
|
itemType,
|
|
11545
|
-
})?.timeItem?.itemValue?.[status];
|
|
11562
|
+
})?.timeItem?.itemValue?.[status], false, true);
|
|
11546
11563
|
}
|
|
11547
11564
|
|
|
11548
11565
|
function isValidTournamentRecord(tournamentRecord) {
|
|
@@ -11637,6 +11654,8 @@ function getPublishState(params) {
|
|
|
11637
11654
|
if (tournamentRecord) {
|
|
11638
11655
|
const pubStatus = getTournamentPublishStatus({ tournamentRecord });
|
|
11639
11656
|
publishState.tournament = pubStatus ?? {};
|
|
11657
|
+
if (pubStatus?.orderOfPlay?.published || pubStatus?.participants?.published)
|
|
11658
|
+
tournamentPublished = true;
|
|
11640
11659
|
publishState.tournament.status = { published: tournamentPublished, publishedEventIds };
|
|
11641
11660
|
}
|
|
11642
11661
|
return { ...SUCCESS, publishState };
|
|
@@ -21875,30 +21894,9 @@ function validateTieFormat(params) {
|
|
|
21875
21894
|
const event = params?.event;
|
|
21876
21895
|
const stack = 'validateTieFormat';
|
|
21877
21896
|
const errors = [];
|
|
21878
|
-
|
|
21879
|
-
|
|
21880
|
-
return
|
|
21881
|
-
result: { error: INVALID_TIE_FORMAT },
|
|
21882
|
-
context: { tieFormat, errors },
|
|
21883
|
-
stack,
|
|
21884
|
-
});
|
|
21885
|
-
}
|
|
21886
|
-
if (typeof tieFormat.winCriteria !== 'object') {
|
|
21887
|
-
errors.push('tieFormat.winCriteria must be an object');
|
|
21888
|
-
return decorateResult({
|
|
21889
|
-
result: { error: INVALID_TIE_FORMAT },
|
|
21890
|
-
context: { tieFormat, errors },
|
|
21891
|
-
stack,
|
|
21892
|
-
});
|
|
21893
|
-
}
|
|
21894
|
-
if (!Array.isArray(tieFormat.collectionDefinitions)) {
|
|
21895
|
-
errors.push(mustBeAnArray('tieFormat.collectionDefinitions'));
|
|
21896
|
-
return decorateResult({
|
|
21897
|
-
result: { error: INVALID_TIE_FORMAT },
|
|
21898
|
-
context: { tieFormat, errors },
|
|
21899
|
-
stack,
|
|
21900
|
-
});
|
|
21901
|
-
}
|
|
21897
|
+
const paramsCheck = checkParams$1({ ...params, stack });
|
|
21898
|
+
if (paramsCheck?.error)
|
|
21899
|
+
return paramsCheck;
|
|
21902
21900
|
let aggregateValueImperative;
|
|
21903
21901
|
const validCollections = tieFormat.collectionDefinitions.every((collectionDefinition) => {
|
|
21904
21902
|
const { setValue, scoreValue, collectionValue } = collectionDefinition;
|
|
@@ -21951,6 +21949,31 @@ function validateTieFormat(params) {
|
|
|
21951
21949
|
}
|
|
21952
21950
|
return result;
|
|
21953
21951
|
}
|
|
21952
|
+
function checkParams$1(params) {
|
|
21953
|
+
const { tieFormat, stack } = params;
|
|
21954
|
+
if (!params || !tieFormat || !isObject(tieFormat)) {
|
|
21955
|
+
return decorateResult({
|
|
21956
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
21957
|
+
context: { tieFormat, message: 'tieformat must be an object' },
|
|
21958
|
+
stack,
|
|
21959
|
+
});
|
|
21960
|
+
}
|
|
21961
|
+
if (!isObject(tieFormat.winCriteria)) {
|
|
21962
|
+
return decorateResult({
|
|
21963
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
21964
|
+
context: { tieFormat, message: 'tieformat.winCritiera must be an object' },
|
|
21965
|
+
stack,
|
|
21966
|
+
});
|
|
21967
|
+
}
|
|
21968
|
+
if (!Array.isArray(tieFormat.collectionDefinitions)) {
|
|
21969
|
+
return decorateResult({
|
|
21970
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
21971
|
+
context: { tieFormat, message: 'collectionDefinitions must be an array' },
|
|
21972
|
+
stack,
|
|
21973
|
+
});
|
|
21974
|
+
}
|
|
21975
|
+
return { ...SUCCESS };
|
|
21976
|
+
}
|
|
21954
21977
|
|
|
21955
21978
|
function generateTieMatchUpScore(params) {
|
|
21956
21979
|
const { sideAdjustments = [0, 0], separator = '-', drawDefinition, matchUpsMap, structure, matchUp, event, } = params;
|
|
@@ -33654,6 +33677,7 @@ function getTournamentInfo(params) {
|
|
|
33654
33677
|
eventInfo.push(info);
|
|
33655
33678
|
}
|
|
33656
33679
|
}
|
|
33680
|
+
tournamentInfo.publishState = publishState?.tournament;
|
|
33657
33681
|
tournamentInfo.eventInfo = eventInfo;
|
|
33658
33682
|
return {
|
|
33659
33683
|
tournamentInfo: makeDeepCopy(tournamentInfo, false, true),
|
|
@@ -34608,6 +34632,7 @@ var query$5 = {
|
|
|
34608
34632
|
getEventData: getEventData,
|
|
34609
34633
|
getEventPublishStatus: getEventPublishStatus,
|
|
34610
34634
|
getPublishState: getPublishState,
|
|
34635
|
+
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
34611
34636
|
getVenueData: getVenueData
|
|
34612
34637
|
};
|
|
34613
34638
|
|
|
@@ -35991,11 +36016,9 @@ function competitionScheduleMatchUps(params) {
|
|
|
35991
36016
|
const getResult = getSchedulingProfile(params);
|
|
35992
36017
|
const schedulingProfile = getResult.schedulingProfile;
|
|
35993
36018
|
const { sortDateMatchUps = true, courtCompletedMatchUps, alwaysReturnCompleted, activeTournamentId, tournamentRecords, withCourtGridRows, minCourtGridRows, usePublishState, status = PUBLIC, sortCourtsData, } = params;
|
|
36019
|
+
const tournamentId = activeTournamentId ?? getTournamentId() ?? Object.keys(tournamentRecords)[0];
|
|
35994
36020
|
const tournamentPublishStatus = usePublishState
|
|
35995
|
-
?
|
|
35996
|
-
tournamentRecord: tournamentRecords[activeTournamentId ?? getTournamentId() ?? Object.keys(tournamentRecords)[0]],
|
|
35997
|
-
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
35998
|
-
}).timeItem?.itemValue?.[status]
|
|
36021
|
+
? getTournamentPublishStatus({ tournamentRecord: tournamentRecords[tournamentId], status })
|
|
35999
36022
|
: undefined;
|
|
36000
36023
|
const allCompletedMatchUps = alwaysReturnCompleted
|
|
36001
36024
|
? getCompetitionMatchUps({
|
|
@@ -36007,7 +36030,7 @@ function competitionScheduleMatchUps(params) {
|
|
|
36007
36030
|
contextFilters: params.contextFilters,
|
|
36008
36031
|
}).completedMatchUps
|
|
36009
36032
|
: [];
|
|
36010
|
-
if (usePublishState &&
|
|
36033
|
+
if (usePublishState && !tournamentPublishStatus?.orderOfPlay?.published) {
|
|
36011
36034
|
return {
|
|
36012
36035
|
completedMatchUps: allCompletedMatchUps,
|
|
36013
36036
|
dateMatchUps: [],
|
|
@@ -37345,6 +37368,7 @@ var index$f = {
|
|
|
37345
37368
|
getTournamentInfo: getTournamentInfo,
|
|
37346
37369
|
getTournamentPenalties: getTournamentPenalties,
|
|
37347
37370
|
getTournamentPersons: getTournamentPersons,
|
|
37371
|
+
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
37348
37372
|
getTournamentStructures: getTournamentStructures,
|
|
37349
37373
|
getTournamentTimeItem: getTournamentTimeItem,
|
|
37350
37374
|
getValidGroupSizes: getValidGroupSizes,
|
|
@@ -39542,8 +39566,86 @@ function modifyEvent(params) {
|
|
|
39542
39566
|
]);
|
|
39543
39567
|
if (paramsCheck.error)
|
|
39544
39568
|
return paramsCheck;
|
|
39545
|
-
const {
|
|
39569
|
+
const { eventUpdates, event } = params;
|
|
39546
39570
|
const stack = 'modifyEvent';
|
|
39571
|
+
const enteredParticipants = getEnteredParticipants(params);
|
|
39572
|
+
const participantsProfile = getParticipantsProfile({ enteredParticipants });
|
|
39573
|
+
const { enteredParticipantGenders, enteredParticipantTypes } = participantsProfile;
|
|
39574
|
+
const genderResult = checkGenderUpdates({ enteredParticipantGenders, eventUpdates, stack });
|
|
39575
|
+
if (genderResult.error)
|
|
39576
|
+
return genderResult;
|
|
39577
|
+
const eventTypeResult = checkEventType({ enteredParticipantTypes, eventUpdates, stack });
|
|
39578
|
+
if (eventTypeResult.error)
|
|
39579
|
+
return eventTypeResult;
|
|
39580
|
+
const categoryResult = checkCategoryUpdates({ ...params, ...participantsProfile, enteredParticipants, stack });
|
|
39581
|
+
if (categoryResult.error)
|
|
39582
|
+
return categoryResult;
|
|
39583
|
+
const dateResult = dateUpdates({ ...params, stack });
|
|
39584
|
+
if (dateResult.error)
|
|
39585
|
+
return dateResult;
|
|
39586
|
+
if (eventUpdates.eventType)
|
|
39587
|
+
event.eventType = eventUpdates.eventType;
|
|
39588
|
+
if (eventUpdates.eventName)
|
|
39589
|
+
event.eventName = eventUpdates.eventName;
|
|
39590
|
+
if (eventUpdates.gender)
|
|
39591
|
+
event.gender = eventUpdates.gender;
|
|
39592
|
+
return { ...SUCCESS };
|
|
39593
|
+
}
|
|
39594
|
+
function checkCategoryUpdates(params) {
|
|
39595
|
+
const category = params.eventUpdates?.category;
|
|
39596
|
+
if (!category)
|
|
39597
|
+
return { ...SUCCESS };
|
|
39598
|
+
const categoryCheck = validateCategory({ category });
|
|
39599
|
+
if (categoryCheck.error)
|
|
39600
|
+
return categoryCheck;
|
|
39601
|
+
if (params.event.eventType === TEAM$2) {
|
|
39602
|
+
const drawTieFormats = params.event?.drawDefinitions?.map((draw) => getObjectTieFormat(draw)) ?? [];
|
|
39603
|
+
const eventTieFormat = getObjectTieFormat(params.event);
|
|
39604
|
+
const eventMatchUps = allEventMatchUps(params)?.matchUps ?? [];
|
|
39605
|
+
const matchUpTieFormats = eventMatchUps.map((matchUp) => getObjectTieFormat(matchUp)) ?? [];
|
|
39606
|
+
const tieFormats = [eventTieFormat, ...drawTieFormats, ...matchUpTieFormats].filter(Boolean);
|
|
39607
|
+
const validCategory = tieFormats.every((tieFormat) => tieFormat.collectionDefinitions.every((cd) => !cd.category || categoryCanContain({ category: params.eventUpdates.category, childCategory: cd.category })));
|
|
39608
|
+
if (!validCategory)
|
|
39609
|
+
return decorateResult({ result: { error: INVALID_CATEGORY }, stack: params.stack });
|
|
39610
|
+
}
|
|
39611
|
+
if (params.enteredParticipants?.length) {
|
|
39612
|
+
const startDate = params.eventUpdates.startDate || params.event.startDate || params.tournamentRecord.startDate;
|
|
39613
|
+
const endDate = params.eventUpdates.endDate || params.event.endDate || params.tournamentRecord.endDate;
|
|
39614
|
+
const individualParticpants = params.enteredParticipants
|
|
39615
|
+
.map((p) => (p.participantType === INDIVIDUAL ? p : p.individualParticpants ?? []))
|
|
39616
|
+
.flat();
|
|
39617
|
+
const startAgeDetails = getCategoryAgeDetails({ category, consideredDate: startDate });
|
|
39618
|
+
const endAgeDetails = getCategoryAgeDetails({ category, consideredDate: endDate });
|
|
39619
|
+
if (startAgeDetails?.ageMinDate ||
|
|
39620
|
+
startAgeDetails?.ageMaxDate ||
|
|
39621
|
+
endAgeDetails?.ageMinDate ||
|
|
39622
|
+
endAgeDetails?.ageMaxDate) {
|
|
39623
|
+
for (const individualParticipant of individualParticpants) {
|
|
39624
|
+
const birthDate = individualParticipant.person?.birthDate;
|
|
39625
|
+
if (!birthDate)
|
|
39626
|
+
return decorateResult({ result: { error: MISSING_BIRTH_DATE }, stack: params.stack });
|
|
39627
|
+
const birthTime = new Date(birthDate).getTime();
|
|
39628
|
+
if (startAgeDetails.ageMinDate || startAgeDetails.ageMaxDate) {
|
|
39629
|
+
const minTime = new Date(startAgeDetails.ageMinDate).getTime();
|
|
39630
|
+
const maxTime = new Date(startAgeDetails.ageMaxDate).getTime();
|
|
39631
|
+
if (birthTime < minTime || birthTime > maxTime) {
|
|
39632
|
+
return decorateResult({ result: { error: CATEGORY_MISMATCH }, stack: params.stack });
|
|
39633
|
+
}
|
|
39634
|
+
}
|
|
39635
|
+
if (endAgeDetails.ageMin || endAgeDetails.ageMax) {
|
|
39636
|
+
const minTime = new Date(endAgeDetails.ageMinDate).getTime();
|
|
39637
|
+
const maxTime = new Date(endAgeDetails.ageMaxDate).getTime();
|
|
39638
|
+
if (birthTime < minTime || birthTime > maxTime) {
|
|
39639
|
+
return decorateResult({ result: { error: CATEGORY_MISMATCH }, stack: params.stack });
|
|
39640
|
+
}
|
|
39641
|
+
}
|
|
39642
|
+
}
|
|
39643
|
+
}
|
|
39644
|
+
}
|
|
39645
|
+
return { ...SUCCESS };
|
|
39646
|
+
}
|
|
39647
|
+
function dateUpdates(params) {
|
|
39648
|
+
const { tournamentRecord, eventUpdates, event, stack } = params;
|
|
39547
39649
|
if (eventUpdates.startDate || eventUpdates.endDate) {
|
|
39548
39650
|
const result = setEventDates({
|
|
39549
39651
|
startDate: eventUpdates.startDate,
|
|
@@ -39554,19 +39656,25 @@ function modifyEvent(params) {
|
|
|
39554
39656
|
if (result.error)
|
|
39555
39657
|
return decorateResult({ result, stack });
|
|
39556
39658
|
}
|
|
39659
|
+
return { ...SUCCESS };
|
|
39660
|
+
}
|
|
39661
|
+
function getEnteredParticipants(params) {
|
|
39662
|
+
const { tournamentRecord, event } = params;
|
|
39557
39663
|
const enteredParticipantIds = event?.entries
|
|
39558
39664
|
?.filter(({ entryStatus }) => {
|
|
39559
39665
|
const status = entryStatus;
|
|
39560
39666
|
return [...STRUCTURE_SELECTED_STATUSES, ALTERNATE].includes(status);
|
|
39561
39667
|
})
|
|
39562
39668
|
.map(({ participantId }) => participantId) ?? [];
|
|
39563
|
-
|
|
39669
|
+
return enteredParticipantIds
|
|
39564
39670
|
? getParticipants({
|
|
39565
39671
|
participantFilters: { participantIds: enteredParticipantIds },
|
|
39566
39672
|
withIndividualParticipants: true,
|
|
39567
39673
|
tournamentRecord,
|
|
39568
39674
|
}).participants ?? []
|
|
39569
39675
|
: [];
|
|
39676
|
+
}
|
|
39677
|
+
function getParticipantsProfile({ enteredParticipants }) {
|
|
39570
39678
|
const genderAccumulator = [];
|
|
39571
39679
|
const enteredParticipantTypes = enteredParticipants.reduce((types, participant) => {
|
|
39572
39680
|
const genders = participant.person?.sex
|
|
@@ -39576,32 +39684,32 @@ function modifyEvent(params) {
|
|
|
39576
39684
|
return !types.includes(participant.participantType) ? types.concat(participant.participantType) : types;
|
|
39577
39685
|
}, []);
|
|
39578
39686
|
const enteredParticipantGenders = unique(genderAccumulator);
|
|
39687
|
+
return { enteredParticipantTypes, enteredParticipantGenders };
|
|
39688
|
+
}
|
|
39689
|
+
function checkGenderUpdates({ enteredParticipantGenders, eventUpdates, stack }) {
|
|
39579
39690
|
const validGender = !enteredParticipantGenders.length ||
|
|
39580
39691
|
[MIXED, ANY].includes(eventUpdates.gender ?? '') ||
|
|
39581
39692
|
(enteredParticipantGenders.length === 1 && enteredParticipantGenders[0] === eventUpdates.gender);
|
|
39582
|
-
|
|
39583
|
-
|
|
39693
|
+
return eventUpdates.gender && !validGender
|
|
39694
|
+
? decorateResult({
|
|
39584
39695
|
context: { gender: eventUpdates.gender, validGender },
|
|
39585
|
-
result: { error:
|
|
39696
|
+
result: { error: INVALID_GENDER },
|
|
39586
39697
|
stack,
|
|
39587
|
-
})
|
|
39698
|
+
})
|
|
39699
|
+
: { ...SUCCESS };
|
|
39700
|
+
}
|
|
39701
|
+
function checkEventType({ enteredParticipantTypes, eventUpdates, stack }) {
|
|
39588
39702
|
const validEventTypes = (enteredParticipantTypes.includes(TEAM$2) && [TEAM$2]) ||
|
|
39589
39703
|
(enteredParticipantTypes.includes(INDIVIDUAL) && [SINGLES$1]) ||
|
|
39590
39704
|
(enteredParticipantTypes.includes(PAIR) && [DOUBLES$1]) || [DOUBLES$1, SINGLES$1, TEAM$2];
|
|
39591
39705
|
const validEventType = validEventTypes.includes(eventUpdates.eventType ?? '');
|
|
39592
|
-
|
|
39593
|
-
|
|
39706
|
+
return eventUpdates.eventType && !validEventType
|
|
39707
|
+
? decorateResult({
|
|
39594
39708
|
context: { participantType: eventUpdates.eventType, validEventType },
|
|
39595
|
-
result: { error:
|
|
39709
|
+
result: { error: INVALID_EVENT_TYPE },
|
|
39596
39710
|
stack,
|
|
39597
|
-
})
|
|
39598
|
-
|
|
39599
|
-
event.eventType = eventUpdates.eventType;
|
|
39600
|
-
if (eventUpdates.eventName)
|
|
39601
|
-
event.eventName = eventUpdates.eventName;
|
|
39602
|
-
if (eventUpdates.gender)
|
|
39603
|
-
event.gender = eventUpdates.gender;
|
|
39604
|
-
return { ...SUCCESS };
|
|
39711
|
+
})
|
|
39712
|
+
: { ...SUCCESS };
|
|
39605
39713
|
}
|
|
39606
39714
|
|
|
39607
39715
|
function addFlight({ qualifyingPositions, drawEntries = [], drawName, drawId, event, stage, }) {
|
|
@@ -51796,39 +51904,58 @@ function unPublishEventSeeding({ removePriorValues = true, seedingScaleNames, to
|
|
|
51796
51904
|
return { ...SUCCESS };
|
|
51797
51905
|
}
|
|
51798
51906
|
|
|
51799
|
-
function
|
|
51800
|
-
const tournamentRecords = params
|
|
51801
|
-
(params?.tournamentRecord && {
|
|
51802
|
-
[params.tournamentRecord.tournamentId]: params.tournamentRecord,
|
|
51803
|
-
}) ??
|
|
51804
|
-
{};
|
|
51907
|
+
function unPublishParticipants(params) {
|
|
51908
|
+
const tournamentRecords = resolveTournamentRecords(params);
|
|
51805
51909
|
if (!Object.keys(tournamentRecords).length)
|
|
51806
51910
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
51807
51911
|
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
51808
|
-
const result =
|
|
51809
|
-
tournamentRecord,
|
|
51810
|
-
...params,
|
|
51811
|
-
});
|
|
51912
|
+
const result = unpublish({ tournamentRecord, ...params });
|
|
51812
51913
|
if (result.error)
|
|
51813
51914
|
return result;
|
|
51814
51915
|
}
|
|
51815
51916
|
return { ...SUCCESS };
|
|
51816
51917
|
}
|
|
51817
|
-
function
|
|
51918
|
+
function unpublish({ removePriorValues = true, tournamentRecord, status = PUBLIC }) {
|
|
51818
51919
|
if (!tournamentRecord)
|
|
51819
51920
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
51820
51921
|
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
51821
|
-
const { timeItem } = getTimeItem({
|
|
51922
|
+
const { timeItem } = getTimeItem({ element: tournamentRecord, itemType });
|
|
51923
|
+
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
51924
|
+
if (itemValue[status])
|
|
51925
|
+
delete itemValue[status].participants;
|
|
51926
|
+
const updatedTimeItem = { itemValue, itemType };
|
|
51927
|
+
addTimeItem({
|
|
51928
|
+
timeItem: updatedTimeItem,
|
|
51822
51929
|
element: tournamentRecord,
|
|
51823
|
-
|
|
51930
|
+
removePriorValues,
|
|
51824
51931
|
});
|
|
51932
|
+
addNotice({
|
|
51933
|
+
payload: { tournamentId: tournamentRecord.tournamentId },
|
|
51934
|
+
topic: UNPUBLISH_PARTICIPANTS,
|
|
51935
|
+
});
|
|
51936
|
+
return { ...SUCCESS };
|
|
51937
|
+
}
|
|
51938
|
+
|
|
51939
|
+
function unPublishOrderOfPlay(params) {
|
|
51940
|
+
const tournamentRecords = resolveTournamentRecords(params);
|
|
51941
|
+
if (!Object.keys(tournamentRecords).length)
|
|
51942
|
+
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
51943
|
+
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
51944
|
+
const result = unPublishOOP({ tournamentRecord, ...params });
|
|
51945
|
+
if (result.error)
|
|
51946
|
+
return result;
|
|
51947
|
+
}
|
|
51948
|
+
return { ...SUCCESS };
|
|
51949
|
+
}
|
|
51950
|
+
function unPublishOOP({ removePriorValues = true, tournamentRecord, status = PUBLIC }) {
|
|
51951
|
+
if (!tournamentRecord)
|
|
51952
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
51953
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
51954
|
+
const { timeItem } = getTimeItem({ element: tournamentRecord, itemType });
|
|
51825
51955
|
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
51826
51956
|
if (itemValue[status])
|
|
51827
51957
|
delete itemValue[status].orderOfPlay;
|
|
51828
|
-
const updatedTimeItem = {
|
|
51829
|
-
itemValue,
|
|
51830
|
-
itemType,
|
|
51831
|
-
};
|
|
51958
|
+
const updatedTimeItem = { itemValue, itemType };
|
|
51832
51959
|
addTimeItem({
|
|
51833
51960
|
timeItem: updatedTimeItem,
|
|
51834
51961
|
element: tournamentRecord,
|
|
@@ -51843,34 +51970,56 @@ function unPublishOOP({ removePriorValues = true, tournamentRecord, status = PUB
|
|
|
51843
51970
|
return { ...SUCCESS };
|
|
51844
51971
|
}
|
|
51845
51972
|
|
|
51846
|
-
function
|
|
51973
|
+
function publishParticipants(params) {
|
|
51847
51974
|
const tournamentRecords = resolveTournamentRecords(params);
|
|
51848
51975
|
if (!Object.keys(tournamentRecords).length)
|
|
51849
51976
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
51850
51977
|
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
51851
|
-
const result =
|
|
51852
|
-
tournamentRecord,
|
|
51853
|
-
...params,
|
|
51854
|
-
});
|
|
51978
|
+
const result = publish({ tournamentRecord, ...params });
|
|
51855
51979
|
if (result.error)
|
|
51856
51980
|
return result;
|
|
51857
51981
|
}
|
|
51858
51982
|
return { ...SUCCESS };
|
|
51859
51983
|
}
|
|
51860
|
-
function
|
|
51984
|
+
function publish({ removePriorValues, tournamentRecord, status = PUBLIC }) {
|
|
51861
51985
|
if (!tournamentRecord)
|
|
51862
51986
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
51863
51987
|
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
51864
|
-
const { timeItem } = getTimeItem({
|
|
51988
|
+
const { timeItem } = getTimeItem({ element: tournamentRecord, itemType });
|
|
51989
|
+
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
51990
|
+
itemValue[status].participants = { published: true };
|
|
51991
|
+
const updatedTimeItem = { itemValue, itemType };
|
|
51992
|
+
addTimeItem({
|
|
51993
|
+
timeItem: updatedTimeItem,
|
|
51865
51994
|
element: tournamentRecord,
|
|
51866
|
-
|
|
51995
|
+
removePriorValues,
|
|
51867
51996
|
});
|
|
51997
|
+
addNotice({
|
|
51998
|
+
payload: { tournamentId: tournamentRecord.tournamentId },
|
|
51999
|
+
topic: PUBLISH_PARTICIPANTS,
|
|
52000
|
+
});
|
|
52001
|
+
return { ...SUCCESS };
|
|
52002
|
+
}
|
|
52003
|
+
|
|
52004
|
+
function publishOrderOfPlay(params) {
|
|
52005
|
+
const tournamentRecords = resolveTournamentRecords(params);
|
|
52006
|
+
if (!Object.keys(tournamentRecords).length)
|
|
52007
|
+
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
52008
|
+
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
52009
|
+
const result = publishOOP({ tournamentRecord, ...params });
|
|
52010
|
+
if (result.error)
|
|
52011
|
+
return result;
|
|
52012
|
+
}
|
|
52013
|
+
return { ...SUCCESS };
|
|
52014
|
+
}
|
|
52015
|
+
function publishOOP({ scheduledDates = [], removePriorValues, tournamentRecord, status = PUBLIC, eventIds = [] }) {
|
|
52016
|
+
if (!tournamentRecord)
|
|
52017
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
52018
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
52019
|
+
const { timeItem } = getTimeItem({ element: tournamentRecord, itemType });
|
|
51868
52020
|
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
51869
52021
|
itemValue[status].orderOfPlay = { published: true, scheduledDates, eventIds };
|
|
51870
|
-
const updatedTimeItem = {
|
|
51871
|
-
itemValue,
|
|
51872
|
-
itemType,
|
|
51873
|
-
};
|
|
52022
|
+
const updatedTimeItem = { itemValue, itemType };
|
|
51874
52023
|
addTimeItem({
|
|
51875
52024
|
timeItem: updatedTimeItem,
|
|
51876
52025
|
element: tournamentRecord,
|
|
@@ -51928,10 +52077,12 @@ var mutate$4 = {
|
|
|
51928
52077
|
publishEvent: publishEvent,
|
|
51929
52078
|
publishEventSeeding: publishEventSeeding,
|
|
51930
52079
|
publishOrderOfPlay: publishOrderOfPlay,
|
|
52080
|
+
publishParticipants: publishParticipants,
|
|
51931
52081
|
setEventDisplay: setEventDisplay,
|
|
51932
52082
|
unPublishEvent: unPublishEvent,
|
|
51933
52083
|
unPublishEventSeeding: unPublishEventSeeding,
|
|
51934
|
-
unPublishOrderOfPlay: unPublishOrderOfPlay
|
|
52084
|
+
unPublishOrderOfPlay: unPublishOrderOfPlay,
|
|
52085
|
+
unPublishParticipants: unPublishParticipants
|
|
51935
52086
|
};
|
|
51936
52087
|
|
|
51937
52088
|
var index$7 = {
|
|
@@ -51943,16 +52094,19 @@ var index$7 = {
|
|
|
51943
52094
|
getEventData: getEventData,
|
|
51944
52095
|
getEventPublishStatus: getEventPublishStatus,
|
|
51945
52096
|
getPublishState: getPublishState,
|
|
52097
|
+
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
51946
52098
|
getVenueData: getVenueData,
|
|
51947
52099
|
mutate: mutate$4,
|
|
51948
52100
|
publishEvent: publishEvent,
|
|
51949
52101
|
publishEventSeeding: publishEventSeeding,
|
|
51950
52102
|
publishOrderOfPlay: publishOrderOfPlay,
|
|
52103
|
+
publishParticipants: publishParticipants,
|
|
51951
52104
|
query: query$5,
|
|
51952
52105
|
setEventDisplay: setEventDisplay,
|
|
51953
52106
|
unPublishEvent: unPublishEvent,
|
|
51954
52107
|
unPublishEventSeeding: unPublishEventSeeding,
|
|
51955
|
-
unPublishOrderOfPlay: unPublishOrderOfPlay
|
|
52108
|
+
unPublishOrderOfPlay: unPublishOrderOfPlay,
|
|
52109
|
+
unPublishParticipants: unPublishParticipants
|
|
51956
52110
|
};
|
|
51957
52111
|
|
|
51958
52112
|
function getParticipantStats({ withCompetitiveProfiles, opponentParticipantId, withIndividualStats, teamParticipantId, tournamentRecord, withScaleValues, tallyPolicy, matchUps, }) {
|