tods-competition-factory 1.7.13 → 1.7.14

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.
@@ -1708,8 +1708,9 @@ function decorateResult({
1708
1708
  if (result && Array.isArray(result?.stack) && typeof stack === "string") {
1709
1709
  result.stack.push(stack);
1710
1710
  }
1711
- if (info && result?.error)
1712
- result.error.info = info;
1711
+ if (result && info) {
1712
+ result.info = info;
1713
+ }
1713
1714
  if (result && typeof context === "object" && Object.keys(context).length) {
1714
1715
  Object.assign(result, definedAttributes(context));
1715
1716
  }
@@ -14791,13 +14792,14 @@ function generateTieMatchUps({
14791
14792
  isMock,
14792
14793
  uuids
14793
14794
  }) {
14794
- const { collectionDefinitions } = tieFormat || {};
14795
- const tieMatchUps = (collectionDefinitions || []).map(
14795
+ const { collectionDefinitions } = tieFormat ?? {};
14796
+ const tieMatchUps = (collectionDefinitions ?? []).map(
14796
14797
  (collectionDefinition) => generateCollectionMatchUps({ collectionDefinition, uuids, isMock })
14797
14798
  ).filter(Boolean).flat();
14798
14799
  return { tieMatchUps };
14799
14800
  }
14800
14801
  function generateCollectionMatchUps({
14802
+ collectionPositionOffset = 0,
14801
14803
  collectionDefinition,
14802
14804
  matchUpsLimit,
14803
14805
  // internal use allows generation of missing matchUps on "reset"
@@ -14805,9 +14807,9 @@ function generateCollectionMatchUps({
14805
14807
  uuids
14806
14808
  }) {
14807
14809
  const { matchUpCount, matchUpType, collectionId, processCodes } = collectionDefinition || {};
14808
- const numberToGenerate = matchUpsLimit || matchUpCount || 0;
14810
+ const numberToGenerate = matchUpsLimit ?? matchUpCount ?? 0;
14809
14811
  return generateRange(0, numberToGenerate).map((index) => {
14810
- const collectionPosition = index + 1;
14812
+ const collectionPosition = collectionPositionOffset + index + 1;
14811
14813
  return {
14812
14814
  sides: [{ sideNumber: 1 }, { sideNumber: 2 }],
14813
14815
  matchUpId: uuids?.pop() || UUID(),
@@ -16358,7 +16360,7 @@ function validateTieFormat(params) {
16358
16360
  const tieFormat = params?.tieFormat;
16359
16361
  const stack = "validateTieFormat";
16360
16362
  const errors = [];
16361
- if (typeof tieFormat !== "object") {
16363
+ if (!params || !tieFormat || typeof tieFormat !== "object") {
16362
16364
  errors.push("tieFormat must be an object");
16363
16365
  return decorateResult({
16364
16366
  result: {
@@ -16496,7 +16498,7 @@ function validateCollectionDefinition({
16496
16498
  errors.push(`collectionValue is not type number: ${collectionValue}`);
16497
16499
  }
16498
16500
  if (collectionValueProfiles) {
16499
- const result = validateCollectionValueProfile({
16501
+ const result = validateCollectionValueProfiles({
16500
16502
  collectionValueProfiles,
16501
16503
  matchUpCount
16502
16504
  });
@@ -16527,7 +16529,7 @@ function checkTieFormat(tieFormat) {
16527
16529
  }
16528
16530
  return { tieFormat };
16529
16531
  }
16530
- function validateCollectionValueProfile({
16532
+ function validateCollectionValueProfiles({
16531
16533
  collectionValueProfiles,
16532
16534
  matchUpCount
16533
16535
  }) {