tods-competition-factory 1.6.29 → 1.7.0

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.
@@ -750,7 +750,8 @@ var syncGlobalState$1 = {
750
750
  setSubscriptions,
751
751
  setTournamentId,
752
752
  setTournamentRecord,
753
- setTournamentRecords
753
+ setTournamentRecords,
754
+ handleCaughtError
754
755
  };
755
756
  function disableNotifications$1() {
756
757
  syncGlobalState.disableNotifications = true;
@@ -856,6 +857,26 @@ function callListener({ topic, notices }) {
856
857
  method(notices);
857
858
  }
858
859
  }
860
+ function handleCaughtError({
861
+ engineName,
862
+ methodName,
863
+ params,
864
+ err
865
+ }) {
866
+ let error;
867
+ if (typeof err === "string") {
868
+ error = err.toUpperCase();
869
+ } else if (err instanceof Error) {
870
+ error = err.message;
871
+ }
872
+ console.log("ERROR", {
873
+ tournamentId: getTournamentId(),
874
+ params: JSON.stringify(params),
875
+ engine: engineName,
876
+ methodName,
877
+ error
878
+ });
879
+ }
859
880
 
860
881
  const globalState = {
861
882
  tournamentFactoryVersion: "0.0.0",
@@ -20158,8 +20179,6 @@ function generateQualifyingStructures({
20158
20179
  function generateDrawStructuresAndLinks(params) {
20159
20180
  const {
20160
20181
  enforceMinimumDrawSize = true,
20161
- drawTypeCoercion = true,
20162
- // coerce to SINGLE_ELIMINATION for drawSize: 2
20163
20182
  overwriteExisting,
20164
20183
  appliedPolicies,
20165
20184
  staggeredEntry,
@@ -20170,6 +20189,7 @@ function generateDrawStructuresAndLinks(params) {
20170
20189
  isMock,
20171
20190
  uuids
20172
20191
  } = params || {};
20192
+ const drawTypeCoercion = params.drawTypeCoercion ?? appliedPolicies?.[POLICY_TYPE_DRAWS]?.drawTypeCoercion ?? true;
20173
20193
  const stack = "generateDrawStructuresAndLinks";
20174
20194
  let drawType = drawTypeCoercion && params.drawSize === 2 && DrawTypeEnum.SingleElimination || params.drawType || DrawTypeEnum.SingleElimination;
20175
20195
  const structures = [], links = [];
@@ -22652,7 +22672,6 @@ function generateDrawDefinition(params) {
22652
22672
  const {
22653
22673
  considerEventEntries = true,
22654
22674
  // in the absence of drawSize and drawEntries, look to event.entries
22655
- drawTypeCoercion = true,
22656
22675
  ignoreAllowedDrawTypes,
22657
22676
  voluntaryConsolation,
22658
22677
  hydrateCollections,
@@ -22666,15 +22685,16 @@ function generateDrawDefinition(params) {
22666
22685
  placeByes,
22667
22686
  event
22668
22687
  } = params;
22688
+ const appliedPolicies = getAppliedPolicies({
22689
+ tournamentRecord,
22690
+ event
22691
+ }).appliedPolicies ?? {};
22692
+ const drawTypeCoercion = params.drawTypeCoercion ?? appliedPolicies?.[POLICY_TYPE_DRAWS]?.drawTypeCoercion ?? true;
22669
22693
  const drawType = drawTypeCoercion && params.drawSize === 2 && DrawTypeEnum.SingleElimination || params.drawType || DrawTypeEnum.SingleElimination;
22670
22694
  const { tournamentParticipants: participants } = getTournamentParticipants({
22671
22695
  tournamentRecord,
22672
22696
  inContext: true
22673
22697
  });
22674
- const appliedPolicies = getAppliedPolicies({
22675
- tournamentRecord,
22676
- event
22677
- }).appliedPolicies ?? {};
22678
22698
  const enforceGender = params.enforceGender ?? policyDefinitions?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender ?? appliedPolicies?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender;
22679
22699
  const allowedDrawTypes = !ignoreAllowedDrawTypes && tournamentRecord && getAllowedDrawTypes({
22680
22700
  tournamentRecord,