tods-competition-factory 0.63.0 → 0.63.1

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.
@@ -1169,9 +1169,10 @@ const globalState = {
1169
1169
  },
1170
1170
  deepCopy: true,
1171
1171
  deepCopyAttributes: {
1172
+ threshold: undefined,
1173
+ stringify: [],
1172
1174
  ignore: [],
1173
- toJSON: [],
1174
- stringify: []
1175
+ toJSON: []
1175
1176
  }
1176
1177
  };
1177
1178
  let _globalStateProvider = syncGlobalState$1;
@@ -1222,7 +1223,7 @@ function getDevContext(contextCriteria) {
1222
1223
  return globalState.devContext || false;
1223
1224
  } else {
1224
1225
  if (typeof globalState.devContext !== 'object') return false;
1225
- return Object.keys(contextCriteria).every(key => globalState.devContext[key] === contextCriteria[key]);
1226
+ return Object.keys(contextCriteria).every(key => globalState.devContext[key] === contextCriteria[key]) && globalState.devContext;
1226
1227
  }
1227
1228
  }
1228
1229
  function setDevContext(value) {
@@ -1707,13 +1708,23 @@ const dateTime = {
1707
1708
  * @returns
1708
1709
  */
1709
1710
 
1710
- function makeDeepCopy(sourceObject, convertExtensions, internalUse, removeExtensions) {
1711
+ function makeDeepCopy(sourceObject, convertExtensions, internalUse, removeExtensions, iteration = 0) {
1711
1712
  const deepCopy = deepCopyEnabled();
1712
1713
 
1713
- if (!(deepCopy !== null && deepCopy !== void 0 && deepCopy.enabled) && !internalUse || typeof sourceObject !== 'object' || typeof sourceObject === 'function' || sourceObject === null) {
1714
+ if (!(deepCopy !== null && deepCopy !== void 0 && deepCopy.enabled) && !internalUse || typeof sourceObject !== 'object' || typeof sourceObject === 'function' || sourceObject === null || typeof (deepCopy === null || deepCopy === void 0 ? void 0 : deepCopy.threshold) === 'number' && iteration >= deepCopy.threshold) {
1714
1715
  return sourceObject;
1715
1716
  }
1716
1717
 
1718
+ const devContext = getDevContext({
1719
+ makeDeepCopy: true
1720
+ });
1721
+
1722
+ if (devContext) {
1723
+ if (iteration > (devContext.iterations || 15)) console.log(iteration, sourceObject, {
1724
+ devContext
1725
+ });
1726
+ }
1727
+
1717
1728
  const targetObject = Array.isArray(sourceObject) ? [] : {};
1718
1729
  const sourceObjectKeys = Object.keys(sourceObject).filter(key => !internalUse || !(deepCopy !== null && deepCopy !== void 0 && deepCopy.ignore.includes(key)));
1719
1730
 
@@ -1734,7 +1745,7 @@ function makeDeepCopy(sourceObject, convertExtensions, internalUse, removeExtens
1734
1745
  } else if (isDateObject(value)) {
1735
1746
  targetObject[key] = new Date(value).toISOString();
1736
1747
  } else {
1737
- targetObject[key] = makeDeepCopy(value, convertExtensions, internalUse, removeExtensions);
1748
+ targetObject[key] = makeDeepCopy(value, convertExtensions, internalUse, removeExtensions, iteration + 1);
1738
1749
  }
1739
1750
  }
1740
1751
 
@@ -21670,6 +21681,7 @@ function addVenue({
21670
21681
 
21671
21682
  function addParticipant$1({
21672
21683
  allowDuplicateParticipantIdPairs,
21684
+ returnParticipant,
21673
21685
  tournamentRecord,
21674
21686
  disableNotice,
21675
21687
  pairOverride,
@@ -21741,7 +21753,7 @@ function addParticipant$1({
21741
21753
  if (!allowDuplicateParticipantIdPairs) {
21742
21754
  return { ...SUCCESS,
21743
21755
  existingParticipant: true,
21744
- participant: makeDeepCopy(existingPairParticipant.participant)
21756
+ participant: returnParticipant && makeDeepCopy(existingPairParticipant.participant)
21745
21757
  };
21746
21758
  }
21747
21759
  }
@@ -21805,13 +21817,15 @@ function addParticipant$1({
21805
21817
  });
21806
21818
  }
21807
21819
 
21808
- const result = { ...SUCCESS,
21809
- participant: makeDeepCopy(participant)
21820
+ const result = {
21821
+ participant: returnParticipant && makeDeepCopy(participant),
21822
+ ...SUCCESS
21810
21823
  };
21811
21824
  return result;
21812
21825
  }
21813
21826
  function addParticipants({
21814
21827
  allowDuplicateParticipantIdPairs,
21828
+ returnParticipants,
21815
21829
  participants = [],
21816
21830
  tournamentRecord
21817
21831
  }) {
@@ -21836,6 +21850,7 @@ function addParticipants({
21836
21850
  for (const participant of participantsToAdd) {
21837
21851
  const result = addParticipant$1({
21838
21852
  allowDuplicateParticipantIdPairs,
21853
+ returnParticipant: true,
21839
21854
  disableNotice: true,
21840
21855
  tournamentRecord,
21841
21856
  participant
@@ -21854,7 +21869,7 @@ function addParticipants({
21854
21869
  }
21855
21870
 
21856
21871
  const result = {
21857
- participants: makeDeepCopy(addedParticipants),
21872
+ participants: returnParticipants && makeDeepCopy(addedParticipants),
21858
21873
  addedCount: addedParticipants.length,
21859
21874
  ...SUCCESS
21860
21875
  };
@@ -21878,6 +21893,7 @@ function addParticipants({
21878
21893
 
21879
21894
  function addParticipant({
21880
21895
  tournamentRecords,
21896
+ returnParticipant,
21881
21897
  pairOverride,
21882
21898
  tournamentId,
21883
21899
  participant
@@ -21890,9 +21906,10 @@ function addParticipant({
21890
21906
  error: MISSING_TOURNAMENT_RECORD
21891
21907
  };
21892
21908
  return addParticipant$1({
21909
+ returnParticipant,
21893
21910
  tournamentRecord,
21894
- participant,
21895
- pairOverride
21911
+ pairOverride,
21912
+ participant
21896
21913
  });
21897
21914
  }
21898
21915
 
@@ -28025,7 +28042,7 @@ const scheduleGovernor$1 = {
28025
28042
  };
28026
28043
 
28027
28044
  function factoryVersion() {
28028
- return '0.63.0';
28045
+ return '0.63.1';
28029
28046
  }
28030
28047
 
28031
28048
  function attachPolicies$2({
@@ -42047,14 +42064,14 @@ function promoteWithinElement({
42047
42064
  */
42048
42065
 
42049
42066
  function addEventEntryPairs({
42050
- event,
42051
- uuids,
42052
- drawDefinition,
42053
- tournamentRecord,
42054
- entryStage = MAIN,
42067
+ allowDuplicateParticipantIdPairs,
42055
42068
  entryStatus = ALTERNATE,
42056
42069
  participantIdPairs = [],
42057
- allowDuplicateParticipantIdPairs
42070
+ entryStage = MAIN,
42071
+ tournamentRecord,
42072
+ drawDefinition,
42073
+ event,
42074
+ uuids
42058
42075
  }) {
42059
42076
  if (!tournamentRecord) return {
42060
42077
  error: MISSING_TOURNAMENT_RECORD
@@ -42097,9 +42114,10 @@ function addEventEntryPairs({
42097
42114
 
42098
42115
  if (newParticipants) {
42099
42116
  const result = addParticipants({
42100
- tournamentRecord,
42117
+ allowDuplicateParticipantIdPairs,
42101
42118
  participants: newParticipants,
42102
- allowDuplicateParticipantIdPairs
42119
+ returnParticipants: true,
42120
+ tournamentRecord
42103
42121
  });
42104
42122
  if (result.error) return result;
42105
42123
  addedParticipants = result.participants || [];
@@ -43330,8 +43348,9 @@ function replaceTieMatchUpParticipantId(params) {
43330
43348
  participantRole: COMPETITOR
43331
43349
  };
43332
43350
  const result = addParticipant$1({
43333
- tournamentRecord,
43351
+ returnParticipant: true,
43334
43352
  pairOverride: true,
43353
+ tournamentRecord,
43335
43354
  participant
43336
43355
  });
43337
43356
  if (result.error) return result;
@@ -50423,8 +50442,8 @@ function generateEventParticipants({
50423
50442
  uuids
50424
50443
  });
50425
50444
  let result = addParticipants({
50426
- tournamentRecord,
50427
- participants: uniqueFlightParticipants
50445
+ participants: uniqueFlightParticipants,
50446
+ tournamentRecord
50428
50447
  });
50429
50448
  if (result.error) return result;
50430
50449
  const uniqueDrawParticipants = uniqueFlightParticipants.filter(({
@@ -51279,8 +51298,8 @@ function generateEventWithDraw({
51279
51298
  };
51280
51299
  });
51281
51300
  const result = addParticipants({
51282
- tournamentRecord,
51283
- participants: teamParticipants
51301
+ participants: teamParticipants,
51302
+ tournamentRecord
51284
51303
  });
51285
51304
  if (!result.success) return result;
51286
51305
  targetParticipants = teamParticipants;
@@ -51927,11 +51946,17 @@ const mocksGovernor = {
51927
51946
  credits
51928
51947
  };
51929
51948
 
51949
+ let devContextSet = false;
51930
51950
  const mocksEngine = function () {
51931
51951
  const engine = {
51932
51952
  version: () => factoryVersion(),
51953
+ setDeepCopy: (deepCopyOption, deepCopyAttributes) => {
51954
+ setDeepCopy(deepCopyOption, deepCopyAttributes);
51955
+ return engine;
51956
+ },
51933
51957
  devContext: isDev => {
51934
51958
  setDevContext(isDev);
51959
+ devContextSet = true;
51935
51960
  return engine;
51936
51961
  }
51937
51962
  };
@@ -51942,7 +51967,13 @@ const mocksEngine = function () {
51942
51967
  const result = method({ ...params
51943
51968
  });
51944
51969
  if (!(result !== null && result !== void 0 && result.error)) notifySubscribers();
51945
- deleteNotices();
51970
+ deleteNotices(); // cleanup if set on invocation
51971
+
51972
+ if (devContextSet) {
51973
+ setDevContext(false);
51974
+ devContextSet = false;
51975
+ }
51976
+
51946
51977
  return result;
51947
51978
  }
51948
51979