tods-competition-factory 2.2.32 → 2.2.34
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 +16 -0
- package/dist/tods-competition-factory.development.cjs.js +70 -8
- 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 +8 -8
|
@@ -2533,6 +2533,7 @@ type GenerateDrawDefinitionArgs = {
|
|
|
2533
2533
|
hydrateCollections?: boolean;
|
|
2534
2534
|
tournamentRecord: Tournament;
|
|
2535
2535
|
matchUpType?: EventTypeUnion;
|
|
2536
|
+
hydrateRoundNames?: boolean;
|
|
2536
2537
|
drawTypeCoercion?: boolean;
|
|
2537
2538
|
ignoreStageSpace?: boolean;
|
|
2538
2539
|
qualifyingProfiles?: any[];
|
|
@@ -10299,6 +10300,17 @@ declare namespace generate$1 {
|
|
|
10299
10300
|
};
|
|
10300
10301
|
}
|
|
10301
10302
|
|
|
10303
|
+
declare function hydrateTournamentRecord(params: any): {
|
|
10304
|
+
error: {
|
|
10305
|
+
message: string;
|
|
10306
|
+
code: string;
|
|
10307
|
+
};
|
|
10308
|
+
tournamentRecord?: undefined;
|
|
10309
|
+
} | {
|
|
10310
|
+
tournamentRecord: any;
|
|
10311
|
+
error?: undefined;
|
|
10312
|
+
};
|
|
10313
|
+
|
|
10302
10314
|
declare function setTournamentStatus({ tournamentRecord, status }: {
|
|
10303
10315
|
tournamentRecord: any;
|
|
10304
10316
|
status: any;
|
|
@@ -10580,6 +10592,7 @@ declare const mutate$1_addParticipantTimeItem: typeof addParticipantTimeItem;
|
|
|
10580
10592
|
declare const mutate$1_addTimeItem: typeof addTimeItem;
|
|
10581
10593
|
declare const mutate$1_addTournamentExtension: typeof addTournamentExtension;
|
|
10582
10594
|
declare const mutate$1_addTournamentTimeItem: typeof addTournamentTimeItem;
|
|
10595
|
+
declare const mutate$1_hydrateTournamentRecord: typeof hydrateTournamentRecord;
|
|
10583
10596
|
declare const mutate$1_removeDrawDefinitionExtension: typeof removeDrawDefinitionExtension;
|
|
10584
10597
|
declare const mutate$1_removeEventExtension: typeof removeEventExtension;
|
|
10585
10598
|
declare const mutate$1_removeExtension: typeof removeExtension;
|
|
@@ -10607,6 +10620,7 @@ declare namespace mutate$1 {
|
|
|
10607
10620
|
mutate$1_addTimeItem as addTimeItem,
|
|
10608
10621
|
mutate$1_addTournamentExtension as addTournamentExtension,
|
|
10609
10622
|
mutate$1_addTournamentTimeItem as addTournamentTimeItem,
|
|
10623
|
+
mutate$1_hydrateTournamentRecord as hydrateTournamentRecord,
|
|
10610
10624
|
mutate$1_removeDrawDefinitionExtension as removeDrawDefinitionExtension,
|
|
10611
10625
|
mutate$1_removeEventExtension as removeEventExtension,
|
|
10612
10626
|
mutate$1_removeExtension as removeExtension,
|
|
@@ -10652,6 +10666,7 @@ declare const index$4_getTournamentPersons: typeof getTournamentPersons;
|
|
|
10652
10666
|
declare const index$4_getTournamentPoints: typeof getTournamentPoints;
|
|
10653
10667
|
declare const index$4_getTournamentStructures: typeof getTournamentStructures;
|
|
10654
10668
|
declare const index$4_getTournamentTimeItem: typeof getTournamentTimeItem;
|
|
10669
|
+
declare const index$4_hydrateTournamentRecord: typeof hydrateTournamentRecord;
|
|
10655
10670
|
declare const index$4_removeDrawDefinitionExtension: typeof removeDrawDefinitionExtension;
|
|
10656
10671
|
declare const index$4_removeEventExtension: typeof removeEventExtension;
|
|
10657
10672
|
declare const index$4_removeExtension: typeof removeExtension;
|
|
@@ -10697,6 +10712,7 @@ declare namespace index$4 {
|
|
|
10697
10712
|
index$4_getTournamentPoints as getTournamentPoints,
|
|
10698
10713
|
index$4_getTournamentStructures as getTournamentStructures,
|
|
10699
10714
|
index$4_getTournamentTimeItem as getTournamentTimeItem,
|
|
10715
|
+
index$4_hydrateTournamentRecord as hydrateTournamentRecord,
|
|
10700
10716
|
mutate$1 as mutate,
|
|
10701
10717
|
query$4 as query,
|
|
10702
10718
|
index$4_removeDrawDefinitionExtension as removeDrawDefinitionExtension,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.2.
|
|
6
|
+
return '2.2.34';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SINGLES_MATCHUP = 'SINGLES';
|
|
@@ -38436,10 +38436,13 @@ function getConsideredEntries({ considerEventEntries = true, drawEntries, eventE
|
|
|
38436
38436
|
}
|
|
38437
38437
|
function getPolicies(params) {
|
|
38438
38438
|
const { tournamentRecord, event } = params;
|
|
38439
|
-
const appliedPolicies =
|
|
38440
|
-
|
|
38441
|
-
|
|
38442
|
-
|
|
38439
|
+
const appliedPolicies = {
|
|
38440
|
+
...params?.appliedPolicies,
|
|
38441
|
+
...(getAppliedPolicies({
|
|
38442
|
+
tournamentRecord,
|
|
38443
|
+
event,
|
|
38444
|
+
}).appliedPolicies ?? {}),
|
|
38445
|
+
};
|
|
38443
38446
|
const policyDefinitions = makeDeepCopy(params.policyDefinitions ?? {}, false, true);
|
|
38444
38447
|
return { appliedPolicies, policyDefinitions };
|
|
38445
38448
|
}
|
|
@@ -38484,6 +38487,42 @@ function checkDrawTypeIsAllowed(params) {
|
|
|
38484
38487
|
return { ...SUCCESS };
|
|
38485
38488
|
}
|
|
38486
38489
|
|
|
38490
|
+
function hydrateRoundNames(params) {
|
|
38491
|
+
const { drawDefinition, appliedPolicies } = params;
|
|
38492
|
+
const roundNamingPolicy = appliedPolicies?.[POLICY_TYPE_ROUND_NAMING];
|
|
38493
|
+
const matchUpsMap = getMatchUpsMap({ drawDefinition });
|
|
38494
|
+
drawDefinition.structures?.forEach((structure) => {
|
|
38495
|
+
const matchUps = getMappedStructureMatchUps({
|
|
38496
|
+
structureId: structure.structureId,
|
|
38497
|
+
matchUpsMap,
|
|
38498
|
+
});
|
|
38499
|
+
const result = getRoundContextProfile({
|
|
38500
|
+
roundNamingPolicy,
|
|
38501
|
+
drawDefinition,
|
|
38502
|
+
structure,
|
|
38503
|
+
matchUps,
|
|
38504
|
+
});
|
|
38505
|
+
const { roundNamingProfile, roundProfile } = result;
|
|
38506
|
+
const structures = structure.structures || [structure];
|
|
38507
|
+
structures.forEach((itemStructure) => {
|
|
38508
|
+
(itemStructure.matchUps ?? []).forEach((matchUp) => {
|
|
38509
|
+
const roundNumber = matchUp?.roundNumber?.toString();
|
|
38510
|
+
if (roundNumber) {
|
|
38511
|
+
const roundName = roundNamingProfile?.[roundNumber]?.roundName;
|
|
38512
|
+
const abbreviatedRoundName = roundNamingProfile?.[roundNumber]?.abbreviatedRoundName;
|
|
38513
|
+
const feedRound = roundProfile?.[roundNumber]?.feedRound;
|
|
38514
|
+
Object.assign(matchUp, {
|
|
38515
|
+
abbreviatedRoundName,
|
|
38516
|
+
feedRound,
|
|
38517
|
+
roundName,
|
|
38518
|
+
});
|
|
38519
|
+
}
|
|
38520
|
+
});
|
|
38521
|
+
});
|
|
38522
|
+
});
|
|
38523
|
+
return { drawDefinition };
|
|
38524
|
+
}
|
|
38525
|
+
|
|
38487
38526
|
function generateDrawDefinition(params) {
|
|
38488
38527
|
const { voluntaryConsolation, tournamentRecord, event } = params;
|
|
38489
38528
|
const stack = 'generateDrawDefinition';
|
|
@@ -38556,6 +38595,11 @@ function generateDrawDefinition(params) {
|
|
|
38556
38595
|
matchUpType,
|
|
38557
38596
|
});
|
|
38558
38597
|
}
|
|
38598
|
+
if (params.hydrateRoundNames) {
|
|
38599
|
+
const roundNamingPolicy = appliedPolicies?.[POLICY_TYPE_ROUND_NAMING];
|
|
38600
|
+
if (roundNamingPolicy)
|
|
38601
|
+
hydrateRoundNames({ drawDefinition, appliedPolicies });
|
|
38602
|
+
}
|
|
38559
38603
|
return {
|
|
38560
38604
|
existingDrawDefinition: !!existingDrawDefinition,
|
|
38561
38605
|
qualifyingConflicts,
|
|
@@ -45354,9 +45398,7 @@ function setMatchUpState(params) {
|
|
|
45354
45398
|
const isClearScore = matchUpStatus === TO_BE_PLAYED && score?.scoreStringSide1 === '' && score?.scoreStringSide2 === '' && !winningSide;
|
|
45355
45399
|
const propagatedExitDownStream = hasPropagatedExitDownstream(params);
|
|
45356
45400
|
if (propagatedExitDownStream && isClearScore) {
|
|
45357
|
-
return {
|
|
45358
|
-
error: PROPAGATED_EXITS_DOWNSTREAM,
|
|
45359
|
-
};
|
|
45401
|
+
return { error: PROPAGATED_EXITS_DOWNSTREAM };
|
|
45360
45402
|
}
|
|
45361
45403
|
const activeDownstream = isActiveDownstream(params);
|
|
45362
45404
|
let dualWinningSideChange;
|
|
@@ -57222,6 +57264,24 @@ var generate$1 = {
|
|
|
57222
57264
|
createTournamentRecord: createTournamentRecord
|
|
57223
57265
|
};
|
|
57224
57266
|
|
|
57267
|
+
function hydrateTournamentRecord(params) {
|
|
57268
|
+
const { tournamentRecord, eventProfiles = [], directives, policyDefinitions } = params;
|
|
57269
|
+
if (!tournamentRecord)
|
|
57270
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
57271
|
+
const events = tournamentRecord.events || [];
|
|
57272
|
+
events.forEach((event) => {
|
|
57273
|
+
const eventProfile = eventProfiles.find((ep) => ep.eventId && ep.eventId === event.eventId);
|
|
57274
|
+
if (eventProfile?.directives?.hydrateRoundNames || directives?.hydrateRoundNames) {
|
|
57275
|
+
event.drawDefinitions?.forEach((drawDefinition) => {
|
|
57276
|
+
const roundNamingPolicy = eventProfile?.policyDefinitions?.[POLICY_TYPE_ROUND_NAMING] || policyDefinitions?.[POLICY_TYPE_ROUND_NAMING];
|
|
57277
|
+
if (roundNamingPolicy)
|
|
57278
|
+
hydrateRoundNames({ drawDefinition, appliedPolicies: policyDefinitions });
|
|
57279
|
+
});
|
|
57280
|
+
}
|
|
57281
|
+
});
|
|
57282
|
+
return { tournamentRecord };
|
|
57283
|
+
}
|
|
57284
|
+
|
|
57225
57285
|
const ABANDONED = 'ABANDONED';
|
|
57226
57286
|
const ACTIVE = 'ACTIVE';
|
|
57227
57287
|
const CANCELLED = 'CANCELLED';
|
|
@@ -57613,6 +57673,7 @@ var mutate$1 = {
|
|
|
57613
57673
|
addTimeItem: addTimeItem,
|
|
57614
57674
|
addTournamentExtension: addTournamentExtension,
|
|
57615
57675
|
addTournamentTimeItem: addTournamentTimeItem,
|
|
57676
|
+
hydrateTournamentRecord: hydrateTournamentRecord,
|
|
57616
57677
|
removeDrawDefinitionExtension: removeDrawDefinitionExtension,
|
|
57617
57678
|
removeEventExtension: removeEventExtension,
|
|
57618
57679
|
removeExtension: removeExtension,
|
|
@@ -57660,6 +57721,7 @@ var index$3 = {
|
|
|
57660
57721
|
getTournamentPoints: getTournamentPoints,
|
|
57661
57722
|
getTournamentStructures: getTournamentStructures,
|
|
57662
57723
|
getTournamentTimeItem: getTournamentTimeItem,
|
|
57724
|
+
hydrateTournamentRecord: hydrateTournamentRecord,
|
|
57663
57725
|
mutate: mutate$1,
|
|
57664
57726
|
query: query$7,
|
|
57665
57727
|
removeDrawDefinitionExtension: removeDrawDefinitionExtension,
|