tods-competition-factory 1.7.13 → 1.7.15

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.
@@ -1691,12 +1691,13 @@ type FindMatchUpType = {
1691
1691
  drawId?: string;
1692
1692
  event?: Event;
1693
1693
  };
1694
- declare function findMatchUp({ participantsProfile, afterRecoveryTimes, tournamentRecord, contextContent, contextProfile, drawDefinition, matchUpId, inContext, eventId, drawId, event, }: FindMatchUpType): {
1694
+ type FindMatchUpResult = {
1695
1695
  drawDefinition?: DrawDefinition;
1696
1696
  matchUp?: HydratedMatchUp;
1697
1697
  structure?: Structure;
1698
1698
  error?: ErrorType;
1699
1699
  };
1700
+ declare function findMatchUp({ participantsProfile, afterRecoveryTimes, tournamentRecord, contextContent, contextProfile, drawDefinition, matchUpId, inContext, eventId, drawId, event, }: FindMatchUpType): FindMatchUpResult;
1700
1701
 
1701
1702
  type GetPositionAssignmentsArgs = {
1702
1703
  structureId?: string;
@@ -1811,8 +1812,8 @@ type MatchUpActionsArgs$1 = TournamentRecordsArgs & {
1811
1812
  drawId: string;
1812
1813
  };
1813
1814
  declare function matchUpActions$1(params?: MatchUpActionsArgs$1): (ResultType & {
1814
- event: Event | undefined;
1815
- drawDefinition: DrawDefinition | undefined;
1815
+ event?: Event | undefined;
1816
+ drawDefinition?: DrawDefinition | undefined;
1816
1817
  }) | (ResultType & {
1817
1818
  structureIsComplete?: boolean | undefined;
1818
1819
  isDoubleExit?: boolean | undefined;
@@ -1053,8 +1053,9 @@ function decorateResult({
1053
1053
  if (result && Array.isArray(result?.stack) && typeof stack === "string") {
1054
1054
  result.stack.push(stack);
1055
1055
  }
1056
- if (info && result?.error)
1057
- result.error.info = info;
1056
+ if (result && info) {
1057
+ result.info = info;
1058
+ }
1058
1059
  if (result && typeof context === "object" && Object.keys(context).length) {
1059
1060
  Object.assign(result, definedAttributes(context));
1060
1061
  }
@@ -1123,7 +1124,7 @@ function addExtension$1(params) {
1123
1124
  });
1124
1125
  if (!params.element.extensions)
1125
1126
  params.element.extensions = [];
1126
- const creationTime = params.creationTime !== void 0 ? params.creationTime : true;
1127
+ const creationTime = params?.creationTime ?? true;
1127
1128
  if (creationTime) {
1128
1129
  const createdAt = (/* @__PURE__ */ new Date()).toISOString();
1129
1130
  Object.assign(params.extension, { createdAt });
@@ -5172,19 +5173,15 @@ function findEvent({
5172
5173
  }) {
5173
5174
  const stack = "findEvent";
5174
5175
  if (!tournamentRecord)
5175
- return {
5176
- event: void 0,
5177
- drawDefinition: void 0,
5178
- ...decorateResult({
5179
- result: { error: MISSING_TOURNAMENT_RECORD },
5180
- stack
5181
- })
5182
- };
5183
- const events = tournamentRecord?.events || [];
5176
+ return decorateResult({
5177
+ result: { error: MISSING_TOURNAMENT_RECORD },
5178
+ stack
5179
+ });
5180
+ const events = tournamentRecord?.events ?? [];
5184
5181
  if (drawId) {
5185
5182
  let drawDefinition;
5186
5183
  const event = events.find((event2) => {
5187
- const drawDefinitions = event2?.drawDefinitions || [];
5184
+ const drawDefinitions = event2?.drawDefinitions ?? [];
5188
5185
  const targetDrawDefinition = drawDefinitions.find(
5189
5186
  (drawDefinition2) => drawDefinition2.drawId === drawId
5190
5187
  );
@@ -5502,7 +5499,7 @@ function findCourt({
5502
5499
  } else if (tournamentRecords) {
5503
5500
  const linkedTournamentIds = getLinkedTournamentIds({
5504
5501
  tournamentRecords
5505
- }).linkedTournamentIds || [];
5502
+ }).linkedTournamentIds ?? [];
5506
5503
  const relevantIds = linkedTournamentIds[tournamentRecord.tournamentId];
5507
5504
  for (const tournamentId of relevantIds) {
5508
5505
  const record = tournamentRecords[tournamentId];
@@ -8496,7 +8493,7 @@ function findMatchUp({
8496
8493
  if (typeof matchUpId !== "string")
8497
8494
  return { error: MISSING_MATCHUP_ID };
8498
8495
  if (!drawDefinition || !event) {
8499
- const matchUps = allTournamentMatchUps({ tournamentRecord }).matchUps || [];
8496
+ const matchUps = allTournamentMatchUps({ tournamentRecord }).matchUps ?? [];
8500
8497
  const inContextMatchUp = matchUps.find(
8501
8498
  (matchUp2) => matchUp2.matchUpId === matchUpId
8502
8499
  );
@@ -8514,11 +8511,11 @@ function findMatchUp({
8514
8511
  if (contextProfile && !contextContent)
8515
8512
  contextContent = getContextContent({ tournamentRecord, contextProfile });
8516
8513
  const additionalContext = {
8517
- surfaceCategory: event?.surfaceCategory || tournamentRecord.surfaceCategory,
8518
- indoorOutDoor: event?.indoorOutdoor || tournamentRecord.indoorOutdoor,
8519
- endDate: event?.endDate || tournamentRecord.endDate,
8514
+ surfaceCategory: event?.surfaceCategory ?? tournamentRecord.surfaceCategory,
8515
+ indoorOutDoor: event?.indoorOutdoor ?? tournamentRecord.indoorOutdoor,
8516
+ endDate: event?.endDate ?? tournamentRecord.endDate,
8520
8517
  tournamentId: tournamentRecord.tournamentId,
8521
- eventId: eventId || event?.eventId,
8518
+ eventId: eventId ?? event?.eventId,
8522
8519
  drawId
8523
8520
  };
8524
8521
  const { participants: tournamentParticipants = [] } = hydrateParticipants({
@@ -11469,8 +11466,8 @@ function getSeedGroups({
11469
11466
  return {
11470
11467
  seedGroups: void 0,
11471
11468
  ...decorateResult({
11472
- result: { error: INVALID_VALUES },
11473
11469
  context: { roundRobinGroupsCount },
11470
+ result: { error: INVALID_VALUES },
11474
11471
  stack
11475
11472
  })
11476
11473
  };