tods-competition-factory 2.1.8 → 2.1.10
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 +7 -7
- package/dist/tods-competition-factory.d.ts +5 -5
- package/dist/tods-competition-factory.development.cjs.js +36 -23
- 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 +12 -12
|
@@ -6479,13 +6479,13 @@ declare function modifyParticipantName({ tournamentRecord, participantName, part
|
|
|
6479
6479
|
};
|
|
6480
6480
|
|
|
6481
6481
|
type ScaledTeamAssignmentArgs = {
|
|
6482
|
-
clearExistingAssignments?: boolean;
|
|
6483
6482
|
individualParticipantIds?: string[];
|
|
6483
|
+
clearExistingAssignments?: boolean;
|
|
6484
6484
|
reverseAssignmentOrder?: boolean;
|
|
6485
|
-
initialTeamIndex?: number;
|
|
6486
|
-
scaledParticipants?: any[];
|
|
6487
6485
|
teamParticipantIds?: string[];
|
|
6488
6486
|
tournamentRecord: Tournament;
|
|
6487
|
+
scaledParticipants?: any[];
|
|
6488
|
+
initialTeamIndex?: number;
|
|
6489
6489
|
scaleAttributes?: any;
|
|
6490
6490
|
teamNameBase?: string;
|
|
6491
6491
|
teamsCount?: number;
|
|
@@ -9820,8 +9820,8 @@ declare function constantToString(str: any): any;
|
|
|
9820
9820
|
|
|
9821
9821
|
declare function numericSort(a: any, b: any): number;
|
|
9822
9822
|
|
|
9823
|
-
declare function UUIDS(count?: number): string[];
|
|
9824
|
-
declare function UUID(): string;
|
|
9823
|
+
declare function UUIDS(count?: number, pre?: any): string[];
|
|
9824
|
+
declare function UUID(pre?: any): string;
|
|
9825
9825
|
|
|
9826
9826
|
declare function unique(arr: any): any[];
|
|
9827
9827
|
declare function noNulls(arr: any): any;
|
|
@@ -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.10';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -1573,9 +1573,8 @@ function enableNotifications() {
|
|
|
1573
1573
|
_globalStateProvider.enableNotifications();
|
|
1574
1574
|
}
|
|
1575
1575
|
function setDeepCopy(value, attributes) {
|
|
1576
|
-
if (typeof value === 'boolean')
|
|
1576
|
+
if (typeof value === 'boolean')
|
|
1577
1577
|
globalState.deepCopy = value;
|
|
1578
|
-
}
|
|
1579
1578
|
if (typeof attributes === 'object') {
|
|
1580
1579
|
if (Array.isArray(attributes.ignore))
|
|
1581
1580
|
globalState.deepCopyAttributes.ignore = attributes.ignore;
|
|
@@ -6920,10 +6919,10 @@ function matchUpStartTime({ matchUp }) {
|
|
|
6920
6919
|
return { startTime };
|
|
6921
6920
|
}
|
|
6922
6921
|
|
|
6923
|
-
function UUIDS(count = 1) {
|
|
6924
|
-
return generateRange(0, count).map(UUID);
|
|
6922
|
+
function UUIDS(count = 1, pre) {
|
|
6923
|
+
return generateRange(0, count).map(() => UUID(pre));
|
|
6925
6924
|
}
|
|
6926
|
-
function UUID() {
|
|
6925
|
+
function UUID(pre) {
|
|
6927
6926
|
const lut = [];
|
|
6928
6927
|
for (let i = 0; i < 256; i++) {
|
|
6929
6928
|
lut[i] = (i < 16 ? '0' : '') + i.toString(16);
|
|
@@ -6932,7 +6931,7 @@ function UUID() {
|
|
|
6932
6931
|
const d1 = (Math.random() * 0xffffffff) | 0;
|
|
6933
6932
|
const d2 = (Math.random() * 0xffffffff) | 0;
|
|
6934
6933
|
const d3 = (Math.random() * 0xffffffff) | 0;
|
|
6935
|
-
|
|
6934
|
+
const uuid = lut[d0 & 0xff] +
|
|
6936
6935
|
lut[(d0 >> 8) & 0xff] +
|
|
6937
6936
|
lut[(d0 >> 16) & 0xff] +
|
|
6938
6937
|
lut[(d0 >> 24) & 0xff] +
|
|
@@ -6951,7 +6950,8 @@ function UUID() {
|
|
|
6951
6950
|
lut[d3 & 0xff] +
|
|
6952
6951
|
lut[(d3 >> 8) & 0xff] +
|
|
6953
6952
|
lut[(d3 >> 16) & 0xff] +
|
|
6954
|
-
lut[(d3 >> 24) & 0xff]
|
|
6953
|
+
lut[(d3 >> 24) & 0xff];
|
|
6954
|
+
return typeof pre === 'string' ? `${pre}_${uuid.replace(/-/g, '')}` : uuid;
|
|
6955
6955
|
}
|
|
6956
6956
|
|
|
6957
6957
|
function addVenue(params) {
|
|
@@ -11100,8 +11100,7 @@ function removeDrawPosition$1({ inContextDrawMatchUps, positionAssignments, tour
|
|
|
11100
11100
|
(targetMatchUp.matchUpStatus &&
|
|
11101
11101
|
[DEFAULTED, WALKOVER$2].includes(targetMatchUp.matchUpStatus) &&
|
|
11102
11102
|
targetMatchUp.matcHUpStatus) ||
|
|
11103
|
-
|
|
11104
|
-
undefined;
|
|
11103
|
+
TO_BE_PLAYED;
|
|
11105
11104
|
targetMatchUp.matchUpStatus = newMatchUpStatus;
|
|
11106
11105
|
if (targetMatchUp.matchUpStatus && [WALKOVER$2, DEFAULTED].includes(targetMatchUp.matchUpStatus))
|
|
11107
11106
|
targetMatchUp.winningSide = undefined;
|
|
@@ -11119,9 +11118,9 @@ function removeDrawPosition$1({ inContextDrawMatchUps, positionAssignments, tour
|
|
|
11119
11118
|
}
|
|
11120
11119
|
modifyMatchUpNotice({
|
|
11121
11120
|
tournamentId: tournamentRecord?.tournamentId,
|
|
11121
|
+
context: `${stack}-${drawPosition}`,
|
|
11122
11122
|
eventId: event?.eventId,
|
|
11123
11123
|
matchUp: targetMatchUp,
|
|
11124
|
-
context: `${stack}-${drawPosition}`,
|
|
11125
11124
|
drawDefinition,
|
|
11126
11125
|
});
|
|
11127
11126
|
}
|
|
@@ -25904,6 +25903,7 @@ function getCoercedDrawType(params) {
|
|
|
25904
25903
|
const { drawTypeCoercion, enforceMinimumDrawSize } = params;
|
|
25905
25904
|
const drawSize = ensureInt(params.drawSize);
|
|
25906
25905
|
let drawType = (drawTypeCoercion &&
|
|
25906
|
+
params.drawType !== AD_HOC &&
|
|
25907
25907
|
(typeof drawTypeCoercion === 'boolean' || drawTypeCoercion <= 2) &&
|
|
25908
25908
|
drawSize === 2 &&
|
|
25909
25909
|
SINGLE_ELIMINATION) ||
|
|
@@ -42480,8 +42480,8 @@ function removeDirectedBye({ inContextDrawMatchUps, tournamentRecord, drawDefini
|
|
|
42480
42480
|
inContextDrawMatchUps,
|
|
42481
42481
|
tournamentRecord,
|
|
42482
42482
|
drawDefinition,
|
|
42483
|
-
matchUpsMap,
|
|
42484
42483
|
drawPosition,
|
|
42484
|
+
matchUpsMap,
|
|
42485
42485
|
structureId,
|
|
42486
42486
|
event,
|
|
42487
42487
|
});
|
|
@@ -43165,11 +43165,11 @@ function removeDoubleExit(params) {
|
|
|
43165
43165
|
if (byePropagatedToLoserMatchUp && isFMLC) {
|
|
43166
43166
|
const roundMatchUps = inContextDrawMatchUps.filter(({ roundNumber, structureId }) => structureId === matchUp.structureId && roundNumber === 1);
|
|
43167
43167
|
const roundPositions = roundMatchUps.map(({ roundPosition }) => roundPosition);
|
|
43168
|
-
const
|
|
43169
|
-
|
|
43170
|
-
.filter((
|
|
43171
|
-
|
|
43172
|
-
const pairedMatchUpIsDoubleExit = [DOUBLE_DEFAULT, DOUBLE_WALKOVER].includes(
|
|
43168
|
+
const pairedPositions = chunkArray(roundPositions.sort(), 2).find((chunk) => chunk.includes(matchUp.roundPosition));
|
|
43169
|
+
const pairedMatchUpStatuses = roundMatchUps
|
|
43170
|
+
.filter(({ roundPosition }) => pairedPositions.includes(roundPosition))
|
|
43171
|
+
?.map(({ matchUpStatus }) => matchUpStatus);
|
|
43172
|
+
const pairedMatchUpIsDoubleExit = pairedMatchUpStatuses.every((matchUpStatus) => [DOUBLE_DEFAULT, DOUBLE_WALKOVER].includes(matchUpStatus));
|
|
43173
43173
|
if (pairedMatchUpIsDoubleExit) {
|
|
43174
43174
|
return decorateResult({ result: { ...SUCCESS }, stack });
|
|
43175
43175
|
}
|
|
@@ -44323,8 +44323,8 @@ function setMatchUpState(params) {
|
|
|
44323
44323
|
AWAITING_RESULT,
|
|
44324
44324
|
].includes(matchUpStatus)) {
|
|
44325
44325
|
return {
|
|
44326
|
-
error: INVALID_VALUES,
|
|
44327
44326
|
info: 'Not supported for matchUpType: TEAM',
|
|
44327
|
+
error: INVALID_VALUES,
|
|
44328
44328
|
};
|
|
44329
44329
|
}
|
|
44330
44330
|
const matchUpTieId = inContextMatchUp?.matchUpTieId;
|
|
@@ -44342,9 +44342,8 @@ function setMatchUpState(params) {
|
|
|
44342
44342
|
winningSide,
|
|
44343
44343
|
score,
|
|
44344
44344
|
});
|
|
44345
|
-
if (result.error)
|
|
44345
|
+
if (result.error)
|
|
44346
44346
|
return result;
|
|
44347
|
-
}
|
|
44348
44347
|
}
|
|
44349
44348
|
const appliedPolicies = getAppliedPolicies({
|
|
44350
44349
|
policyTypes: [POLICY_TYPE_PROGRESSION, POLICY_TYPE_SCORING],
|
|
@@ -49662,7 +49661,7 @@ function generateEventWithDraw(params) {
|
|
|
49662
49661
|
return paramsCheck;
|
|
49663
49662
|
const { allUniqueParticipantIds = [], participantsProfile = {}, matchUpStatusProfile, completeAllMatchUps, autoEntryPositions, hydrateCollections, randomWinningSide, ratingsParameters, tournamentRecord, isMock = true, drawProfile, startDate, drawIndex, uuids, } = params;
|
|
49664
49663
|
const drawProfileCopy = makeDeepCopy(drawProfile, false, true);
|
|
49665
|
-
const { excessParticipantAlternates = true, matchUpFormat = FORMAT_STANDARD, drawType = SINGLE_ELIMINATION, tournamentAlternates = 0, alternatesCount = 0, qualifyingPositions, qualifyingProfiles, generate = true, eventExtensions, drawExtensions, completionGoal, tieFormatName, seedsCount, timeItems, drawName, category, idPrefix, publish, gender, stage, } = drawProfileCopy;
|
|
49664
|
+
const { excessParticipantAlternates = true, matchUpFormat = FORMAT_STANDARD, drawType = SINGLE_ELIMINATION, tournamentAlternates = 0, alternatesCount = 0, qualifyingPositions, qualifyingProfiles, generate = true, eventExtensions, drawExtensions, completionGoal, tieFormatName, buildTeams, seedsCount, timeItems, drawName, category, idPrefix, publish, gender, stage, } = drawProfileCopy;
|
|
49666
49665
|
const drawSize = drawProfileCopy.drawSize || (drawProfileCopy.ignoreDefaults ? undefined : 32);
|
|
49667
49666
|
const eventId = drawProfileCopy.eventId || UUID();
|
|
49668
49667
|
const eventType = drawProfile.eventType || drawProfile.matchUpType || SINGLES$1;
|
|
@@ -49777,11 +49776,12 @@ function generateEventWithDraw(params) {
|
|
|
49777
49776
|
fIndex += genders[FEMALE];
|
|
49778
49777
|
mIndex += genders[MALE];
|
|
49779
49778
|
rIndex += mixedCount;
|
|
49779
|
+
const individualParticipantIds = buildTeams !== false ? [...fPIDs, ...mPIDs, ...rIDs] : [];
|
|
49780
49780
|
return {
|
|
49781
|
-
individualParticipantIds: [...fPIDs, ...mPIDs, ...rIDs],
|
|
49782
49781
|
participantOtherName: `TM${teamIndex + 1}`,
|
|
49783
49782
|
participantName: `Team ${teamIndex + 1}`,
|
|
49784
49783
|
participantRole: COMPETITOR,
|
|
49784
|
+
individualParticipantIds,
|
|
49785
49785
|
participantType: TEAM,
|
|
49786
49786
|
participantId: UUID(),
|
|
49787
49787
|
};
|
|
@@ -50679,6 +50679,8 @@ function anonymizeTournamentRecord({ keepExtensions = [], anonymizeParticipantNa
|
|
|
50679
50679
|
tournamentRecord.isMock = true;
|
|
50680
50680
|
delete tournamentRecord.parentOrganisation;
|
|
50681
50681
|
for (const participant of tournamentRecord.participants || []) {
|
|
50682
|
+
participant.extensions = filterExtensions(participant);
|
|
50683
|
+
participant.onlineResources = [];
|
|
50682
50684
|
const newParticipantId = UUID();
|
|
50683
50685
|
idMap[participant.participantId] = newParticipantId;
|
|
50684
50686
|
participant.participantId = newParticipantId;
|
|
@@ -50690,17 +50692,28 @@ function anonymizeTournamentRecord({ keepExtensions = [], anonymizeParticipantNa
|
|
|
50690
50692
|
}
|
|
50691
50693
|
let venueIndex = 0;
|
|
50692
50694
|
for (const venue of tournamentRecord.venues || []) {
|
|
50695
|
+
venue.venueAbbreviation = `V${venueIndex}`;
|
|
50693
50696
|
venue.extensions = filterExtensions(venue);
|
|
50694
50697
|
venue.venueName = `Venue #${venueIndex}`;
|
|
50695
|
-
venue.
|
|
50698
|
+
venue.onlineResources = [];
|
|
50699
|
+
venue.addresses = [];
|
|
50696
50700
|
const newVenueId = UUID();
|
|
50697
50701
|
idMap[venue.venueId] = newVenueId;
|
|
50698
50702
|
venue.isMock = true;
|
|
50699
50703
|
venueIndex += 1;
|
|
50704
|
+
let courtIndex = 0;
|
|
50705
|
+
for (const court of venue.courts || []) {
|
|
50706
|
+
court.courtName = `V${venueIndex}C${courtIndex}`;
|
|
50707
|
+
court.extensions = filterExtensions(court);
|
|
50708
|
+
court.onlineResources = [];
|
|
50709
|
+
court.isMock = true;
|
|
50710
|
+
courtIndex += 1;
|
|
50711
|
+
}
|
|
50700
50712
|
}
|
|
50701
50713
|
let eventCount = 1;
|
|
50702
50714
|
for (const event of tournamentRecord.events || []) {
|
|
50703
50715
|
event.extensions = filterExtensions(event);
|
|
50716
|
+
event.onlineResources = [];
|
|
50704
50717
|
event.isMock = true;
|
|
50705
50718
|
const newEventId = UUID();
|
|
50706
50719
|
idMap[event.eventId] = newEventId;
|