tods-competition-factory 2.0.51 → 2.0.53

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.
@@ -3619,6 +3619,7 @@ type GenerateDrawMaticRoundArgs = {
3619
3619
  participantIds?: string[];
3620
3620
  dynamicRatings?: boolean;
3621
3621
  refreshDynamic?: boolean;
3622
+ minimizeDelta?: boolean;
3622
3623
  encounterValue?: number;
3623
3624
  sameTeamValue?: number;
3624
3625
  maxIterations?: number;
@@ -3639,6 +3640,7 @@ type DrawMaticRoundResult = {
3639
3640
  participantIdPairings?: string[][];
3640
3641
  candidatesCount?: number;
3641
3642
  outputScaleName?: string;
3643
+ deltaCandidate?: any;
3642
3644
  roundNumber?: number;
3643
3645
  matchUps?: MatchUp[];
3644
3646
  iterations?: number;
@@ -3646,7 +3648,7 @@ type DrawMaticRoundResult = {
3646
3648
  maxDelta?: number;
3647
3649
  maxDiff?: number;
3648
3650
  };
3649
- declare function generateDrawMaticRound({ encounterValue, sameTeamValue, maxIterations, updateParticipantRatings, generateMatchUps, ignoreLastRoundNumber, iterationMatchUps, tournamentRecord, dynamicRatings, refreshDynamic, participantIds, drawDefinition, adHocRatings, salted, roundNumber, structureId, matchUpIds, eventType, structure, scaleName, idPrefix, isMock, event, }: GenerateDrawMaticRoundArgs): ResultType & DrawMaticRoundResult;
3651
+ declare function generateDrawMaticRound(params: GenerateDrawMaticRoundArgs): ResultType & DrawMaticRoundResult;
3650
3652
 
3651
3653
  type GenerateVoluntaryConsolationArgs = {
3652
3654
  playoffAttributes?: PlayoffAttributes;
@@ -9020,6 +9022,19 @@ declare function setTournamentStatus({ tournamentRecord, status }: {
9020
9022
  info?: undefined;
9021
9023
  };
9022
9024
 
9025
+ type RemoveOnlineResourceArgs = {
9026
+ onlineResource: OnlineResource;
9027
+ drawDefinition?: DrawDefinition;
9028
+ tournamentRecord: Tournament;
9029
+ organisationId?: string;
9030
+ participantId?: string;
9031
+ personId?: string;
9032
+ courtId?: string;
9033
+ venueId?: string;
9034
+ event?: Event;
9035
+ };
9036
+ declare function removeOnlineResource(params: RemoveOnlineResourceArgs): ResultType;
9037
+
9023
9038
  type RemoveExtensionResult = {
9024
9039
  success?: boolean;
9025
9040
  error?: ErrorType;
@@ -9064,7 +9079,7 @@ type AddOnlineResourceArgs = {
9064
9079
  venueId?: string;
9065
9080
  event?: Event$1;
9066
9081
  };
9067
- declare function addOnlineResource({ tournamentRecord, onlineResource, organisationId, participantId, personId, courtId, venueId, }: AddOnlineResourceArgs): ResultType;
9082
+ declare function addOnlineResource(params: AddOnlineResourceArgs): ResultType;
9068
9083
 
9069
9084
  type AddExtensionArgs$1 = {
9070
9085
  tournamentRecords?: TournamentRecords;
@@ -9259,6 +9274,7 @@ declare const mutate$1_removeDrawDefinitionExtension: typeof removeDrawDefinitio
9259
9274
  declare const mutate$1_removeEventExtension: typeof removeEventExtension;
9260
9275
  declare const mutate$1_removeExtension: typeof removeExtension;
9261
9276
  declare const mutate$1_removeNotes: typeof removeNotes;
9277
+ declare const mutate$1_removeOnlineResource: typeof removeOnlineResource;
9262
9278
  declare const mutate$1_removeParticipantExtension: typeof removeParticipantExtension;
9263
9279
  declare const mutate$1_removeTournamentExtension: typeof removeTournamentExtension;
9264
9280
  declare const mutate$1_setTournamentCategories: typeof setTournamentCategories;
@@ -9269,7 +9285,7 @@ declare const mutate$1_setTournamentNotes: typeof setTournamentNotes;
9269
9285
  declare const mutate$1_setTournamentStartDate: typeof setTournamentStartDate;
9270
9286
  declare const mutate$1_setTournamentStatus: typeof setTournamentStatus;
9271
9287
  declare namespace mutate$1 {
9272
- export { mutate$1_addDrawDefinitionExtension as addDrawDefinitionExtension, mutate$1_addEventExtension as addEventExtension, mutate$1_addEventTimeItem as addEventTimeItem, mutate$1_addExtension as addExtension, mutate$1_addNotes as addNotes, mutate$1_addOnlineResource as addOnlineResource, mutate$1_addParticipantExtension as addParticipantExtension, mutate$1_addParticipantTimeItem as addParticipantTimeItem, mutate$1_addTimeItem as addTimeItem, mutate$1_addTournamentExtension as addTournamentExtension, mutate$1_addTournamentTimeItem as addTournamentTimeItem, mutate$1_removeDrawDefinitionExtension as removeDrawDefinitionExtension, mutate$1_removeEventExtension as removeEventExtension, mutate$1_removeExtension as removeExtension, mutate$1_removeNotes as removeNotes, mutate$1_removeParticipantExtension as removeParticipantExtension, mutate$1_removeTournamentExtension as removeTournamentExtension, mutate$1_setTournamentCategories as setTournamentCategories, mutate$1_setTournamentDates as setTournamentDates, mutate$1_setTournamentEndDate as setTournamentEndDate, mutate$1_setTournamentName as setTournamentName, mutate$1_setTournamentNotes as setTournamentNotes, mutate$1_setTournamentStartDate as setTournamentStartDate, mutate$1_setTournamentStatus as setTournamentStatus };
9288
+ export { mutate$1_addDrawDefinitionExtension as addDrawDefinitionExtension, mutate$1_addEventExtension as addEventExtension, mutate$1_addEventTimeItem as addEventTimeItem, mutate$1_addExtension as addExtension, mutate$1_addNotes as addNotes, mutate$1_addOnlineResource as addOnlineResource, mutate$1_addParticipantExtension as addParticipantExtension, mutate$1_addParticipantTimeItem as addParticipantTimeItem, mutate$1_addTimeItem as addTimeItem, mutate$1_addTournamentExtension as addTournamentExtension, mutate$1_addTournamentTimeItem as addTournamentTimeItem, mutate$1_removeDrawDefinitionExtension as removeDrawDefinitionExtension, mutate$1_removeEventExtension as removeEventExtension, mutate$1_removeExtension as removeExtension, mutate$1_removeNotes as removeNotes, mutate$1_removeOnlineResource as removeOnlineResource, mutate$1_removeParticipantExtension as removeParticipantExtension, mutate$1_removeTournamentExtension as removeTournamentExtension, mutate$1_setTournamentCategories as setTournamentCategories, mutate$1_setTournamentDates as setTournamentDates, mutate$1_setTournamentEndDate as setTournamentEndDate, mutate$1_setTournamentName as setTournamentName, mutate$1_setTournamentNotes as setTournamentNotes, mutate$1_setTournamentStartDate as setTournamentStartDate, mutate$1_setTournamentStatus as setTournamentStatus };
9273
9289
  }
9274
9290
 
9275
9291
  declare const index$4_addDrawDefinitionExtension: typeof addDrawDefinitionExtension;
@@ -9300,6 +9316,7 @@ declare const index$4_removeDrawDefinitionExtension: typeof removeDrawDefinition
9300
9316
  declare const index$4_removeEventExtension: typeof removeEventExtension;
9301
9317
  declare const index$4_removeExtension: typeof removeExtension;
9302
9318
  declare const index$4_removeNotes: typeof removeNotes;
9319
+ declare const index$4_removeOnlineResource: typeof removeOnlineResource;
9303
9320
  declare const index$4_removeParticipantExtension: typeof removeParticipantExtension;
9304
9321
  declare const index$4_removeTournamentExtension: typeof removeTournamentExtension;
9305
9322
  declare const index$4_setTournamentCategories: typeof setTournamentCategories;
@@ -9310,7 +9327,7 @@ declare const index$4_setTournamentNotes: typeof setTournamentNotes;
9310
9327
  declare const index$4_setTournamentStartDate: typeof setTournamentStartDate;
9311
9328
  declare const index$4_setTournamentStatus: typeof setTournamentStatus;
9312
9329
  declare namespace index$4 {
9313
- export { index$4_addDrawDefinitionExtension as addDrawDefinitionExtension, index$4_addEventExtension as addEventExtension, index$4_addEventTimeItem as addEventTimeItem, index$4_addExtension as addExtension, index$4_addNotes as addNotes, index$4_addOnlineResource as addOnlineResource, index$4_addParticipantExtension as addParticipantExtension, index$4_addParticipantTimeItem as addParticipantTimeItem, index$4_addTimeItem as addTimeItem, index$4_addTournamentExtension as addTournamentExtension, index$4_addTournamentTimeItem as addTournamentTimeItem, index$4_analyzeDraws as analyzeDraws, index$4_analyzeTournament as analyzeTournament, index$4_getAllowedDrawTypes as getAllowedDrawTypes, index$4_getAllowedMatchUpFormats as getAllowedMatchUpFormats, index$4_getAppliedPolicies as getAppliedPolicies, index$4_getCompetitionDateRange as getCompetitionDateRange, index$4_getCompetitionPenalties as getCompetitionPenalties, index$4_getPolicyDefinitions as getPolicyDefinitions, index$4_getTournamentInfo as getTournamentInfo, index$4_getTournamentPenalties as getTournamentPenalties, index$4_getTournamentPersons as getTournamentPersons, index$4_getTournamentStructures as getTournamentStructures, index$4_getTournamentTimeItem as getTournamentTimeItem, mutate$1 as mutate, query$4 as query, index$4_removeDrawDefinitionExtension as removeDrawDefinitionExtension, index$4_removeEventExtension as removeEventExtension, index$4_removeExtension as removeExtension, index$4_removeNotes as removeNotes, index$4_removeParticipantExtension as removeParticipantExtension, index$4_removeTournamentExtension as removeTournamentExtension, index$4_setTournamentCategories as setTournamentCategories, index$4_setTournamentDates as setTournamentDates, index$4_setTournamentEndDate as setTournamentEndDate, index$4_setTournamentName as setTournamentName, index$4_setTournamentNotes as setTournamentNotes, index$4_setTournamentStartDate as setTournamentStartDate, index$4_setTournamentStatus as setTournamentStatus };
9330
+ export { index$4_addDrawDefinitionExtension as addDrawDefinitionExtension, index$4_addEventExtension as addEventExtension, index$4_addEventTimeItem as addEventTimeItem, index$4_addExtension as addExtension, index$4_addNotes as addNotes, index$4_addOnlineResource as addOnlineResource, index$4_addParticipantExtension as addParticipantExtension, index$4_addParticipantTimeItem as addParticipantTimeItem, index$4_addTimeItem as addTimeItem, index$4_addTournamentExtension as addTournamentExtension, index$4_addTournamentTimeItem as addTournamentTimeItem, index$4_analyzeDraws as analyzeDraws, index$4_analyzeTournament as analyzeTournament, index$4_getAllowedDrawTypes as getAllowedDrawTypes, index$4_getAllowedMatchUpFormats as getAllowedMatchUpFormats, index$4_getAppliedPolicies as getAppliedPolicies, index$4_getCompetitionDateRange as getCompetitionDateRange, index$4_getCompetitionPenalties as getCompetitionPenalties, index$4_getPolicyDefinitions as getPolicyDefinitions, index$4_getTournamentInfo as getTournamentInfo, index$4_getTournamentPenalties as getTournamentPenalties, index$4_getTournamentPersons as getTournamentPersons, index$4_getTournamentStructures as getTournamentStructures, index$4_getTournamentTimeItem as getTournamentTimeItem, mutate$1 as mutate, query$4 as query, index$4_removeDrawDefinitionExtension as removeDrawDefinitionExtension, index$4_removeEventExtension as removeEventExtension, index$4_removeExtension as removeExtension, index$4_removeNotes as removeNotes, index$4_removeOnlineResource as removeOnlineResource, index$4_removeParticipantExtension as removeParticipantExtension, index$4_removeTournamentExtension as removeTournamentExtension, index$4_setTournamentCategories as setTournamentCategories, index$4_setTournamentDates as setTournamentDates, index$4_setTournamentEndDate as setTournamentEndDate, index$4_setTournamentName as setTournamentName, index$4_setTournamentNotes as setTournamentNotes, index$4_setTournamentStartDate as setTournamentStartDate, index$4_setTournamentStatus as setTournamentStatus };
9314
9331
  }
9315
9332
 
9316
9333
  declare const generate_generateCourts: typeof generateCourts;
@@ -11028,6 +11045,12 @@ declare const requestConstants: {
11028
11045
  DO_NOT_SCHEDULE: string;
11029
11046
  };
11030
11047
 
11048
+ declare const resourceContants: {
11049
+ RESOURCE_SUB_TYPE: string;
11050
+ RESOURCE_TYPE: string;
11051
+ IDENTIFIER: string;
11052
+ };
11053
+
11031
11054
  declare const resultConstants: {
11032
11055
  SUCCESS: {
11033
11056
  success: boolean;
@@ -11232,6 +11255,7 @@ declare const index_positionActionConstants: typeof positionActionConstants;
11232
11255
  declare const index_ratingConstants: typeof ratingConstants;
11233
11256
  declare const index_recoveryTimeRequiredMatchUpStatuses: typeof recoveryTimeRequiredMatchUpStatuses;
11234
11257
  declare const index_requestConstants: typeof requestConstants;
11258
+ declare const index_resourceContants: typeof resourceContants;
11235
11259
  declare const index_resultConstants: typeof resultConstants;
11236
11260
  declare const index_scaleConstants: typeof scaleConstants;
11237
11261
  declare const index_scheduleConstants: typeof scheduleConstants;
@@ -11245,7 +11269,7 @@ declare const index_upcomingMatchUpStatuses: typeof upcomingMatchUpStatuses;
11245
11269
  declare const index_validMatchUpStatuses: typeof validMatchUpStatuses;
11246
11270
  declare const index_venueConstants: typeof venueConstants;
11247
11271
  declare namespace index {
11248
- export { index_activeMatchUpStatuses as activeMatchUpStatuses, index_auditConstants as auditConstants, index_completedMatchUpStatuses as completedMatchUpStatuses, index_directingMatchUpStatuses as directingMatchUpStatuses, index_drawDefinitionConstants as drawDefinitionConstants, index_entryStatusConstants as entryStatusConstants, index_errorConditionConstants as errorConditionConstants, index_eventConstants as eventConstants, index_extensionConstants as extensionConstants, index_flightConstants as flightConstants, index_genderConstants as genderConstants, index_keyValueConstants as keyValueConstants, index_matchUpActionConstants as matchUpActionConstants, index_matchUpStatusConstants as matchUpStatusConstants, index_matchUpTypes as matchUpTypes, index_nonDirectingMatchUpStatuses as nonDirectingMatchUpStatuses, index_particicipantsRequiredMatchUpStatuses as particicipantsRequiredMatchUpStatuses, index_participantConstants as participantConstants, index_participantRoles as participantRoles, index_participantTypes as participantTypes, index_penaltyConstants as penaltyConstants, index_policyConstants as policyConstants, index_positionActionConstants as positionActionConstants, index_ratingConstants as ratingConstants, index_recoveryTimeRequiredMatchUpStatuses as recoveryTimeRequiredMatchUpStatuses, index_requestConstants as requestConstants, index_resultConstants as resultConstants, index_scaleConstants as scaleConstants, index_scheduleConstants as scheduleConstants, index_sortingConstants as sortingConstants, index_surfaceConstants as surfaceConstants, index_tieFormatConstants as tieFormatConstants, index_timeItemConstants as timeItemConstants, index_topicConstants as topicConstants, index_tournamentConstants as tournamentConstants, index_upcomingMatchUpStatuses as upcomingMatchUpStatuses, index_validMatchUpStatuses as validMatchUpStatuses, index_venueConstants as venueConstants };
11272
+ export { index_activeMatchUpStatuses as activeMatchUpStatuses, index_auditConstants as auditConstants, index_completedMatchUpStatuses as completedMatchUpStatuses, index_directingMatchUpStatuses as directingMatchUpStatuses, index_drawDefinitionConstants as drawDefinitionConstants, index_entryStatusConstants as entryStatusConstants, index_errorConditionConstants as errorConditionConstants, index_eventConstants as eventConstants, index_extensionConstants as extensionConstants, index_flightConstants as flightConstants, index_genderConstants as genderConstants, index_keyValueConstants as keyValueConstants, index_matchUpActionConstants as matchUpActionConstants, index_matchUpStatusConstants as matchUpStatusConstants, index_matchUpTypes as matchUpTypes, index_nonDirectingMatchUpStatuses as nonDirectingMatchUpStatuses, index_particicipantsRequiredMatchUpStatuses as particicipantsRequiredMatchUpStatuses, index_participantConstants as participantConstants, index_participantRoles as participantRoles, index_participantTypes as participantTypes, index_penaltyConstants as penaltyConstants, index_policyConstants as policyConstants, index_positionActionConstants as positionActionConstants, index_ratingConstants as ratingConstants, index_recoveryTimeRequiredMatchUpStatuses as recoveryTimeRequiredMatchUpStatuses, index_requestConstants as requestConstants, index_resourceContants as resourceContants, index_resultConstants as resultConstants, index_scaleConstants as scaleConstants, index_scheduleConstants as scheduleConstants, index_sortingConstants as sortingConstants, index_surfaceConstants as surfaceConstants, index_tieFormatConstants as tieFormatConstants, index_timeItemConstants as timeItemConstants, index_topicConstants as topicConstants, index_tournamentConstants as tournamentConstants, index_upcomingMatchUpStatuses as upcomingMatchUpStatuses, index_validMatchUpStatuses as validMatchUpStatuses, index_venueConstants as venueConstants };
11249
11273
  }
11250
11274
 
11251
- export { activeMatchUpStatuses, askEngine, asyncEngine, auditConstants, competitionEngine, index$k as competitionGovernor, completedMatchUpStatuses, directingMatchUpStatuses, drawDefinitionConstants, index$j as drawsGovernor, index$i as entriesGovernor, entryStatusConstants, errorConditionConstants, eventConstants, index$h as eventGovernor, extensionConstants, index as factoryConstants, fixtures, flightConstants, forge, genderConstants, index$g as generationGovernor, globalState, index$2 as governors, keyValueConstants, matchUpActionConstants, matchUpEngine, index$f as matchUpFormatCode, index$f as matchUpFormatGovernor, index$e as matchUpGovernor, matchUpStatusConstants, matchUpTypes, mocksEngine, index$d as mocksGovernor, nonDirectingMatchUpStatuses, particicipantsRequiredMatchUpStatuses, participantConstants, index$c as participantGovernor, participantRoles, participantTypes, penaltyConstants, policyConstants, index$b as policyGovernor, positionActionConstants, index$a as publishingGovernor, index$9 as queryGovernor, ratingConstants, recoveryTimeRequiredMatchUpStatuses, index$8 as reportGovernor, requestConstants, resultConstants, scaleConstants, scaleEngine, scheduleConstants, index$7 as scheduleGovernor, index$6 as scoreGovernor, sortingConstants, surfaceConstants, syncEngine, tieFormatConstants, index$5 as tieFormatGovernor, timeItemConstants, index$1 as tools, topicConstants, tournamentConstants, tournamentEngine, index$4 as tournamentGovernor, upcomingMatchUpStatuses, index$1 as utilities, validMatchUpStatuses, venueConstants, index$3 as venueGovernor, factoryVersion as version };
11275
+ export { activeMatchUpStatuses, askEngine, asyncEngine, auditConstants, competitionEngine, index$k as competitionGovernor, completedMatchUpStatuses, directingMatchUpStatuses, drawDefinitionConstants, index$j as drawsGovernor, index$i as entriesGovernor, entryStatusConstants, errorConditionConstants, eventConstants, index$h as eventGovernor, extensionConstants, index as factoryConstants, fixtures, flightConstants, forge, genderConstants, index$g as generationGovernor, globalState, index$2 as governors, keyValueConstants, matchUpActionConstants, matchUpEngine, index$f as matchUpFormatCode, index$f as matchUpFormatGovernor, index$e as matchUpGovernor, matchUpStatusConstants, matchUpTypes, mocksEngine, index$d as mocksGovernor, nonDirectingMatchUpStatuses, particicipantsRequiredMatchUpStatuses, participantConstants, index$c as participantGovernor, participantRoles, participantTypes, penaltyConstants, policyConstants, index$b as policyGovernor, positionActionConstants, index$a as publishingGovernor, index$9 as queryGovernor, ratingConstants, recoveryTimeRequiredMatchUpStatuses, index$8 as reportGovernor, requestConstants, resourceContants, resultConstants, scaleConstants, scaleEngine, scheduleConstants, index$7 as scheduleGovernor, index$6 as scoreGovernor, sortingConstants, surfaceConstants, syncEngine, tieFormatConstants, index$5 as tieFormatGovernor, timeItemConstants, index$1 as tools, topicConstants, tournamentConstants, tournamentEngine, index$4 as tournamentGovernor, upcomingMatchUpStatuses, index$1 as utilities, validMatchUpStatuses, venueConstants, index$3 as venueGovernor, factoryVersion as version };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.51';
6
+ return '2.0.53';
7
7
  }
8
8
 
9
9
  function isFunction(obj) {
@@ -1783,6 +1783,15 @@ function decorateResult({ context, result, stack, info }) {
1783
1783
  return result ?? { success: true };
1784
1784
  }
1785
1785
 
1786
+ const RESOURCE_SUB_TYPE = 'resourceSubType';
1787
+ const RESOURCE_TYPE = 'resourceType';
1788
+ const IDENTIFIER = 'identifier';
1789
+ const resourceContants = {
1790
+ RESOURCE_SUB_TYPE,
1791
+ RESOURCE_TYPE,
1792
+ IDENTIFIER,
1793
+ };
1794
+
1786
1795
  const SINGLES$1 = 'SINGLES';
1787
1796
  const SINGLES_EVENT = 'SINGLES';
1788
1797
  const DOUBLES$1 = 'DOUBLES';
@@ -1807,6 +1816,7 @@ const eventConstants = {
1807
1816
  const TOURNAMENT_RECORDS = 'tournamentRecords';
1808
1817
  const POLICY_DEFINITIONS = 'policyDefinitions';
1809
1818
  const TOURNAMENT_RECORD = 'tournamentRecord';
1819
+ const ONLINE_RESOURCE = 'onlineResource';
1810
1820
  const DRAW_DEFINITION = 'drawDefinition';
1811
1821
  const MATCHUP_FORMAT = 'matchUpFormat';
1812
1822
  const PARTICIPANT_ID = 'participantId';
@@ -1849,6 +1859,7 @@ const ONE_OF = '_oneOf';
1849
1859
 
1850
1860
  const validators = {
1851
1861
  [EVENT_TYPE]: (value) => [SINGLES$1, DOUBLES$1, TEAM$2].includes(value),
1862
+ [ONLINE_RESOURCE]: (value) => intersection(Object.keys(value), [RESOURCE_SUB_TYPE, RESOURCE_TYPE, IDENTIFIER]).length === 3,
1852
1863
  };
1853
1864
  const errors = {
1854
1865
  [TOURNAMENT_RECORDS]: MISSING_TOURNAMENT_RECORDS,
@@ -1861,6 +1872,7 @@ const errors = {
1861
1872
  [STRUCTURE_ID]: MISSING_STRUCTURE_ID,
1862
1873
  [MATCHUP_IDS]: MISSING_MATCHUP_IDS,
1863
1874
  [PARTICIPANT]: MISSING_PARTICIPANT,
1875
+ [ONLINE_RESOURCE]: INVALID_OBJECT,
1864
1876
  [EVENT_TYPE]: INVALID_EVENT_TYPE,
1865
1877
  [STRUCTURES]: MISSING_STRUCTURES,
1866
1878
  [MATCHUP_ID]: MISSING_MATCHUP_ID,
@@ -1879,6 +1891,7 @@ const paramTypes = {
1879
1891
  [POLICY_DEFINITIONS]: OBJECT,
1880
1892
  [TOURNAMENT_RECORD]: OBJECT,
1881
1893
  [DRAW_DEFINITION]: OBJECT,
1894
+ [ONLINE_RESOURCE]: OBJECT,
1882
1895
  [SCHEDULE_DATES]: ARRAY,
1883
1896
  [PARTICIPANT]: OBJECT,
1884
1897
  [MATCHUP_IDS]: ARRAY,
@@ -27015,7 +27028,8 @@ function getSideRatings({ tournamentParticipants, adHocRatings, eventType, scale
27015
27028
  });
27016
27029
  }
27017
27030
 
27018
- function getPairings({ tournamentParticipants, adHocRatings = {}, possiblePairings, uniquePairings, maxIterations, deltaObjects, valueObjects, eventType, scaleName, salted, }) {
27031
+ function getPairings(params) {
27032
+ const { tournamentParticipants, adHocRatings = {}, possiblePairings, uniquePairings, maxIterations, minimizeDelta, deltaObjects, valueObjects, eventType, scaleName, salted, } = params;
27019
27033
  uniquePairings.forEach((pairing) => {
27020
27034
  const ratings = getSideRatings({
27021
27035
  tournamentParticipants,
@@ -27047,7 +27061,7 @@ function getPairings({ tournamentParticipants, adHocRatings = {}, possiblePairin
27047
27061
  deltaObjects,
27048
27062
  valueObjects,
27049
27063
  });
27050
- const { participantIdPairings } = candidate;
27064
+ const { participantIdPairings } = minimizeDelta ? deltaCandidate : candidate;
27051
27065
  return {
27052
27066
  participantIdPairings,
27053
27067
  candidatesCount,
@@ -27060,14 +27074,13 @@ function getPairings({ tournamentParticipants, adHocRatings = {}, possiblePairin
27060
27074
  const ENCOUNTER_VALUE = 100;
27061
27075
  const SAME_TEAM_VALUE = 100;
27062
27076
  const MAX_ITERATIONS = 4000;
27063
- function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValue = SAME_TEAM_VALUE, maxIterations = MAX_ITERATIONS, updateParticipantRatings, generateMatchUps = true, ignoreLastRoundNumber, iterationMatchUps, tournamentRecord, dynamicRatings, refreshDynamic, participantIds, drawDefinition, adHocRatings, salted = 0.5, roundNumber, structureId, matchUpIds, eventType, structure, scaleName, idPrefix, isMock, event, }) {
27077
+ function generateDrawMaticRound(params) {
27078
+ const { encounterValue = ENCOUNTER_VALUE, sameTeamValue = SAME_TEAM_VALUE, maxIterations = MAX_ITERATIONS, updateParticipantRatings, generateMatchUps = true, ignoreLastRoundNumber, iterationMatchUps, tournamentRecord, dynamicRatings, refreshDynamic, participantIds, drawDefinition, roundNumber, structureId, matchUpIds, eventType, scaleName, idPrefix, isMock, salted, event, } = params;
27064
27079
  if (!drawDefinition)
27065
27080
  return { error: MISSING_DRAW_DEFINITION };
27066
- if (!structure && !structureId)
27081
+ if (!params.structure && !structureId)
27067
27082
  return { error: STRUCTURE_NOT_FOUND };
27068
- if (!structure) {
27069
- structure = findStructure({ drawDefinition, structureId }).structure;
27070
- }
27083
+ const structure = params.structure || findStructure({ drawDefinition, structureId }).structure;
27071
27084
  if (!isObject(structure))
27072
27085
  return { error: MISSING_STRUCTURE };
27073
27086
  if (!participantIds?.length)
@@ -27107,14 +27120,15 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
27107
27120
  const { uniquePairings, possiblePairings, deltaObjects } = getPairingsData({
27108
27121
  participantIds,
27109
27122
  });
27110
- const params = {
27111
- adHocRatings: modifiedScaleValues || adHocRatings,
27123
+ const adHocRatings = Object.values(modifiedScaleValues).length ? modifiedScaleValues : params.adHocRatings;
27124
+ const paringParams = {
27112
27125
  tournamentParticipants,
27113
27126
  possiblePairings,
27114
- drawDefinition,
27115
27127
  participantIds,
27116
27128
  uniquePairings,
27129
+ drawDefinition,
27117
27130
  maxIterations,
27131
+ adHocRatings,
27118
27132
  deltaObjects,
27119
27133
  valueObjects,
27120
27134
  eventType,
@@ -27122,7 +27136,7 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
27122
27136
  structure,
27123
27137
  salted,
27124
27138
  };
27125
- const { candidatesCount, participantIdPairings, iterations, candidate } = getPairings(params);
27139
+ const { candidatesCount, participantIdPairings, deltaCandidate, iterations, candidate } = getPairings(paringParams);
27126
27140
  if (!candidatesCount)
27127
27141
  return { error: NO_CANDIDATES };
27128
27142
  let generatedRoundNumber;
@@ -27151,6 +27165,7 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
27151
27165
  participantIdPairings,
27152
27166
  modifiedScaleValues,
27153
27167
  candidatesCount,
27168
+ deltaCandidate,
27154
27169
  ...SUCCESS,
27155
27170
  iterations,
27156
27171
  matchUps,
@@ -47585,8 +47600,8 @@ function nameMocks({ nameRoot = 'TEAM', count = 1 } = {}) {
47585
47600
  }
47586
47601
 
47587
47602
  function generateParticipants(params) {
47588
- let { rankingRange, scaledParticipantsCount, } = 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;
47603
+ let { scaledParticipantsCount, rankingRange, } = params;
47604
+ const { ratingsParameters: ratingsParameters$1 = ratingsParameters, valuesInstanceLimit, ratingsValues = [], consideredDate, categories, category, nationalityCodesCount, nationalityCodeType, nationalityCodes, participantsCount = 32, participantType, personIds, idPrefix, uuids, personExtensions, addressProps, gendersCount, matchUpType, personData, sex, inContext, withISO2, withIOC, scaleAllParticipants, } = params;
47590
47605
  const doubles = participantType === PAIR || matchUpType === DOUBLES_MATCHUP;
47591
47606
  const team = participantType === TEAM || matchUpType === TEAM;
47592
47607
  if (rankingRange &&
@@ -47621,7 +47636,14 @@ function generateParticipants(params) {
47621
47636
  Object.assign(singlesRatings, result.singlesRatings);
47622
47637
  };
47623
47638
  if (isObject(category)) {
47624
- const result = genRatings({ category, scaledParticipantsCount, ratingsParameters: ratingsParameters$1, participantType, rankingRange });
47639
+ const result = genRatings({
47640
+ scaledParticipantsCount,
47641
+ ratingsParameters: ratingsParameters$1,
47642
+ participantType,
47643
+ ratingsValues,
47644
+ rankingRange,
47645
+ category,
47646
+ });
47625
47647
  assignResult(result);
47626
47648
  }
47627
47649
  if (Array.isArray(categories)) {
@@ -47630,6 +47652,7 @@ function generateParticipants(params) {
47630
47652
  scaledParticipantsCount,
47631
47653
  ratingsParameters: ratingsParameters$1,
47632
47654
  participantType,
47655
+ ratingsValues,
47633
47656
  rankingRange,
47634
47657
  category,
47635
47658
  });
@@ -47814,7 +47837,7 @@ function addScaleItem({ scaleValue: itemValue, participant, eventType, scaleType
47814
47837
  }
47815
47838
  }
47816
47839
  function genRatings(params) {
47817
- const { category, scaledParticipantsCount, ratingsParameters, participantType } = params;
47840
+ const { category, scaledParticipantsCount, ratingsParameters, participantType, ratingsValues = [] } = params;
47818
47841
  const rankingRange = category.rankingRange || params.rankingRange || [1, 1000];
47819
47842
  const doublesRankings = {}, singlesRankings = {}, singlesRatings = {}, doublesRatings = {};
47820
47843
  const { categoryName, ageCategoryCode, ratingType } = category;
@@ -47851,20 +47874,24 @@ function genRatings(params) {
47851
47874
  return generatedAttributes;
47852
47875
  };
47853
47876
  const inverted = range[0] > range[1];
47854
- const skew = inverted ? 2 : 0.5;
47877
+ const skew = inverted ? 2 : 0.7;
47855
47878
  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();
47879
+ const generateRatings = () => {
47880
+ const ratingsBucket = generateRange(0, 2000)
47881
+ .map(() => skewedDistribution(min, max, skew, step, decimalsCount));
47882
+ return ratingsBucket
47883
+ .filter((rating) => (!ratingMax || rating <= ratingMax) && (!ratingMin || rating >= ratingMin))
47884
+ .slice(0, scaledParticipantsCount || randomInt(20, 30))
47885
+ .map((scaleValue) => {
47886
+ return !accessors
47887
+ ? scaleValue
47888
+ : Object.assign({}, ...accessors.map((accessor) => ({ [accessor]: scaleValue })), getAttributes(attributes));
47889
+ });
47890
+ };
47891
+ const generatedRatings = generateRatings();
47892
+ singlesRatings[scaleName] = [...ratingsValues, ...generatedRatings];
47866
47893
  if ([PAIR, TEAM].includes(participantType)) {
47867
- doublesRatings[scaleName] = generateRatings();
47894
+ doublesRatings[scaleName] = [...ratingsValues, ...generatedRatings];
47868
47895
  }
47869
47896
  }
47870
47897
  return { singlesRankings, doublesRankings, singlesRatings, doublesRatings };
@@ -55389,23 +55416,81 @@ function setTournamentStatus({ tournamentRecord, status }) {
55389
55416
  return { ...SUCCESS };
55390
55417
  }
55391
55418
 
55392
- function addOnlineResource({ tournamentRecord, onlineResource, organisationId, participantId, personId, courtId, venueId, }) {
55393
- if (!tournamentRecord)
55394
- return { error: MISSING_TOURNAMENT_RECORD };
55395
- if (!isObject(onlineResource))
55396
- return { error: MISSING_VALUE };
55397
- if (intersection(Object.keys(onlineResource), ['resourceSubType', 'resourceType', 'identifier']).length !== 3)
55398
- return decorateResult({
55399
- result: { error: INVALID_OBJECT },
55400
- context: { onlineResource },
55419
+ function removeOnlineResource(params) {
55420
+ const paramsCheck = checkRequiredParameters(params, [{ tournamentRecord: true, onlineResource: true }]);
55421
+ if (paramsCheck.error)
55422
+ return paramsCheck;
55423
+ const { tournamentRecord, onlineResource, organisationId, participantId, personId, courtId, venueId } = params;
55424
+ if (organisationId) {
55425
+ if (tournamentRecord.parentOrganisation?.parentOrganisationId !== organisationId) {
55426
+ return decorateResult({ result: { error: NOT_FOUND } });
55427
+ }
55428
+ removeResource({ element: tournamentRecord.parentOrganisation, onlineResource });
55429
+ }
55430
+ else if (participantId || personId) {
55431
+ const participant = (tournamentRecord.participants ?? []).find((p) => (personId && p.person?.personId === personId) || p.participantId === participantId);
55432
+ if (!participant) {
55433
+ if (personId) {
55434
+ return decorateResult({ result: { error: NOT_FOUND } });
55435
+ }
55436
+ else {
55437
+ return decorateResult({ result: { error: PARTICIPANT_NOT_FOUND } });
55438
+ }
55439
+ }
55440
+ if (personId) {
55441
+ if (participant.person?.personId !== personId) {
55442
+ return decorateResult({ result: { error: INVALID_PARTICIPANT } });
55443
+ }
55444
+ removeResource({ element: participant.person, onlineResource });
55445
+ }
55446
+ else {
55447
+ removeResource({ element: participant, onlineResource });
55448
+ }
55449
+ }
55450
+ else if (courtId) {
55451
+ const court = (tournamentRecord.venues ?? [])
55452
+ .filter((v) => !venueId || v.venueId === venueId)
55453
+ .flatMap((v) => (v.courts ?? []).filter((c) => c.courtId === courtId))?.[0];
55454
+ if (!court)
55455
+ return decorateResult({ result: { error: COURT_NOT_FOUND } });
55456
+ removeResource({ element: court, onlineResource });
55457
+ }
55458
+ else if (venueId) {
55459
+ const venue = (tournamentRecord.venues ?? []).find((v) => v.venueId === venueId);
55460
+ if (!venue)
55461
+ return decorateResult({ result: { error: VENUE_NOT_FOUND } });
55462
+ removeResource({ element: venue, onlineResource });
55463
+ }
55464
+ else {
55465
+ removeResource({ element: tournamentRecord, onlineResource });
55466
+ addNotice({
55467
+ payload: {
55468
+ parentOrganisation: tournamentRecord.parentOrganisation,
55469
+ onlineResources: tournamentRecord.onlineResources,
55470
+ tournamentId: tournamentRecord.tournamentId,
55471
+ },
55472
+ topic: MODIFY_TOURNAMENT_DETAIL,
55401
55473
  });
55474
+ }
55475
+ return { ...SUCCESS };
55476
+ }
55477
+ function removeResource({ element, onlineResource }) {
55478
+ const onlineResources = (element.onlineResources ?? []).filter((resource) => !(resource?.[RESOURCE_SUB_TYPE] === onlineResource[RESOURCE_SUB_TYPE] &&
55479
+ resource?.[RESOURCE_TYPE] === onlineResource[RESOURCE_TYPE] &&
55480
+ resource?.[IDENTIFIER] === onlineResource[IDENTIFIER]));
55481
+ element.onlineResources = onlineResources;
55482
+ }
55483
+
55484
+ function addOnlineResource(params) {
55485
+ const paramsCheck = checkRequiredParameters(params, [{ tournamentRecord: true, onlineResource: true }]);
55486
+ if (paramsCheck.error)
55487
+ return paramsCheck;
55488
+ const { tournamentRecord, onlineResource, organisationId, participantId, personId, courtId, venueId } = params;
55402
55489
  if (organisationId) {
55403
55490
  if (tournamentRecord.parentOrganisation?.parentOrganisationId !== organisationId) {
55404
55491
  return decorateResult({ result: { error: NOT_FOUND } });
55405
55492
  }
55406
- if (!tournamentRecord.parentOrganisation.onlineResources)
55407
- tournamentRecord.parentOrganisation.onlineResources = [];
55408
- tournamentRecord.parentOrganisation.onlineResources.push(onlineResource);
55493
+ mergeResource({ element: tournamentRecord.parentOrganisation, onlineResource });
55409
55494
  }
55410
55495
  else if (participantId || personId) {
55411
55496
  const participant = (tournamentRecord.participants ?? []).find((p) => (personId && p.person?.personId === personId) || p.participantId === participantId);
@@ -55421,14 +55506,10 @@ function addOnlineResource({ tournamentRecord, onlineResource, organisationId, p
55421
55506
  if (participant.person?.personId !== personId) {
55422
55507
  return decorateResult({ result: { error: INVALID_PARTICIPANT } });
55423
55508
  }
55424
- if (!participant.person.onlineResources)
55425
- participant.person.onlineResources = [];
55426
- participant.person.onlineResources.push(onlineResource);
55509
+ mergeResource({ element: participant.person, onlineResource });
55427
55510
  }
55428
55511
  else {
55429
- if (!participant.onlineResources)
55430
- participant.onlineResources = [];
55431
- participant.onlineResources.push(onlineResource);
55512
+ mergeResource({ element: participant, onlineResource });
55432
55513
  }
55433
55514
  }
55434
55515
  else if (courtId) {
@@ -55437,25 +55518,35 @@ function addOnlineResource({ tournamentRecord, onlineResource, organisationId, p
55437
55518
  .flatMap((v) => (v.courts ?? []).filter((c) => c.courtId === courtId))?.[0];
55438
55519
  if (!court)
55439
55520
  return decorateResult({ result: { error: COURT_NOT_FOUND } });
55440
- if (!court.onlineResources)
55441
- court.onlineResources = [];
55442
- court.onlineResources.push(onlineResource);
55521
+ mergeResource({ element: court, onlineResource });
55443
55522
  }
55444
55523
  else if (venueId) {
55445
55524
  const venue = (tournamentRecord.venues ?? []).find((v) => v.venueId === venueId);
55446
55525
  if (!venue)
55447
55526
  return decorateResult({ result: { error: VENUE_NOT_FOUND } });
55448
- if (!venue.onlineResources)
55449
- venue.onlineResources = [];
55450
- venue.onlineResources.push(onlineResource);
55527
+ mergeResource({ element: venue, onlineResource });
55451
55528
  }
55452
55529
  else {
55453
- if (!tournamentRecord.onlineResources)
55454
- tournamentRecord.onlineResources = [];
55455
- tournamentRecord.onlineResources.push(onlineResource);
55530
+ mergeResource({ element: tournamentRecord, onlineResource });
55531
+ addNotice({
55532
+ payload: {
55533
+ parentOrganisation: tournamentRecord.parentOrganisation,
55534
+ onlineResources: tournamentRecord.onlineResources,
55535
+ tournamentId: tournamentRecord.tournamentId,
55536
+ },
55537
+ topic: MODIFY_TOURNAMENT_DETAIL,
55538
+ });
55456
55539
  }
55457
55540
  return { ...SUCCESS };
55458
55541
  }
55542
+ function mergeResource({ element, onlineResource }) {
55543
+ const onlineResources = (element.onlineResources ?? []).filter((resource) => resource?.[RESOURCE_SUB_TYPE] !== onlineResource[RESOURCE_SUB_TYPE] &&
55544
+ resource?.[RESOURCE_TYPE] !== onlineResource[RESOURCE_TYPE] &&
55545
+ resource?.[IDENTIFIER] !== onlineResource[IDENTIFIER]);
55546
+ onlineResources.push(onlineResource);
55547
+ element.onlineResources = onlineResources;
55548
+ return { ...SUCCESS };
55549
+ }
55459
55550
 
55460
55551
  function setTournamentName({ tournamentRecord, promotionalName, tournamentName, formalName }) {
55461
55552
  if (!tournamentRecord)
@@ -55667,6 +55758,7 @@ var mutate$1 = {
55667
55758
  removeEventExtension: removeEventExtension,
55668
55759
  removeExtension: removeExtension,
55669
55760
  removeNotes: removeNotes,
55761
+ removeOnlineResource: removeOnlineResource,
55670
55762
  removeParticipantExtension: removeParticipantExtension,
55671
55763
  removeTournamentExtension: removeTournamentExtension,
55672
55764
  setTournamentCategories: setTournamentCategories,
@@ -55710,6 +55802,7 @@ var index$3 = {
55710
55802
  removeEventExtension: removeEventExtension,
55711
55803
  removeExtension: removeExtension,
55712
55804
  removeNotes: removeNotes,
55805
+ removeOnlineResource: removeOnlineResource,
55713
55806
  removeParticipantExtension: removeParticipantExtension,
55714
55807
  removeTournamentExtension: removeTournamentExtension,
55715
55808
  setTournamentCategories: setTournamentCategories,
@@ -58364,6 +58457,7 @@ var index = {
58364
58457
  ratingConstants: ratingConstants,
58365
58458
  recoveryTimeRequiredMatchUpStatuses: recoveryTimeRequiredMatchUpStatuses,
58366
58459
  requestConstants: requestConstants,
58460
+ resourceContants: resourceContants,
58367
58461
  resultConstants: resultConstants,
58368
58462
  scaleConstants: scaleConstants,
58369
58463
  scheduleConstants: scheduleConstants,
@@ -58428,6 +58522,7 @@ exports.ratingConstants = ratingConstants;
58428
58522
  exports.recoveryTimeRequiredMatchUpStatuses = recoveryTimeRequiredMatchUpStatuses;
58429
58523
  exports.reportGovernor = index$6;
58430
58524
  exports.requestConstants = requestConstants;
58525
+ exports.resourceContants = resourceContants;
58431
58526
  exports.resultConstants = resultConstants;
58432
58527
  exports.scaleConstants = scaleConstants;
58433
58528
  exports.scaleEngine = scaleEngine;