tods-competition-factory 2.1.9 → 2.1.10

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.
@@ -6479,13 +6479,13 @@ declare function modifyParticipantName({ tournamentRecord, participantName, part
6479
6479
  };
6480
6480
 
6481
6481
  type ScaledTeamAssignmentArgs = {
6482
- clearExistingAssignments?: boolean;
6483
6482
  individualParticipantIds?: string[];
6483
+ clearExistingAssignments?: boolean;
6484
6484
  reverseAssignmentOrder?: boolean;
6485
- initialTeamIndex?: number;
6486
- scaledParticipants?: any[];
6487
6485
  teamParticipantIds?: string[];
6488
6486
  tournamentRecord: Tournament;
6487
+ scaledParticipants?: any[];
6488
+ initialTeamIndex?: number;
6489
6489
  scaleAttributes?: any;
6490
6490
  teamNameBase?: string;
6491
6491
  teamsCount?: number;
@@ -9820,8 +9820,8 @@ declare function constantToString(str: any): any;
9820
9820
 
9821
9821
  declare function numericSort(a: any, b: any): number;
9822
9822
 
9823
- declare function UUIDS(count?: number): string[];
9824
- declare function UUID(): string;
9823
+ declare function UUIDS(count?: number, pre?: any): string[];
9824
+ declare function UUID(pre?: any): string;
9825
9825
 
9826
9826
  declare function unique(arr: any): any[];
9827
9827
  declare function noNulls(arr: any): any;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.1.9';
6
+ return '2.1.10';
7
7
  }
8
8
 
9
9
  function isFunction(obj) {
@@ -1573,9 +1573,8 @@ function enableNotifications() {
1573
1573
  _globalStateProvider.enableNotifications();
1574
1574
  }
1575
1575
  function setDeepCopy(value, attributes) {
1576
- if (typeof value === 'boolean') {
1576
+ if (typeof value === 'boolean')
1577
1577
  globalState.deepCopy = value;
1578
- }
1579
1578
  if (typeof attributes === 'object') {
1580
1579
  if (Array.isArray(attributes.ignore))
1581
1580
  globalState.deepCopyAttributes.ignore = attributes.ignore;
@@ -6920,10 +6919,10 @@ function matchUpStartTime({ matchUp }) {
6920
6919
  return { startTime };
6921
6920
  }
6922
6921
 
6923
- function UUIDS(count = 1) {
6924
- return generateRange(0, count).map(UUID);
6922
+ function UUIDS(count = 1, pre) {
6923
+ return generateRange(0, count).map(() => UUID(pre));
6925
6924
  }
6926
- function UUID() {
6925
+ function UUID(pre) {
6927
6926
  const lut = [];
6928
6927
  for (let i = 0; i < 256; i++) {
6929
6928
  lut[i] = (i < 16 ? '0' : '') + i.toString(16);
@@ -6932,7 +6931,7 @@ function UUID() {
6932
6931
  const d1 = (Math.random() * 0xffffffff) | 0;
6933
6932
  const d2 = (Math.random() * 0xffffffff) | 0;
6934
6933
  const d3 = (Math.random() * 0xffffffff) | 0;
6935
- return (lut[d0 & 0xff] +
6934
+ const uuid = lut[d0 & 0xff] +
6936
6935
  lut[(d0 >> 8) & 0xff] +
6937
6936
  lut[(d0 >> 16) & 0xff] +
6938
6937
  lut[(d0 >> 24) & 0xff] +
@@ -6951,7 +6950,8 @@ function UUID() {
6951
6950
  lut[d3 & 0xff] +
6952
6951
  lut[(d3 >> 8) & 0xff] +
6953
6952
  lut[(d3 >> 16) & 0xff] +
6954
- lut[(d3 >> 24) & 0xff]);
6953
+ lut[(d3 >> 24) & 0xff];
6954
+ return typeof pre === 'string' ? `${pre}_${uuid.replace(/-/g, '')}` : uuid;
6955
6955
  }
6956
6956
 
6957
6957
  function addVenue(params) {
@@ -25903,6 +25903,7 @@ function getCoercedDrawType(params) {
25903
25903
  const { drawTypeCoercion, enforceMinimumDrawSize } = params;
25904
25904
  const drawSize = ensureInt(params.drawSize);
25905
25905
  let drawType = (drawTypeCoercion &&
25906
+ params.drawType !== AD_HOC &&
25906
25907
  (typeof drawTypeCoercion === 'boolean' || drawTypeCoercion <= 2) &&
25907
25908
  drawSize === 2 &&
25908
25909
  SINGLE_ELIMINATION) ||
@@ -44322,8 +44323,8 @@ function setMatchUpState(params) {
44322
44323
  AWAITING_RESULT,
44323
44324
  ].includes(matchUpStatus)) {
44324
44325
  return {
44325
- error: INVALID_VALUES,
44326
44326
  info: 'Not supported for matchUpType: TEAM',
44327
+ error: INVALID_VALUES,
44327
44328
  };
44328
44329
  }
44329
44330
  const matchUpTieId = inContextMatchUp?.matchUpTieId;
@@ -44341,9 +44342,8 @@ function setMatchUpState(params) {
44341
44342
  winningSide,
44342
44343
  score,
44343
44344
  });
44344
- if (result.error) {
44345
+ if (result.error)
44345
44346
  return result;
44346
- }
44347
44347
  }
44348
44348
  const appliedPolicies = getAppliedPolicies({
44349
44349
  policyTypes: [POLICY_TYPE_PROGRESSION, POLICY_TYPE_SCORING],
@@ -49661,7 +49661,7 @@ function generateEventWithDraw(params) {
49661
49661
  return paramsCheck;
49662
49662
  const { allUniqueParticipantIds = [], participantsProfile = {}, matchUpStatusProfile, completeAllMatchUps, autoEntryPositions, hydrateCollections, randomWinningSide, ratingsParameters, tournamentRecord, isMock = true, drawProfile, startDate, drawIndex, uuids, } = params;
49663
49663
  const drawProfileCopy = makeDeepCopy(drawProfile, false, true);
49664
- const { excessParticipantAlternates = true, matchUpFormat = FORMAT_STANDARD, drawType = SINGLE_ELIMINATION, tournamentAlternates = 0, alternatesCount = 0, qualifyingPositions, qualifyingProfiles, generate = true, eventExtensions, drawExtensions, completionGoal, tieFormatName, seedsCount, timeItems, drawName, category, idPrefix, publish, gender, stage, } = drawProfileCopy;
49664
+ const { excessParticipantAlternates = true, matchUpFormat = FORMAT_STANDARD, drawType = SINGLE_ELIMINATION, tournamentAlternates = 0, alternatesCount = 0, qualifyingPositions, qualifyingProfiles, generate = true, eventExtensions, drawExtensions, completionGoal, tieFormatName, buildTeams, seedsCount, timeItems, drawName, category, idPrefix, publish, gender, stage, } = drawProfileCopy;
49665
49665
  const drawSize = drawProfileCopy.drawSize || (drawProfileCopy.ignoreDefaults ? undefined : 32);
49666
49666
  const eventId = drawProfileCopy.eventId || UUID();
49667
49667
  const eventType = drawProfile.eventType || drawProfile.matchUpType || SINGLES$1;
@@ -49776,11 +49776,12 @@ function generateEventWithDraw(params) {
49776
49776
  fIndex += genders[FEMALE];
49777
49777
  mIndex += genders[MALE];
49778
49778
  rIndex += mixedCount;
49779
+ const individualParticipantIds = buildTeams !== false ? [...fPIDs, ...mPIDs, ...rIDs] : [];
49779
49780
  return {
49780
- individualParticipantIds: [...fPIDs, ...mPIDs, ...rIDs],
49781
49781
  participantOtherName: `TM${teamIndex + 1}`,
49782
49782
  participantName: `Team ${teamIndex + 1}`,
49783
49783
  participantRole: COMPETITOR,
49784
+ individualParticipantIds,
49784
49785
  participantType: TEAM,
49785
49786
  participantId: UUID(),
49786
49787
  };
@@ -50678,6 +50679,8 @@ function anonymizeTournamentRecord({ keepExtensions = [], anonymizeParticipantNa
50678
50679
  tournamentRecord.isMock = true;
50679
50680
  delete tournamentRecord.parentOrganisation;
50680
50681
  for (const participant of tournamentRecord.participants || []) {
50682
+ participant.extensions = filterExtensions(participant);
50683
+ participant.onlineResources = [];
50681
50684
  const newParticipantId = UUID();
50682
50685
  idMap[participant.participantId] = newParticipantId;
50683
50686
  participant.participantId = newParticipantId;
@@ -50689,17 +50692,28 @@ function anonymizeTournamentRecord({ keepExtensions = [], anonymizeParticipantNa
50689
50692
  }
50690
50693
  let venueIndex = 0;
50691
50694
  for (const venue of tournamentRecord.venues || []) {
50695
+ venue.venueAbbreviation = `V${venueIndex}`;
50692
50696
  venue.extensions = filterExtensions(venue);
50693
50697
  venue.venueName = `Venue #${venueIndex}`;
50694
- venue.venueAbbreviation = `V${venueIndex}`;
50698
+ venue.onlineResources = [];
50699
+ venue.addresses = [];
50695
50700
  const newVenueId = UUID();
50696
50701
  idMap[venue.venueId] = newVenueId;
50697
50702
  venue.isMock = true;
50698
50703
  venueIndex += 1;
50704
+ let courtIndex = 0;
50705
+ for (const court of venue.courts || []) {
50706
+ court.courtName = `V${venueIndex}C${courtIndex}`;
50707
+ court.extensions = filterExtensions(court);
50708
+ court.onlineResources = [];
50709
+ court.isMock = true;
50710
+ courtIndex += 1;
50711
+ }
50699
50712
  }
50700
50713
  let eventCount = 1;
50701
50714
  for (const event of tournamentRecord.events || []) {
50702
50715
  event.extensions = filterExtensions(event);
50716
+ event.onlineResources = [];
50703
50717
  event.isMock = true;
50704
50718
  const newEventId = UUID();
50705
50719
  idMap[event.eventId] = newEventId;