tods-competition-factory 2.2.33 → 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.
@@ -5739,7 +5739,6 @@ declare function bulkMatchUpStatusUpdate(params: any): ResultType | {
5739
5739
  message: string;
5740
5740
  code: string;
5741
5741
  };
5742
- info?: undefined;
5743
5742
  } | {
5744
5743
  error: {
5745
5744
  message: string;
@@ -10301,6 +10300,17 @@ declare namespace generate$1 {
10301
10300
  };
10302
10301
  }
10303
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
+
10304
10314
  declare function setTournamentStatus({ tournamentRecord, status }: {
10305
10315
  tournamentRecord: any;
10306
10316
  status: any;
@@ -10582,6 +10592,7 @@ declare const mutate$1_addParticipantTimeItem: typeof addParticipantTimeItem;
10582
10592
  declare const mutate$1_addTimeItem: typeof addTimeItem;
10583
10593
  declare const mutate$1_addTournamentExtension: typeof addTournamentExtension;
10584
10594
  declare const mutate$1_addTournamentTimeItem: typeof addTournamentTimeItem;
10595
+ declare const mutate$1_hydrateTournamentRecord: typeof hydrateTournamentRecord;
10585
10596
  declare const mutate$1_removeDrawDefinitionExtension: typeof removeDrawDefinitionExtension;
10586
10597
  declare const mutate$1_removeEventExtension: typeof removeEventExtension;
10587
10598
  declare const mutate$1_removeExtension: typeof removeExtension;
@@ -10609,6 +10620,7 @@ declare namespace mutate$1 {
10609
10620
  mutate$1_addTimeItem as addTimeItem,
10610
10621
  mutate$1_addTournamentExtension as addTournamentExtension,
10611
10622
  mutate$1_addTournamentTimeItem as addTournamentTimeItem,
10623
+ mutate$1_hydrateTournamentRecord as hydrateTournamentRecord,
10612
10624
  mutate$1_removeDrawDefinitionExtension as removeDrawDefinitionExtension,
10613
10625
  mutate$1_removeEventExtension as removeEventExtension,
10614
10626
  mutate$1_removeExtension as removeExtension,
@@ -10654,6 +10666,7 @@ declare const index$4_getTournamentPersons: typeof getTournamentPersons;
10654
10666
  declare const index$4_getTournamentPoints: typeof getTournamentPoints;
10655
10667
  declare const index$4_getTournamentStructures: typeof getTournamentStructures;
10656
10668
  declare const index$4_getTournamentTimeItem: typeof getTournamentTimeItem;
10669
+ declare const index$4_hydrateTournamentRecord: typeof hydrateTournamentRecord;
10657
10670
  declare const index$4_removeDrawDefinitionExtension: typeof removeDrawDefinitionExtension;
10658
10671
  declare const index$4_removeEventExtension: typeof removeEventExtension;
10659
10672
  declare const index$4_removeExtension: typeof removeExtension;
@@ -10699,6 +10712,7 @@ declare namespace index$4 {
10699
10712
  index$4_getTournamentPoints as getTournamentPoints,
10700
10713
  index$4_getTournamentStructures as getTournamentStructures,
10701
10714
  index$4_getTournamentTimeItem as getTournamentTimeItem,
10715
+ index$4_hydrateTournamentRecord as hydrateTournamentRecord,
10702
10716
  mutate$1 as mutate,
10703
10717
  query$4 as query,
10704
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.33';
6
+ return '2.2.34';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -38487,6 +38487,42 @@ function checkDrawTypeIsAllowed(params) {
38487
38487
  return { ...SUCCESS };
38488
38488
  }
38489
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
+
38490
38526
  function generateDrawDefinition(params) {
38491
38527
  const { voluntaryConsolation, tournamentRecord, event } = params;
38492
38528
  const stack = 'generateDrawDefinition';
@@ -38561,38 +38597,8 @@ function generateDrawDefinition(params) {
38561
38597
  }
38562
38598
  if (params.hydrateRoundNames) {
38563
38599
  const roundNamingPolicy = appliedPolicies?.[POLICY_TYPE_ROUND_NAMING];
38564
- if (roundNamingPolicy) {
38565
- const matchUpsMap = getMatchUpsMap({ drawDefinition });
38566
- drawDefinition.structures?.forEach((structure) => {
38567
- const matchUps = getMappedStructureMatchUps({
38568
- structureId: structure.structureId,
38569
- matchUpsMap,
38570
- });
38571
- const result = getRoundContextProfile({
38572
- roundNamingPolicy,
38573
- drawDefinition,
38574
- structure,
38575
- matchUps,
38576
- });
38577
- const { roundNamingProfile, roundProfile } = result;
38578
- const structures = structure.structures || [structure];
38579
- structures.forEach((itemStructure) => {
38580
- (itemStructure.matchUps ?? []).forEach((matchUp) => {
38581
- const roundNumber = matchUp?.roundNumber?.toString();
38582
- if (roundNumber) {
38583
- const roundName = roundNamingProfile?.[roundNumber]?.roundName;
38584
- const abbreviatedRoundName = roundNamingProfile?.[roundNumber]?.abbreviatedRoundName;
38585
- const feedRound = roundProfile?.[roundNumber]?.feedRound;
38586
- Object.assign(matchUp, {
38587
- abbreviatedRoundName,
38588
- feedRound,
38589
- roundName,
38590
- });
38591
- }
38592
- });
38593
- });
38594
- });
38595
- }
38600
+ if (roundNamingPolicy)
38601
+ hydrateRoundNames({ drawDefinition, appliedPolicies });
38596
38602
  }
38597
38603
  return {
38598
38604
  existingDrawDefinition: !!existingDrawDefinition,
@@ -57258,6 +57264,24 @@ var generate$1 = {
57258
57264
  createTournamentRecord: createTournamentRecord
57259
57265
  };
57260
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
+
57261
57285
  const ABANDONED = 'ABANDONED';
57262
57286
  const ACTIVE = 'ACTIVE';
57263
57287
  const CANCELLED = 'CANCELLED';
@@ -57649,6 +57673,7 @@ var mutate$1 = {
57649
57673
  addTimeItem: addTimeItem,
57650
57674
  addTournamentExtension: addTournamentExtension,
57651
57675
  addTournamentTimeItem: addTournamentTimeItem,
57676
+ hydrateTournamentRecord: hydrateTournamentRecord,
57652
57677
  removeDrawDefinitionExtension: removeDrawDefinitionExtension,
57653
57678
  removeEventExtension: removeEventExtension,
57654
57679
  removeExtension: removeExtension,
@@ -57696,6 +57721,7 @@ var index$3 = {
57696
57721
  getTournamentPoints: getTournamentPoints,
57697
57722
  getTournamentStructures: getTournamentStructures,
57698
57723
  getTournamentTimeItem: getTournamentTimeItem,
57724
+ hydrateTournamentRecord: hydrateTournamentRecord,
57699
57725
  mutate: mutate$1,
57700
57726
  query: query$7,
57701
57727
  removeDrawDefinitionExtension: removeDrawDefinitionExtension,