tods-competition-factory 1.8.44 → 1.8.46
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 +53 -22
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +12 -1
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +4956 -4942
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +95 -44
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +146 -90
- 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/forge/generate.mjs
CHANGED
|
@@ -16444,7 +16444,7 @@ function ensureSideLineUps({
|
|
|
16444
16444
|
dualMatchUp,
|
|
16445
16445
|
eventId
|
|
16446
16446
|
}) {
|
|
16447
|
-
if (dualMatchUp
|
|
16447
|
+
if (dualMatchUp) {
|
|
16448
16448
|
if (!inContextDualMatchUp) {
|
|
16449
16449
|
inContextDualMatchUp = findDrawMatchUp({
|
|
16450
16450
|
matchUpId: dualMatchUp.matchUpId,
|
|
@@ -16462,11 +16462,17 @@ function ensureSideLineUps({
|
|
|
16462
16462
|
drawPosition,
|
|
16463
16463
|
sideNumber
|
|
16464
16464
|
}) => ({ drawPosition, sideNumber, displaySideNumber });
|
|
16465
|
-
dualMatchUp.sides = inContextDualMatchUp?.sides?.map((
|
|
16466
|
-
const participantId =
|
|
16465
|
+
dualMatchUp.sides = inContextDualMatchUp?.sides?.map((contextSide) => {
|
|
16466
|
+
const participantId = contextSide.participantId;
|
|
16467
|
+
const referenceLineUp = participantId && lineUps[participantId] || void 0;
|
|
16468
|
+
const { lineUp: noContextLineUp, ...noContextSideDetail } = dualMatchUp.sides?.find(
|
|
16469
|
+
({ sideNumber }) => sideNumber === contextSide.sideNumber
|
|
16470
|
+
) ?? {};
|
|
16471
|
+
const lineUp = noContextLineUp?.length ? noContextLineUp : referenceLineUp;
|
|
16467
16472
|
return {
|
|
16468
|
-
...extractSideDetail(
|
|
16469
|
-
|
|
16473
|
+
...extractSideDetail(contextSide),
|
|
16474
|
+
...noContextSideDetail,
|
|
16475
|
+
lineUp
|
|
16470
16476
|
};
|
|
16471
16477
|
});
|
|
16472
16478
|
modifyMatchUpNotice({
|
|
@@ -16481,20 +16487,17 @@ function ensureSideLineUps({
|
|
|
16481
16487
|
|
|
16482
16488
|
const mixedGenderError = "MIXED events can not contain mixed singles or { gender: ANY } collections";
|
|
16483
16489
|
const anyMixedError = "events with { gender: ANY } can not contain MIXED singles collections";
|
|
16484
|
-
function tieFormatGenderValidityCheck({
|
|
16485
|
-
referenceEvent,
|
|
16486
|
-
referenceGender,
|
|
16487
|
-
matchUpType,
|
|
16488
|
-
gender
|
|
16489
|
-
}) {
|
|
16490
|
+
function tieFormatGenderValidityCheck(params) {
|
|
16490
16491
|
const stack = "tieFormatGenderValidityCheck";
|
|
16492
|
+
const { referenceGender, matchUpType, gender } = params;
|
|
16491
16493
|
if (referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) && referenceGender !== gender)
|
|
16492
16494
|
return decorateResult({
|
|
16493
16495
|
result: { valid: false, error: INVALID_GENDER },
|
|
16494
16496
|
context: { gender },
|
|
16495
16497
|
stack
|
|
16496
16498
|
});
|
|
16497
|
-
|
|
16499
|
+
const eventType = params.eventType ?? params.referenceEvent?.eventType;
|
|
16500
|
+
if (referenceGender === MIXED && (eventType !== TEAM$2 || gender === ANY || gender === MIXED && matchUpType !== TypeEnum.Doubles)) {
|
|
16498
16501
|
return decorateResult({
|
|
16499
16502
|
result: { error: INVALID_GENDER, valid: false },
|
|
16500
16503
|
info: mixedGenderError,
|
|
@@ -16849,6 +16852,7 @@ function validateTieFormat(params) {
|
|
|
16849
16852
|
const checkGender = !!(params?.enforceGender !== false && params?.gender);
|
|
16850
16853
|
const checkCollectionIds = params?.checkCollectionIds;
|
|
16851
16854
|
const tieFormat = params?.tieFormat;
|
|
16855
|
+
const event = params?.event;
|
|
16852
16856
|
const stack = "validateTieFormat";
|
|
16853
16857
|
const errors = [];
|
|
16854
16858
|
if (!params || !tieFormat || typeof tieFormat !== "object") {
|
|
@@ -16884,10 +16888,12 @@ function validateTieFormat(params) {
|
|
|
16884
16888
|
const { valid: valid2, errors: collectionDefinitionErrors } = validateCollectionDefinition({
|
|
16885
16889
|
referenceCategory: params.category,
|
|
16886
16890
|
referenceGender: params.gender,
|
|
16891
|
+
eventType: params.eventType,
|
|
16887
16892
|
collectionDefinition,
|
|
16888
16893
|
checkCollectionIds,
|
|
16889
16894
|
checkCategory,
|
|
16890
|
-
checkGender
|
|
16895
|
+
checkGender,
|
|
16896
|
+
event
|
|
16891
16897
|
});
|
|
16892
16898
|
if (valid2) {
|
|
16893
16899
|
return true;
|
|
@@ -16934,6 +16940,7 @@ function validateCollectionDefinition({
|
|
|
16934
16940
|
checkGender = true,
|
|
16935
16941
|
referenceCategory,
|
|
16936
16942
|
referenceGender,
|
|
16943
|
+
eventType,
|
|
16937
16944
|
event
|
|
16938
16945
|
}) {
|
|
16939
16946
|
referenceGender = referenceGender ?? event?.gender;
|
|
@@ -17001,7 +17008,7 @@ function validateCollectionDefinition({
|
|
|
17001
17008
|
}
|
|
17002
17009
|
if (checkGender) {
|
|
17003
17010
|
const result = tieFormatGenderValidityCheck({
|
|
17004
|
-
|
|
17011
|
+
eventType: eventType ?? event?.eventType,
|
|
17005
17012
|
referenceGender,
|
|
17006
17013
|
matchUpType,
|
|
17007
17014
|
gender
|
|
@@ -17033,8 +17040,15 @@ function validateCollectionDefinition({
|
|
|
17033
17040
|
});
|
|
17034
17041
|
return { valid: true };
|
|
17035
17042
|
}
|
|
17036
|
-
function checkTieFormat(
|
|
17037
|
-
|
|
17043
|
+
function checkTieFormat({
|
|
17044
|
+
tieFormat,
|
|
17045
|
+
eventType
|
|
17046
|
+
}) {
|
|
17047
|
+
const result = validateTieFormat({
|
|
17048
|
+
checkCollectionIds: false,
|
|
17049
|
+
eventType,
|
|
17050
|
+
tieFormat
|
|
17051
|
+
});
|
|
17038
17052
|
if (result.error)
|
|
17039
17053
|
return result;
|
|
17040
17054
|
for (const collectionDefinition of tieFormat.collectionDefinitions) {
|
|
@@ -17259,7 +17273,7 @@ function generateTieMatchUpScore(params) {
|
|
|
17259
17273
|
const tieFormat = resolveTieFormat({ matchUp, drawDefinition, structure, event })?.tieFormat || params?.tieFormat;
|
|
17260
17274
|
if (!tieFormat)
|
|
17261
17275
|
return { error: MISSING_TIE_FORMAT };
|
|
17262
|
-
const result = validateTieFormat({ tieFormat });
|
|
17276
|
+
const result = validateTieFormat({ tieFormat, eventType: event?.eventType });
|
|
17263
17277
|
if (result.error)
|
|
17264
17278
|
return result;
|
|
17265
17279
|
const collectionDefinitions = tieFormat?.collectionDefinitions || [];
|
|
@@ -19002,6 +19016,15 @@ function getParticipantEntries(params) {
|
|
|
19002
19016
|
individualParticipantIds?.forEach(addDrawEntry);
|
|
19003
19017
|
}
|
|
19004
19018
|
}
|
|
19019
|
+
const stages = (drawDefinition?.structures ?? []).reduce(
|
|
19020
|
+
(stages2, structure) => {
|
|
19021
|
+
if (!stages2.includes(structure.stage))
|
|
19022
|
+
stages2.push(structure.stage);
|
|
19023
|
+
return stages2;
|
|
19024
|
+
},
|
|
19025
|
+
[]
|
|
19026
|
+
);
|
|
19027
|
+
const linksCount = (drawDefinition?.links ?? []).length;
|
|
19005
19028
|
derivedDrawInfo[drawId] = {
|
|
19006
19029
|
qualifyingPositionAssignments,
|
|
19007
19030
|
qualifyingSeedAssignments,
|
|
@@ -19011,11 +19034,13 @@ function getParticipantEntries(params) {
|
|
|
19011
19034
|
orderedStructureIds,
|
|
19012
19035
|
mainSeedingMap,
|
|
19013
19036
|
flightNumber,
|
|
19037
|
+
linksCount,
|
|
19014
19038
|
drawOrder,
|
|
19015
19039
|
drawName,
|
|
19016
19040
|
drawType,
|
|
19017
19041
|
drawSize,
|
|
19018
|
-
drawId
|
|
19042
|
+
drawId,
|
|
19043
|
+
stages
|
|
19019
19044
|
// qualifyingDrawSize,
|
|
19020
19045
|
};
|
|
19021
19046
|
}
|
|
@@ -20130,7 +20155,8 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
20130
20155
|
return { error: INVALID_DRAW_SIZE };
|
|
20131
20156
|
let { tieFormat, matchUpType } = params;
|
|
20132
20157
|
if (tieFormat) {
|
|
20133
|
-
const
|
|
20158
|
+
const eventType = params.event?.eventType;
|
|
20159
|
+
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
20134
20160
|
if (result2.error)
|
|
20135
20161
|
return result2;
|
|
20136
20162
|
}
|
|
@@ -21232,7 +21258,8 @@ function generateDrawTypeAndModifyDrawDefinition(params) {
|
|
|
21232
21258
|
const drawDefinition = modifyOriginal ? params.drawDefinition : makeDeepCopy(params.drawDefinition, false, true);
|
|
21233
21259
|
let { tieFormat, matchUpType } = params;
|
|
21234
21260
|
if (tieFormat) {
|
|
21235
|
-
const
|
|
21261
|
+
const eventType = params.event?.eventType;
|
|
21262
|
+
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
21236
21263
|
if (result2.error)
|
|
21237
21264
|
return result2;
|
|
21238
21265
|
}
|
|
@@ -23717,7 +23744,8 @@ function generateDrawDefinition(params) {
|
|
|
23717
23744
|
const result = validateTieFormat({
|
|
23718
23745
|
gender: event?.gender,
|
|
23719
23746
|
enforceGender,
|
|
23720
|
-
tieFormat
|
|
23747
|
+
tieFormat,
|
|
23748
|
+
event
|
|
23721
23749
|
});
|
|
23722
23750
|
if (result.error)
|
|
23723
23751
|
return decorateResult({ result, stack });
|
|
@@ -23736,7 +23764,10 @@ function generateDrawDefinition(params) {
|
|
|
23736
23764
|
const equivalentInScope = matchUpFormat && event?.matchUpFormat === matchUpFormat || event?.tieFormat && tieFormat && JSON.stringify(event.tieFormat) === JSON.stringify(tieFormat);
|
|
23737
23765
|
if (!equivalentInScope) {
|
|
23738
23766
|
if (tieFormat) {
|
|
23739
|
-
const result = checkTieFormat(
|
|
23767
|
+
const result = checkTieFormat({
|
|
23768
|
+
eventType: event.eventType,
|
|
23769
|
+
tieFormat
|
|
23770
|
+
});
|
|
23740
23771
|
if (result.error)
|
|
23741
23772
|
return decorateResult({ result, stack });
|
|
23742
23773
|
drawDefinition.tieFormat = result.tieFormat ?? tieFormat;
|