tods-competition-factory 2.0.50 → 2.0.51

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.
@@ -4423,6 +4423,7 @@ declare function addDrawDefinition(params: AddDrawDefinitionArgs): ResultType &
4423
4423
  type DeleteDrawDefinitionArgs = {
4424
4424
  policyDefinitions?: PolicyDefinitions;
4425
4425
  tournamentRecord: Tournament;
4426
+ eventDataParams?: any;
4426
4427
  autoPublish?: boolean;
4427
4428
  drawIds?: string[];
4428
4429
  auditData?: any;
@@ -6383,11 +6384,7 @@ declare function publicFindParticipant(params: PublicFindParticipantArgs): {
6383
6384
  stack?: any;
6384
6385
  };
6385
6386
 
6386
- declare function addDynamicRatings({ tournamentRecord, modifiedScaleValues, removePriorValues }: {
6387
- tournamentRecord: any;
6388
- modifiedScaleValues: any;
6389
- removePriorValues: any;
6390
- }): any;
6387
+ declare function addDynamicRatings(params: any): any;
6391
6388
 
6392
6389
  type CreateGroupParticipantType = {
6393
6390
  participantRoleResponsibilities?: string[];
@@ -6482,6 +6479,15 @@ declare function scaledTeamAssignment({ clearExistingAssignments, individualPart
6482
6479
  scaledParticipant?: undefined;
6483
6480
  };
6484
6481
 
6482
+ declare function removeRatings(params: {
6483
+ tournamentRecord: Tournament;
6484
+ eventType: EventTypeUnion;
6485
+ asDynamic?: boolean;
6486
+ ratingType: string;
6487
+ }): ResultType & {
6488
+ valid?: boolean | undefined;
6489
+ };
6490
+
6485
6491
  declare function removePenalty(params: any): {
6486
6492
  error?: ErrorType | undefined;
6487
6493
  success?: boolean | undefined;
@@ -6619,11 +6625,12 @@ declare const mutate$7_removeIndividualParticipantIds: typeof removeIndividualPa
6619
6625
  declare const mutate$7_removeParticipantIdsFromAllTeams: typeof removeParticipantIdsFromAllTeams;
6620
6626
  declare const mutate$7_removePenalty: typeof removePenalty;
6621
6627
  declare const mutate$7_removePersonRequests: typeof removePersonRequests;
6628
+ declare const mutate$7_removeRatings: typeof removeRatings;
6622
6629
  declare const mutate$7_scaledTeamAssignment: typeof scaledTeamAssignment;
6623
6630
  declare const mutate$7_setParticipantScaleItem: typeof setParticipantScaleItem;
6624
6631
  declare const mutate$7_setParticipantScaleItems: typeof setParticipantScaleItems;
6625
6632
  declare namespace mutate$7 {
6626
- export { mutate$7_addDynamicRatings as addDynamicRatings, mutate$7_addIndividualParticipantIds as addIndividualParticipantIds, mutate$7_addParticipant as addParticipant, mutate$7_addParticipants as addParticipants, mutate$7_addPenalty as addPenalty, mutate$7_addPersonRequests as addPersonRequests, mutate$7_addPersons as addPersons, mutate$7_createGroupParticipant as createGroupParticipant, mutate$7_createTeamsFromParticipantAttributes as createTeamsFromParticipantAttributes, mutate$7_deleteParticipants as deleteParticipants, publicFindParticipant as findParticipant, mutate$7_mergeParticipants as mergeParticipants, mutate$7_modifyIndividualParticipantIds as modifyIndividualParticipantIds, mutate$7_modifyParticipant as modifyParticipant, mutate$7_modifyParticipantName as modifyParticipantName, mutate$7_modifyParticipantOtherName as modifyParticipantOtherName, mutate$7_modifyParticipantsSignInStatus as modifyParticipantsSignInStatus, mutate$7_modifyPenalty as modifyPenalty, mutate$7_modifyPersonRequests as modifyPersonRequests, mutate$7_regenerateParticipantNames as regenerateParticipantNames, mutate$7_removeIndividualParticipantIds as removeIndividualParticipantIds, mutate$7_removeParticipantIdsFromAllTeams as removeParticipantIdsFromAllTeams, mutate$7_removePenalty as removePenalty, mutate$7_removePersonRequests as removePersonRequests, mutate$7_scaledTeamAssignment as scaledTeamAssignment, mutate$7_setParticipantScaleItem as setParticipantScaleItem, mutate$7_setParticipantScaleItems as setParticipantScaleItems };
6633
+ export { mutate$7_addDynamicRatings as addDynamicRatings, mutate$7_addIndividualParticipantIds as addIndividualParticipantIds, mutate$7_addParticipant as addParticipant, mutate$7_addParticipants as addParticipants, mutate$7_addPenalty as addPenalty, mutate$7_addPersonRequests as addPersonRequests, mutate$7_addPersons as addPersons, mutate$7_createGroupParticipant as createGroupParticipant, mutate$7_createTeamsFromParticipantAttributes as createTeamsFromParticipantAttributes, mutate$7_deleteParticipants as deleteParticipants, publicFindParticipant as findParticipant, mutate$7_mergeParticipants as mergeParticipants, mutate$7_modifyIndividualParticipantIds as modifyIndividualParticipantIds, mutate$7_modifyParticipant as modifyParticipant, mutate$7_modifyParticipantName as modifyParticipantName, mutate$7_modifyParticipantOtherName as modifyParticipantOtherName, mutate$7_modifyParticipantsSignInStatus as modifyParticipantsSignInStatus, mutate$7_modifyPenalty as modifyPenalty, mutate$7_modifyPersonRequests as modifyPersonRequests, mutate$7_regenerateParticipantNames as regenerateParticipantNames, mutate$7_removeIndividualParticipantIds as removeIndividualParticipantIds, mutate$7_removeParticipantIdsFromAllTeams as removeParticipantIdsFromAllTeams, mutate$7_removePenalty as removePenalty, mutate$7_removePersonRequests as removePersonRequests, mutate$7_removeRatings as removeRatings, mutate$7_scaledTeamAssignment as scaledTeamAssignment, mutate$7_setParticipantScaleItem as setParticipantScaleItem, mutate$7_setParticipantScaleItems as setParticipantScaleItems };
6627
6634
  }
6628
6635
 
6629
6636
  declare function getCompetitionParticipants(params: any): ResultType & {
@@ -6856,12 +6863,13 @@ declare const index$c_removeIndividualParticipantIds: typeof removeIndividualPar
6856
6863
  declare const index$c_removeParticipantIdsFromAllTeams: typeof removeParticipantIdsFromAllTeams;
6857
6864
  declare const index$c_removePenalty: typeof removePenalty;
6858
6865
  declare const index$c_removePersonRequests: typeof removePersonRequests;
6866
+ declare const index$c_removeRatings: typeof removeRatings;
6859
6867
  declare const index$c_scaledTeamAssignment: typeof scaledTeamAssignment;
6860
6868
  declare const index$c_setParticipantScaleItem: typeof setParticipantScaleItem;
6861
6869
  declare const index$c_setParticipantScaleItems: typeof setParticipantScaleItems;
6862
6870
  declare const index$c_validateLineUp: typeof validateLineUp;
6863
6871
  declare namespace index$c {
6864
- export { index$c_addDynamicRatings as addDynamicRatings, index$c_addIndividualParticipantIds as addIndividualParticipantIds, index$c_addParticipant as addParticipant, index$c_addParticipants as addParticipants, index$c_addPenalty as addPenalty, index$c_addPersonRequests as addPersonRequests, index$c_addPersons as addPersons, index$c_createGroupParticipant as createGroupParticipant, index$c_createTeamsFromParticipantAttributes as createTeamsFromParticipantAttributes, index$c_deleteParticipants as deleteParticipants, index$c_filterParticipants as filterParticipants, publicFindParticipant as findParticipant, index$c_getCompetitionParticipants as getCompetitionParticipants, index$c_getPairedParticipant as getPairedParticipant, index$c_getParticipantEventDetails as getParticipantEventDetails, index$c_getParticipantMembership as getParticipantMembership, index$c_getParticipantScaleItem as getParticipantScaleItem, index$c_getParticipantSchedules as getParticipantSchedules, index$c_getParticipantSignInStatus as getParticipantSignInStatus, index$c_getParticipantTimeItem as getParticipantTimeItem, index$c_getParticipants as getParticipants, index$c_getScaleValues as getScaleValues, index$c_mergeParticipants as mergeParticipants, index$c_modifyIndividualParticipantIds as modifyIndividualParticipantIds, index$c_modifyParticipant as modifyParticipant, index$c_modifyParticipantName as modifyParticipantName, index$c_modifyParticipantOtherName as modifyParticipantOtherName, index$c_modifyParticipantsSignInStatus as modifyParticipantsSignInStatus, index$c_modifyPenalty as modifyPenalty, index$c_modifyPersonRequests as modifyPersonRequests, mutate$7 as mutate, index$c_participantScaleItem as participantScaleItem, query$7 as query, index$c_regenerateParticipantNames as regenerateParticipantNames, index$c_removeIndividualParticipantIds as removeIndividualParticipantIds, index$c_removeParticipantIdsFromAllTeams as removeParticipantIdsFromAllTeams, index$c_removePenalty as removePenalty, index$c_removePersonRequests as removePersonRequests, index$c_scaledTeamAssignment as scaledTeamAssignment, index$c_setParticipantScaleItem as setParticipantScaleItem, index$c_setParticipantScaleItems as setParticipantScaleItems, index$c_validateLineUp as validateLineUp };
6872
+ export { index$c_addDynamicRatings as addDynamicRatings, index$c_addIndividualParticipantIds as addIndividualParticipantIds, index$c_addParticipant as addParticipant, index$c_addParticipants as addParticipants, index$c_addPenalty as addPenalty, index$c_addPersonRequests as addPersonRequests, index$c_addPersons as addPersons, index$c_createGroupParticipant as createGroupParticipant, index$c_createTeamsFromParticipantAttributes as createTeamsFromParticipantAttributes, index$c_deleteParticipants as deleteParticipants, index$c_filterParticipants as filterParticipants, publicFindParticipant as findParticipant, index$c_getCompetitionParticipants as getCompetitionParticipants, index$c_getPairedParticipant as getPairedParticipant, index$c_getParticipantEventDetails as getParticipantEventDetails, index$c_getParticipantMembership as getParticipantMembership, index$c_getParticipantScaleItem as getParticipantScaleItem, index$c_getParticipantSchedules as getParticipantSchedules, index$c_getParticipantSignInStatus as getParticipantSignInStatus, index$c_getParticipantTimeItem as getParticipantTimeItem, index$c_getParticipants as getParticipants, index$c_getScaleValues as getScaleValues, index$c_mergeParticipants as mergeParticipants, index$c_modifyIndividualParticipantIds as modifyIndividualParticipantIds, index$c_modifyParticipant as modifyParticipant, index$c_modifyParticipantName as modifyParticipantName, index$c_modifyParticipantOtherName as modifyParticipantOtherName, index$c_modifyParticipantsSignInStatus as modifyParticipantsSignInStatus, index$c_modifyPenalty as modifyPenalty, index$c_modifyPersonRequests as modifyPersonRequests, mutate$7 as mutate, index$c_participantScaleItem as participantScaleItem, query$7 as query, index$c_regenerateParticipantNames as regenerateParticipantNames, index$c_removeIndividualParticipantIds as removeIndividualParticipantIds, index$c_removeParticipantIdsFromAllTeams as removeParticipantIdsFromAllTeams, index$c_removePenalty as removePenalty, index$c_removePersonRequests as removePersonRequests, index$c_removeRatings as removeRatings, index$c_scaledTeamAssignment as scaledTeamAssignment, index$c_setParticipantScaleItem as setParticipantScaleItem, index$c_setParticipantScaleItems as setParticipantScaleItems, index$c_validateLineUp as validateLineUp };
6865
6873
  }
6866
6874
 
6867
6875
  type AttachPoliciesArgs = {
@@ -7052,6 +7060,7 @@ type PublishEventType = {
7052
7060
  tournamentRecord: Tournament;
7053
7061
  removePriorValues?: boolean;
7054
7062
  returnEventData?: boolean;
7063
+ eventDataParams?: any;
7055
7064
  drawIds?: string[];
7056
7065
  status?: string;
7057
7066
  event?: Event$1;
@@ -7061,15 +7070,8 @@ type PublishEventType = {
7061
7070
  drawIdsToRemove?: string[];
7062
7071
  drawIdsToAdd?: string[];
7063
7072
  };
7064
- declare function publishEvent(params: PublishEventType): ResultType | {
7065
- error: {
7066
- message: string;
7067
- code: string;
7068
- };
7069
- } | {
7070
- eventData: any;
7071
- success: boolean;
7072
- error?: undefined;
7073
+ declare function publishEvent(params: PublishEventType): ResultType & {
7074
+ eventData?: any;
7073
7075
  };
7074
7076
 
7075
7077
  declare const mutate$5_publishEvent: typeof publishEvent;
@@ -10901,6 +10903,7 @@ declare const extensionConstants: {
10901
10903
  PERSON_REQUESTS: string;
10902
10904
  POSITION_ACTIONS: string;
10903
10905
  RANKING_POINTS: string;
10906
+ REGISTRATION: string;
10904
10907
  ROUND_TARGET: string;
10905
10908
  SCHEDULE_LIMITS: string;
10906
10909
  SCHEDULE_TIMING: string;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.50';
6
+ return '2.0.51';
7
7
  }
8
8
 
9
9
  function isFunction(obj) {
@@ -1783,6 +1783,27 @@ function decorateResult({ context, result, stack, info }) {
1783
1783
  return result ?? { success: true };
1784
1784
  }
1785
1785
 
1786
+ const SINGLES$1 = 'SINGLES';
1787
+ const SINGLES_EVENT = 'SINGLES';
1788
+ const DOUBLES$1 = 'DOUBLES';
1789
+ const DOUBLES_EVENT = 'DOUBLES';
1790
+ const TEAM$2 = 'TEAM';
1791
+ const TEAM_EVENT = 'TEAM';
1792
+ const AGE = 'AGE';
1793
+ const RATING$2 = 'RATING';
1794
+ const BOTH = 'BOTH';
1795
+ const eventConstants = {
1796
+ AGE,
1797
+ BOTH,
1798
+ DOUBLES: DOUBLES$1,
1799
+ DOUBLES_EVENT,
1800
+ RATING: RATING$2,
1801
+ SINGLES: SINGLES$1,
1802
+ SINGLES_EVENT,
1803
+ TEAM_EVENT,
1804
+ TEAM: TEAM$2,
1805
+ };
1806
+
1786
1807
  const TOURNAMENT_RECORDS = 'tournamentRecords';
1787
1808
  const POLICY_DEFINITIONS = 'policyDefinitions';
1788
1809
  const TOURNAMENT_RECORD = 'tournamentRecord';
@@ -1798,6 +1819,7 @@ const MATCHUP_IDS = 'matchUpIds';
1798
1819
  const POLICY_TYPE = 'policyType';
1799
1820
  const STRUCTURES = 'structures';
1800
1821
  const MATCHUP_ID = 'matchUpId';
1822
+ const EVENT_TYPE = 'eventType';
1801
1823
  const IN_CONTEXT = 'inContext';
1802
1824
  const STRUCTURE = 'structure';
1803
1825
  const COURT_IDS = 'courtIds';
@@ -1825,6 +1847,9 @@ const OF_TYPE = '_ofType';
1825
1847
  const ANY_OF = '_anyOf';
1826
1848
  const ONE_OF = '_oneOf';
1827
1849
 
1850
+ const validators = {
1851
+ [EVENT_TYPE]: (value) => [SINGLES$1, DOUBLES$1, TEAM$2].includes(value),
1852
+ };
1828
1853
  const errors = {
1829
1854
  [TOURNAMENT_RECORDS]: MISSING_TOURNAMENT_RECORDS,
1830
1855
  [TOURNAMENT_RECORD]: MISSING_TOURNAMENT_RECORD,
@@ -1836,6 +1861,7 @@ const errors = {
1836
1861
  [STRUCTURE_ID]: MISSING_STRUCTURE_ID,
1837
1862
  [MATCHUP_IDS]: MISSING_MATCHUP_IDS,
1838
1863
  [PARTICIPANT]: MISSING_PARTICIPANT,
1864
+ [EVENT_TYPE]: INVALID_EVENT_TYPE,
1839
1865
  [STRUCTURES]: MISSING_STRUCTURES,
1840
1866
  [MATCHUP_ID]: MISSING_MATCHUP_ID,
1841
1867
  [STRUCTURE]: MISSING_STRUCTURE,
@@ -1923,7 +1949,9 @@ function findParamError(params, requiredParams) {
1923
1949
  const faliedTypeCheck = params[param] !== undefined && !_validate && invalidType(params, param, _ofType);
1924
1950
  const paramNotPresent = attrs[param] && [undefined, null].includes(params[param]);
1925
1951
  const invalid = invalidValidationFunction || faliedTypeCheck || paramNotPresent;
1926
- const hasError = invalid || (_validate && params[param] !== undefined && !checkValidation(params[param], _validate));
1952
+ const hasError = invalid ||
1953
+ (_validate && params[param] !== undefined && !checkValidation(params[param], _validate)) ||
1954
+ (validators[param] && !validators[param](params[param]));
1927
1955
  if (hasError) {
1928
1956
  errorParam = param;
1929
1957
  paramInfo = _info;
@@ -1947,27 +1975,6 @@ function checkValidation(value, validate) {
1947
1975
  return true;
1948
1976
  }
1949
1977
 
1950
- const SINGLES$1 = 'SINGLES';
1951
- const SINGLES_EVENT = 'SINGLES';
1952
- const DOUBLES$1 = 'DOUBLES';
1953
- const DOUBLES_EVENT = 'DOUBLES';
1954
- const TEAM$2 = 'TEAM';
1955
- const TEAM_EVENT = 'TEAM';
1956
- const AGE = 'AGE';
1957
- const RATING$2 = 'RATING';
1958
- const BOTH = 'BOTH';
1959
- const eventConstants = {
1960
- AGE,
1961
- BOTH,
1962
- DOUBLES: DOUBLES$1,
1963
- DOUBLES_EVENT,
1964
- RATING: RATING$2,
1965
- SINGLES: SINGLES$1,
1966
- SINGLES_EVENT,
1967
- TEAM_EVENT,
1968
- TEAM: TEAM$2,
1969
- };
1970
-
1971
1978
  const DYNAMIC = 'DYNAMIC';
1972
1979
  const RANKING$1 = 'RANKING';
1973
1980
  const RATING$1 = 'RATING';
@@ -2710,8 +2717,8 @@ const APPLIED_POLICIES = 'appliedPolicies';
2710
2717
  const CONTEXT = 'context';
2711
2718
  const DELEGATED_OUTCOME = 'delegatedOutcome';
2712
2719
  const DISABLED = 'disabled';
2713
- const DISABLE_LINKS = 'disableLinks';
2714
2720
  const DISABLE_AUTO_CALC = 'disableAutoCalc';
2721
+ const DISABLE_LINKS = 'disableLinks';
2715
2722
  const DISPLAY = 'display';
2716
2723
  const DRAW_DELETIONS = 'drawDeletions';
2717
2724
  const DRAW_PROFILE = 'drawProfile';
@@ -2728,6 +2735,7 @@ const PARTICIPANT_REPRESENTATIVES = 'participantRepresentatives';
2728
2735
  const PERSON_REQUESTS = 'personRequests';
2729
2736
  const POSITION_ACTIONS = 'positionActions';
2730
2737
  const RANKING_POINTS = 'rankingPoints';
2738
+ const REGISTRATION$1 = 'registration';
2731
2739
  const ROUND_TARGET = 'roundTarget';
2732
2740
  const SCHEDULE_LIMITS = 'scheduleLimits';
2733
2741
  const SCHEDULE_TIMING = 'scheduleTiming';
@@ -2759,6 +2767,7 @@ const extensionConstants = {
2759
2767
  PERSON_REQUESTS,
2760
2768
  POSITION_ACTIONS,
2761
2769
  RANKING_POINTS,
2770
+ REGISTRATION: REGISTRATION$1,
2762
2771
  ROUND_TARGET,
2763
2772
  SCHEDULE_LIMITS,
2764
2773
  SCHEDULE_TIMING,
@@ -2772,9 +2781,11 @@ const extensionConstants = {
2772
2781
  const internalExtensions = [
2773
2782
  DELEGATED_OUTCOME,
2774
2783
  DISABLED,
2784
+ DISABLE_AUTO_CALC,
2775
2785
  DISABLE_LINKS,
2776
2786
  FLIGHT_PROFILE,
2777
2787
  LINEUPS,
2788
+ LINKED_TOURNAMENTS,
2778
2789
  MATCHUP_HISTORY,
2779
2790
  PARTICIPANT_REPRESENTATIVES,
2780
2791
  PERSON_REQUESTS,
@@ -2784,6 +2795,7 @@ const internalExtensions = [
2784
2795
  SCHEDULING_PROFILE,
2785
2796
  SUB_ORDER,
2786
2797
  TALLY,
2798
+ TIE_FORMAT_MODIFICATIONS,
2787
2799
  ];
2788
2800
 
2789
2801
  function linkTournaments({ tournamentRecords }) {
@@ -26492,9 +26504,14 @@ function addParticipantScaleItem({ removePriorValues, participant, scaleItem })
26492
26504
  return { ...SUCCESS, valueChanged, newValue: scaleItem.scaleValue };
26493
26505
  }
26494
26506
 
26495
- function addDynamicRatings({ tournamentRecord, modifiedScaleValues, removePriorValues }) {
26496
- if (!tournamentRecord)
26497
- return { error: MISSING_TOURNAMENT_RECORD };
26507
+ function addDynamicRatings(params) {
26508
+ const { tournamentRecord, modifiedScaleValues, removePriorValues } = params;
26509
+ const paramsCheck = checkRequiredParameters(params, [
26510
+ { [TOURNAMENT_RECORD]: true },
26511
+ { modifiedScaleValues: true, [OF_TYPE]: OBJECT },
26512
+ ]);
26513
+ if (paramsCheck.error)
26514
+ return paramsCheck;
26498
26515
  for (const participantId in modifiedScaleValues) {
26499
26516
  const result = setParticipantScaleItem({
26500
26517
  scaleItem: modifiedScaleValues[participantId],
@@ -26628,19 +26645,19 @@ function generateDynamicRatings(params) {
26628
26645
  const ratingParameter = ratingsParameters[ratingType];
26629
26646
  const { accessor } = ratingParameter;
26630
26647
  const modifiedScaleValues = {};
26631
- const matchUps = params.matchUps ??
26648
+ const matchUps = (params.matchUps ||
26632
26649
  (refreshDynamic &&
26633
26650
  allDrawMatchUps({
26634
26651
  drawDefinition,
26635
26652
  tournamentRecord,
26636
26653
  inContext: true,
26637
26654
  matchUpFilters: { matchUpStatuses: completedMatchUpStatuses },
26638
- })) ??
26655
+ }).matchUps) ||
26639
26656
  allTournamentMatchUps({
26640
26657
  matchUpFilters: { matchUpIds, matchUpStatuses: completedMatchUpStatuses },
26641
26658
  tournamentRecord,
26642
26659
  inContext: true,
26643
- }).matchUps ??
26660
+ }).matchUps) ??
26644
26661
  [];
26645
26662
  const dynamicScaleName = `${ratingType}.${DYNAMIC}`;
26646
26663
  const outputScaleName = asDynamic ? dynamicScaleName : ratingType;
@@ -26670,7 +26687,7 @@ function generateDynamicRatings(params) {
26670
26687
  .flat()
26671
26688
  .map((participantId) => {
26672
26689
  const existingModifiedScaleValue = modifiedScaleValues[participantId];
26673
- const useDynamic = !refreshDynamic || !existingModifiedScaleValue;
26690
+ const useDynamic = !refreshDynamic || existingModifiedScaleValue;
26674
26691
  const dynamicScaleItem = useDynamic
26675
26692
  ? getParticipantScaleItem({
26676
26693
  scaleAttributes: dynamicScaleAttributes,
@@ -27067,7 +27084,7 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
27067
27084
  ?.filter(({ roundNumber }) => roundNumber === lastRoundNumber)
27068
27085
  .map(({ matchUpId }) => matchUpId);
27069
27086
  const result = generateDynamicRatings({
27070
- ratingType: scaleName || event?.category?.ratingType,
27087
+ ratingType: scaleName ?? event?.category?.ratingType,
27071
27088
  updateParticipantRatings,
27072
27089
  tournamentRecord,
27073
27090
  asDynamic: true,
@@ -38134,17 +38151,19 @@ function modifyEventPublishStatus({ removePriorValues = true, status = PUBLIC, s
38134
38151
  }
38135
38152
 
38136
38153
  function publishEvent(params) {
38154
+ const paramsCheck = checkRequiredParameters(params, [
38155
+ { [TOURNAMENT_RECORD]: true, [EVENT]: true },
38156
+ { eventDataParams: false, [OF_TYPE]: OBJECT },
38157
+ ]);
38158
+ if (paramsCheck.error)
38159
+ return paramsCheck;
38137
38160
  const { includePositionAssignments, removePriorValues, tournamentRecord, status = PUBLIC, event, drawIdsToRemove, drawIdsToAdd, } = params;
38138
- if (!tournamentRecord)
38139
- return { error: MISSING_TOURNAMENT_RECORD };
38140
- if (!event)
38141
- return { error: MISSING_EVENT };
38142
38161
  const { appliedPolicies } = getAppliedPolicies({ tournamentRecord, event });
38143
38162
  const policyDefinitions = {
38144
38163
  ...appliedPolicies,
38145
38164
  ...params.policyDefinitions,
38146
38165
  };
38147
- const eventDrawIds = event.drawDefinitions?.map(({ drawId }) => drawId) ?? [];
38166
+ const eventDrawIds = event?.drawDefinitions?.map(({ drawId }) => drawId) ?? [];
38148
38167
  const keyedDrawIds = params.drawDetails ? Object.keys(params.drawDetails) : [];
38149
38168
  const specifiedDrawIds = keyedDrawIds.length ? [] : params.drawIds;
38150
38169
  const drawIdsToValidate = (drawIdsToAdd ?? []).concat(...(drawIdsToRemove ?? []), ...(specifiedDrawIds ?? []), ...keyedDrawIds);
@@ -38190,7 +38209,7 @@ function publishEvent(params) {
38190
38209
  stageDetails,
38191
38210
  };
38192
38211
  if (structureIdsToAdd.length || structureIdsToRemove.length) {
38193
- const drawStructureIds = (event.drawDefinitions?.find((drawDefinition) => drawDefinition.drawId === drawId)?.structures ?? []).map(({ structureId }) => structureId);
38212
+ const drawStructureIds = (event?.drawDefinitions?.find((drawDefinition) => drawDefinition.drawId === drawId)?.structures ?? []).map(({ structureId }) => structureId);
38194
38213
  const structureIdsToValidate = (structureIdsToAdd ?? []).concat(structureIdsToRemove ?? []);
38195
38214
  const invalidStructureIds = structureIdsToValidate.filter((structureId) => !drawStructureIds.includes(structureId));
38196
38215
  if (invalidStructureIds.length) {
@@ -38210,7 +38229,7 @@ function publishEvent(params) {
38210
38229
  }
38211
38230
  drawDetails[drawId].structureDetails = structureDetails;
38212
38231
  }
38213
- const drawStages = (event.drawDefinitions?.find((drawDefinition) => drawDefinition.drawId === drawId)?.structures ?? []).map(({ stage }) => stage);
38232
+ const drawStages = (event?.drawDefinitions?.find((drawDefinition) => drawDefinition.drawId === drawId)?.structures ?? []).map(({ stage }) => stage);
38214
38233
  if (stagesToAdd.length) {
38215
38234
  for (const stage of stagesToAdd) {
38216
38235
  stageDetails[stage] = { published: true };
@@ -38247,6 +38266,7 @@ function publishEvent(params) {
38247
38266
  const eventData = notify || params.returnEventData
38248
38267
  ? getEventData({
38249
38268
  includePositionAssignments,
38269
+ ...params.eventDataParams,
38250
38270
  usePublishState: true,
38251
38271
  tournamentRecord,
38252
38272
  policyDefinitions,
@@ -38429,6 +38449,7 @@ function deleteDrawDefinitions(params) {
38429
38449
  addDrawDeletionTelemetry({ appliedPolicies, event, deletedDrawsDetail, auditData });
38430
38450
  if (autoPublish && publishedDrawsDeleted) {
38431
38451
  const result = publishEvent({
38452
+ ...params.eventDataParams,
38432
38453
  drawIdsToRemove: drawIds,
38433
38454
  policyDefinitions,
38434
38455
  tournamentRecord,
@@ -47565,7 +47586,7 @@ function nameMocks({ nameRoot = 'TEAM', count = 1 } = {}) {
47565
47586
 
47566
47587
  function generateParticipants(params) {
47567
47588
  let { rankingRange, scaledParticipantsCount, } = params;
47568
- const { ratingsParameters: ratingsParameters$1 = ratingsParameters, valuesInstanceLimit, consideredDate, category, nationalityCodesCount, nationalityCodeType, nationalityCodes, participantsCount = 32, participantType, personIds, idPrefix, uuids, personExtensions, addressProps, gendersCount, matchUpType, personData, sex, inContext, withISO2, withIOC, scaleAllParticipants, } = params;
47589
+ const { ratingsParameters: ratingsParameters$1 = ratingsParameters, valuesInstanceLimit, consideredDate, categories, category, nationalityCodesCount, nationalityCodeType, nationalityCodes, participantsCount = 32, participantType, personIds, idPrefix, uuids, personExtensions, addressProps, gendersCount, matchUpType, personData, sex, inContext, withISO2, withIOC, scaleAllParticipants, } = params;
47569
47590
  const doubles = participantType === PAIR || matchUpType === DOUBLES_MATCHUP;
47570
47591
  const team = participantType === TEAM || matchUpType === TEAM;
47571
47592
  if (rankingRange &&
@@ -47592,57 +47613,28 @@ function generateParticipants(params) {
47592
47613
  if (result.error)
47593
47614
  return result;
47594
47615
  const { nationalityCodes: personNationalityCodes, persons: mockedPersons } = result;
47595
- let doublesRankings = [], singlesRankings = [], singlesRatings = [], doublesRatings = [];
47596
- if (typeof category === 'object') {
47597
- const { categoryName, ageCategoryCode, ratingType } = category;
47598
- if ((categoryName || ageCategoryCode) && !ratingType) {
47599
- const [start, end] = rankingRange || [];
47600
- singlesRankings = shuffleArray(generateRange(start, end)).slice(0, scaledParticipantsCount || randomInt(20, 30));
47601
- if ([PAIR, TEAM].includes(participantType)) {
47602
- const [start, end] = rankingRange || [];
47603
- doublesRankings = shuffleArray(generateRange(start, end)).slice(0, scaledParticipantsCount || randomInt(20, 30));
47604
- }
47605
- }
47606
- if (ratingType && ratingsParameters$1[ratingType]) {
47607
- const { ratingMax, ratingMin, ratingAttributes } = category;
47608
- const ratingParameters = {
47609
- ...ratingsParameters$1[ratingType],
47610
- ...(ratingAttributes || {}),
47611
- };
47612
- const { attributes = {}, decimalsCount, accessors, range, step } = ratingParameters;
47613
- const getAttributes = (attributes) => {
47614
- const generatedAttributes = {};
47615
- const attributeKeys = Object.keys(attributes || {});
47616
- for (const attribute of attributeKeys) {
47617
- const attributeValue = attributes[attribute];
47618
- if (typeof attributeValue === 'object' && attributeValue.generator) {
47619
- const { range } = attributeValue;
47620
- const [min, max] = range.slice().sort();
47621
- generatedAttributes[attribute] = randomInt(min, max);
47622
- }
47623
- else {
47624
- generatedAttributes[attribute] = attributeValue;
47625
- }
47626
- }
47627
- return generatedAttributes;
47628
- };
47629
- const inverted = range[0] > range[1];
47630
- const skew = inverted ? 2 : 0.5;
47631
- const [min, max] = range.slice().sort();
47632
- const generateRatings = () => generateRange(0, 2000)
47633
- .map(() => skewedDistribution(min, max, skew, step, decimalsCount))
47634
- .filter((rating) => (!ratingMax || rating <= ratingMax) && (!ratingMin || rating >= ratingMin))
47635
- .slice(0, scaledParticipantsCount || randomInt(20, 30))
47636
- .map((scaleValue) => {
47637
- return !accessors
47638
- ? scaleValue
47639
- : Object.assign({}, ...accessors.map((accessor) => ({ [accessor]: scaleValue })), getAttributes(attributes));
47616
+ const doublesRankings = {}, singlesRankings = {}, singlesRatings = {}, doublesRatings = {};
47617
+ const assignResult = (result) => {
47618
+ Object.assign(doublesRankings, result.doublesRankings);
47619
+ Object.assign(singlesRankings, result.singlesRankings);
47620
+ Object.assign(doublesRatings, result.doublesRatings);
47621
+ Object.assign(singlesRatings, result.singlesRatings);
47622
+ };
47623
+ if (isObject(category)) {
47624
+ const result = genRatings({ category, scaledParticipantsCount, ratingsParameters: ratingsParameters$1, participantType, rankingRange });
47625
+ assignResult(result);
47626
+ }
47627
+ if (Array.isArray(categories)) {
47628
+ categories.forEach((category) => {
47629
+ const result = genRatings({
47630
+ scaledParticipantsCount,
47631
+ ratingsParameters: ratingsParameters$1,
47632
+ participantType,
47633
+ rankingRange,
47634
+ category,
47640
47635
  });
47641
- singlesRatings = generateRatings();
47642
- if ([PAIR, TEAM].includes(participantType)) {
47643
- doublesRatings = generateRatings();
47644
- }
47645
- }
47636
+ assignResult(result);
47637
+ });
47646
47638
  }
47647
47639
  const countryCodes = countries.filter((country) => nationalityCodeType === 'IOC' ? country.ioc || country.iso : country.iso);
47648
47640
  function getMin(count) {
@@ -47767,9 +47759,10 @@ function generateParticipants(params) {
47767
47759
  if (country?.label)
47768
47760
  participant.person.countryName = country.label;
47769
47761
  }
47770
- if (category) {
47771
- const singlesRanking = singlesRankings[participantIndex];
47772
- const doublesRanking = doublesRankings[participantIndex];
47762
+ const processCategory = (category) => {
47763
+ const scaleName = category.categoryName || category.ratingType || category.ageCategoryCode;
47764
+ const singlesRanking = singlesRankings[scaleName]?.[participantIndex];
47765
+ const doublesRanking = doublesRankings[scaleName]?.[participantIndex];
47773
47766
  addScaleItem({
47774
47767
  scaleValue: singlesRanking,
47775
47768
  eventType: SINGLES_EVENT,
@@ -47784,8 +47777,8 @@ function generateParticipants(params) {
47784
47777
  participant,
47785
47778
  category,
47786
47779
  });
47787
- const singlesRating = singlesRatings[participantIndex];
47788
- const doublesRating = doublesRatings[participantIndex];
47780
+ const singlesRating = singlesRatings[scaleName]?.[participantIndex];
47781
+ const doublesRating = doublesRatings[scaleName]?.[participantIndex];
47789
47782
  addScaleItem({
47790
47783
  scaleValue: singlesRating,
47791
47784
  eventType: SINGLES_EVENT,
@@ -47800,6 +47793,12 @@ function generateParticipants(params) {
47800
47793
  participant,
47801
47794
  category,
47802
47795
  });
47796
+ };
47797
+ if (Array.isArray(categories)) {
47798
+ categories.forEach((category) => processCategory(category));
47799
+ }
47800
+ else if (category) {
47801
+ processCategory(category);
47803
47802
  }
47804
47803
  return participant;
47805
47804
  }
@@ -47814,6 +47813,62 @@ function addScaleItem({ scaleValue: itemValue, participant, eventType, scaleType
47814
47813
  participant.timeItems.push(timeItem);
47815
47814
  }
47816
47815
  }
47816
+ function genRatings(params) {
47817
+ const { category, scaledParticipantsCount, ratingsParameters, participantType } = params;
47818
+ const rankingRange = category.rankingRange || params.rankingRange || [1, 1000];
47819
+ const doublesRankings = {}, singlesRankings = {}, singlesRatings = {}, doublesRatings = {};
47820
+ const { categoryName, ageCategoryCode, ratingType } = category;
47821
+ const scaleName = category.categoryName || category.ratingType || category.ageCategoryCode;
47822
+ if ((categoryName || ageCategoryCode) && !ratingType) {
47823
+ const [start, end] = rankingRange || [];
47824
+ singlesRankings[scaleName] = shuffleArray(generateRange(start, end)).slice(0, scaledParticipantsCount || randomInt(20, 30));
47825
+ if ([PAIR, TEAM].includes(participantType)) {
47826
+ const [start, end] = rankingRange || [];
47827
+ doublesRankings[scaleName] = shuffleArray(generateRange(start, end)).slice(0, scaledParticipantsCount || randomInt(20, 30));
47828
+ }
47829
+ }
47830
+ if (ratingType && ratingsParameters[ratingType]) {
47831
+ const { ratingMax, ratingMin, ratingAttributes } = category;
47832
+ const ratingParameters = {
47833
+ ...ratingsParameters[ratingType],
47834
+ ...(ratingAttributes || {}),
47835
+ };
47836
+ const { attributes = {}, decimalsCount, accessors, range, step } = ratingParameters;
47837
+ const getAttributes = (attributes) => {
47838
+ const generatedAttributes = {};
47839
+ const attributeKeys = Object.keys(attributes || {});
47840
+ for (const attribute of attributeKeys) {
47841
+ const attributeValue = attributes[attribute];
47842
+ if (typeof attributeValue === 'object' && attributeValue.generator) {
47843
+ const { range } = attributeValue;
47844
+ const [min, max] = range.slice().sort();
47845
+ generatedAttributes[attribute] = randomInt(min, max);
47846
+ }
47847
+ else {
47848
+ generatedAttributes[attribute] = attributeValue;
47849
+ }
47850
+ }
47851
+ return generatedAttributes;
47852
+ };
47853
+ const inverted = range[0] > range[1];
47854
+ const skew = inverted ? 2 : 0.5;
47855
+ const [min, max] = range.slice().sort();
47856
+ const generateRatings = () => generateRange(0, 2000)
47857
+ .map(() => skewedDistribution(min, max, skew, step, decimalsCount))
47858
+ .filter((rating) => (!ratingMax || rating <= ratingMax) && (!ratingMin || rating >= ratingMin))
47859
+ .slice(0, scaledParticipantsCount || randomInt(20, 30))
47860
+ .map((scaleValue) => {
47861
+ return !accessors
47862
+ ? scaleValue
47863
+ : Object.assign({}, ...accessors.map((accessor) => ({ [accessor]: scaleValue })), getAttributes(attributes));
47864
+ });
47865
+ singlesRatings[scaleName] = generateRatings();
47866
+ if ([PAIR, TEAM].includes(participantType)) {
47867
+ doublesRatings[scaleName] = generateRatings();
47868
+ }
47869
+ }
47870
+ return { singlesRankings, doublesRankings, singlesRatings, doublesRatings };
47871
+ }
47817
47872
 
47818
47873
  function processTieFormat(params) {
47819
47874
  const { alternatesCount = 0, tieFormatName, drawSize } = params;
@@ -51053,6 +51108,25 @@ function scaledTeamAssignment({ clearExistingAssignments = true, individualParti
51053
51108
  return { ...SUCCESS, scaledParticipants };
51054
51109
  }
51055
51110
 
51111
+ function removeRatings(params) {
51112
+ const paramsCheck = checkRequiredParameters(params, [
51113
+ { [TOURNAMENT_RECORD]: true, [EVENT_TYPE]: true },
51114
+ { ratingType: false, [VALIDATE]: (value) => ratingsParameters[value] },
51115
+ ]);
51116
+ if (paramsCheck.error)
51117
+ return paramsCheck;
51118
+ const dynamicScaleName = `${params.ratingType}.${DYNAMIC}`;
51119
+ const ratingType = params.asDynamic ? dynamicScaleName : params.ratingType;
51120
+ const itemType = [SCALE$1, RATING$1, params.eventType, ratingType].join('.');
51121
+ const participants = params.tournamentRecord.participants ?? [];
51122
+ for (const participant of participants) {
51123
+ if (participant.timeItems) {
51124
+ participant.timeItems = participant.timeItems.filter((timeItem) => timeItem.itemType !== itemType);
51125
+ }
51126
+ }
51127
+ return { ...SUCCESS };
51128
+ }
51129
+
51056
51130
  function removePenalty(params) {
51057
51131
  const { tournamentRecords } = params;
51058
51132
  if (typeof tournamentRecords !== 'object' || !Object.keys(tournamentRecords).length)
@@ -51419,6 +51493,7 @@ var mutate$5 = {
51419
51493
  removeParticipantIdsFromAllTeams: removeParticipantIdsFromAllTeams,
51420
51494
  removePenalty: removePenalty,
51421
51495
  removePersonRequests: removePersonRequests,
51496
+ removeRatings: removeRatings,
51422
51497
  scaledTeamAssignment: scaledTeamAssignment,
51423
51498
  setParticipantScaleItem: setParticipantScaleItem,
51424
51499
  setParticipantScaleItems: setParticipantScaleItems
@@ -51464,6 +51539,7 @@ var index$8 = {
51464
51539
  removeParticipantIdsFromAllTeams: removeParticipantIdsFromAllTeams,
51465
51540
  removePenalty: removePenalty,
51466
51541
  removePersonRequests: removePersonRequests,
51542
+ removeRatings: removeRatings,
51467
51543
  scaledTeamAssignment: scaledTeamAssignment,
51468
51544
  setParticipantScaleItem: setParticipantScaleItem,
51469
51545
  setParticipantScaleItems: setParticipantScaleItems,
@@ -57404,26 +57480,35 @@ const mocksEngine = (() => {
57404
57480
  governors.forEach((governor) => {
57405
57481
  Object.keys(governor).forEach((method) => {
57406
57482
  engine[method] = (params) => {
57407
- try {
57483
+ if (getDevContext()) {
57408
57484
  const invocationResult = engineInvoke(governor[method], params);
57409
57485
  if (!invocationResult?.error && params?.setState && invocationResult?.tournamentRecord) {
57410
57486
  setState$1(invocationResult.tournamentRecord);
57411
57487
  }
57412
57488
  return invocationResult;
57413
57489
  }
57414
- catch (err) {
57415
- let error;
57416
- if (typeof err === 'string') {
57417
- error = err.toUpperCase();
57490
+ else {
57491
+ try {
57492
+ const invocationResult = engineInvoke(governor[method], params);
57493
+ if (!invocationResult?.error && params?.setState && invocationResult?.tournamentRecord) {
57494
+ setState$1(invocationResult.tournamentRecord);
57495
+ }
57496
+ return invocationResult;
57418
57497
  }
57419
- else if (err instanceof Error) {
57420
- error = err.message;
57498
+ catch (err) {
57499
+ let error;
57500
+ if (typeof err === 'string') {
57501
+ error = err.toUpperCase();
57502
+ }
57503
+ else if (err instanceof Error) {
57504
+ error = err.message;
57505
+ }
57506
+ console.log('ERROR', {
57507
+ params: JSON.stringify(params),
57508
+ method,
57509
+ error,
57510
+ });
57421
57511
  }
57422
- console.log('ERROR', {
57423
- params: JSON.stringify(params),
57424
- method,
57425
- error,
57426
- });
57427
57512
  }
57428
57513
  };
57429
57514
  });