tods-competition-factory 1.8.8 → 1.8.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.
package/dist/index.mjs CHANGED
@@ -913,10 +913,6 @@ const INVALID_SCALE_ITEM = {
913
913
  message: "Invalid scaleItem",
914
914
  code: "ERR_INVALID_SCALE_ITEM"
915
915
  };
916
- const SCALE_ITEM_NOT_FOUND = {
917
- message: "No scaleItem found",
918
- code: "ERR_NOT_FOUND_SCALE_ITEM"
919
- };
920
916
  const MODIFICATIONS_FAILED = {
921
917
  message: "Modifications failed",
922
918
  code: "ERR_FAILURE_MODIFICATIONS"
@@ -1174,7 +1170,6 @@ const errorConditionConstants = {
1174
1170
  PENALTY_NOT_FOUND,
1175
1171
  POLICY_NOT_ATTACHED,
1176
1172
  POLICY_NOT_FOUND,
1177
- SCALE_ITEM_NOT_FOUND,
1178
1173
  SCHEDULE_NOT_CLEARED,
1179
1174
  SCHEDULED_MATCHUPS,
1180
1175
  SEEDSCOUNT_GREATER_THAN_DRAW_SIZE,
@@ -2380,7 +2375,7 @@ const matchUpFormatCode = {
2380
2375
  };
2381
2376
 
2382
2377
  function factoryVersion() {
2383
- return "1.8.8";
2378
+ return "1.8.10";
2384
2379
  }
2385
2380
 
2386
2381
  function getObjectTieFormat(obj) {
@@ -4470,7 +4465,7 @@ function getPolicyDefinitions({
4470
4465
  if (policy)
4471
4466
  policyDefinitions[policyType] = policy;
4472
4467
  }
4473
- return Object.keys(policyDefinitions).length ? { policyDefinitions } : { error: POLICY_NOT_FOUND };
4468
+ return Object.keys(policyDefinitions).length ? { policyDefinitions } : { info: POLICY_NOT_FOUND.message };
4474
4469
  }
4475
4470
 
4476
4471
  const WALKOVER$1 = "WALKOVER";
@@ -4587,7 +4582,7 @@ function findPolicy({
4587
4582
  structure,
4588
4583
  event
4589
4584
  });
4590
- return appliedPolicies?.[policyType] ? { policy: appliedPolicies[policyType] } : { error: POLICY_NOT_FOUND };
4585
+ return appliedPolicies?.[policyType] ? { policy: appliedPolicies[policyType] } : { info: POLICY_NOT_FOUND?.message };
4591
4586
  }
4592
4587
 
4593
4588
  function getMatchUpCompetitiveProfile({
@@ -26700,7 +26695,7 @@ function participantScaleItem({
26700
26695
  return { error: INVALID_VALUES };
26701
26696
  if (!participant.timeItems)
26702
26697
  participant.timeItems = [];
26703
- if (participant && Array.isArray(participant.timeItems)) {
26698
+ if (Array.isArray(participant.timeItems)) {
26704
26699
  const { accessor, scaleType, eventType, scaleName } = scaleAttributes;
26705
26700
  const filterType = [SCALE$1, scaleType, eventType, scaleName].join(".");
26706
26701
  const filteredTimeItems = participant.timeItems.filter((timeItem2) => timeItem2?.itemType === filterType).filter((timeItem2) => !requireTimeStamp || timeItem2?.itemDate).sort(
@@ -26720,12 +26715,10 @@ function participantScaleItem({
26720
26715
  scaleName: scaleName2,
26721
26716
  scaleType: scaleType2
26722
26717
  };
26723
- return { scaleItem };
26724
- } else {
26725
- return { error: SCALE_ITEM_NOT_FOUND };
26718
+ return { ...SUCCESS, scaleItem };
26726
26719
  }
26727
26720
  }
26728
- return { error: MISSING_PARTICIPANT };
26721
+ return { ...SUCCESS, scaleItem: void 0 };
26729
26722
  }
26730
26723
 
26731
26724
  function getEventSeedAssignments({
@@ -27188,8 +27181,6 @@ function getParticipantEntries(params) {
27188
27181
  participantMap,
27189
27182
  withPotentialMatchUps,
27190
27183
  withRankingProfile,
27191
- withScheduleTimes,
27192
- withScheduleItems,
27193
27184
  scheduleAnalysis,
27194
27185
  withTeamMatchUps,
27195
27186
  withStatistics,
@@ -27199,8 +27190,7 @@ function getParticipantEntries(params) {
27199
27190
  withEvents,
27200
27191
  withDraws
27201
27192
  } = params;
27202
- if (withScheduleItems)
27203
- console.log({ withScheduleItems });
27193
+ const withScheduleTimes = params.withScheduleTimes ?? params.withScheduleItems;
27204
27194
  const targetParticipantIds = participantFilters?.participantIds;
27205
27195
  const getRelevantParticipantIds = (participantId) => {
27206
27196
  const relevantParticipantIds = [participantId];
@@ -36525,7 +36515,11 @@ function getRounds({
36525
36515
  const keepComplete = !excludeCompletedRounds || !isComplete;
36526
36516
  const keepScheduled = !excludeScheduledRounds || !isScheduled;
36527
36517
  const event = venueId || scheduleDate ? events?.find(({ eventId }) => eventId === round.eventId) : void 0;
36528
- const validDate = !scheduleDate || event?.startDate && event?.endDate && new Date(scheduleDate) >= new Date(event?.startDate) && new Date(scheduleDate) <= new Date(event?.endDate);
36518
+ const startDate = event?.startDate || tournamentRecord?.startDate;
36519
+ const endDate = event?.endDate || tournamentRecord?.endDate;
36520
+ const validStartDate = !scheduleDate || !startDate || new Date(scheduleDate) >= new Date(startDate);
36521
+ const validEndDate = !scheduleDate || !endDate || new Date(scheduleDate) <= new Date(endDate);
36522
+ const validDate = validStartDate && validEndDate;
36529
36523
  const validVenue = !venueId || event?.validVenueIds.includes(venueId);
36530
36524
  const keepRound = keepComplete && keepScheduled && validVenue && validDate;
36531
36525
  if (!keepRound)
@@ -57644,7 +57638,7 @@ function modifyDrawDefinition({
57644
57638
  event
57645
57639
  }) {
57646
57640
  if (!isObject(drawUpdates))
57647
- return { error: INVALID_END_TIME };
57641
+ return { error: INVALID_VALUES };
57648
57642
  const flightProfile = getFlightProfile({ event }).flightProfile;
57649
57643
  const nameResult = drawUpdates.drawName && modifyDrawName({
57650
57644
  drawName: drawUpdates.drawName,