tods-competition-factory 1.8.26 → 1.8.27

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
@@ -1427,6 +1427,13 @@ function getDevContext(contextCriteria) {
1427
1427
  ) && globalState.devContext;
1428
1428
  }
1429
1429
  }
1430
+ function setGlobalLog(loggingFx) {
1431
+ if (typeof loggingFx === "function") {
1432
+ globalState.globalLog = loggingFx;
1433
+ } else {
1434
+ delete globalState.globalLog;
1435
+ }
1436
+ }
1430
1437
  function setDevContext(value) {
1431
1438
  globalState.devContext = value;
1432
1439
  }
@@ -1529,6 +1536,13 @@ function handleCaughtError({
1529
1536
  err
1530
1537
  });
1531
1538
  }
1539
+ function globalLog$1(engine, log) {
1540
+ if (globalState.globalLog) {
1541
+ return globalState.globalLog(engine, log);
1542
+ } else {
1543
+ console.log(engine, log);
1544
+ }
1545
+ }
1532
1546
 
1533
1547
  const validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
1534
1548
  const validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
@@ -2390,7 +2404,7 @@ const matchUpFormatCode = {
2390
2404
  };
2391
2405
 
2392
2406
  function factoryVersion() {
2393
- return "1.8.26";
2407
+ return "1.8.27";
2394
2408
  }
2395
2409
 
2396
2410
  function getObjectTieFormat(obj) {
@@ -2453,6 +2467,179 @@ function resolveTieFormat({
2453
2467
  };
2454
2468
  }
2455
2469
 
2470
+ var DrawTypeEnum = /* @__PURE__ */ ((DrawTypeEnum2) => {
2471
+ DrawTypeEnum2["AdHoc"] = "AD_HOC";
2472
+ DrawTypeEnum2["Compass"] = "COMPASS";
2473
+ DrawTypeEnum2["CurtisConsolation"] = "CURTIS_CONSOLATION";
2474
+ DrawTypeEnum2["DoubleElimination"] = "DOUBLE_ELIMINATION";
2475
+ DrawTypeEnum2["FeedIn"] = "FEED_IN";
2476
+ DrawTypeEnum2["FeedInChampionship"] = "FEED_IN_CHAMPIONSHIP";
2477
+ DrawTypeEnum2["FeedInChampionshipToQf"] = "FEED_IN_CHAMPIONSHIP_TO_QF";
2478
+ DrawTypeEnum2["FeedInChampionshipToR16"] = "FEED_IN_CHAMPIONSHIP_TO_R16";
2479
+ DrawTypeEnum2["FeedInChampionshipToSf"] = "FEED_IN_CHAMPIONSHIP_TO_SF";
2480
+ DrawTypeEnum2["FirstMatchLoserConsolation"] = "FIRST_MATCH_LOSER_CONSOLATION";
2481
+ DrawTypeEnum2["FirstRoundLoserConsolation"] = "FIRST_ROUND_LOSER_CONSOLATION";
2482
+ DrawTypeEnum2["ModifiedFeedInChampionship"] = "MODIFIED_FEED_IN_CHAMPIONSHIP";
2483
+ DrawTypeEnum2["Lucky"] = "LUCKY_DRAW";
2484
+ DrawTypeEnum2["Olympic"] = "OLYMPIC";
2485
+ DrawTypeEnum2["Other"] = "OTHER";
2486
+ DrawTypeEnum2["Playoff"] = "PLAYOFF";
2487
+ DrawTypeEnum2["RoundRobin"] = "ROUND_ROBIN";
2488
+ DrawTypeEnum2["RoundRobinWithPlayoff"] = "ROUND_ROBIN_WITH_PLAYOFF";
2489
+ DrawTypeEnum2["SingleElimination"] = "SINGLE_ELIMINATION";
2490
+ return DrawTypeEnum2;
2491
+ })(DrawTypeEnum || {});
2492
+ var StageTypeEnum = /* @__PURE__ */ ((StageTypeEnum2) => {
2493
+ StageTypeEnum2["Consolation"] = "CONSOLATION";
2494
+ StageTypeEnum2["Main"] = "MAIN";
2495
+ StageTypeEnum2["PlayOff"] = "PLAY_OFF";
2496
+ StageTypeEnum2["Qualifying"] = "QUALIFYING";
2497
+ StageTypeEnum2["VoluntaryConsolation"] = "VOLUNTARY_CONSOLATION";
2498
+ return StageTypeEnum2;
2499
+ })(StageTypeEnum || {});
2500
+ var EntryStatusEnum = /* @__PURE__ */ ((EntryStatusEnum2) => {
2501
+ EntryStatusEnum2["Alternate"] = "ALTERNATE";
2502
+ EntryStatusEnum2["Confirmed"] = "CONFIRMED";
2503
+ EntryStatusEnum2["DirectAcceptance"] = "DIRECT_ACCEPTANCE";
2504
+ EntryStatusEnum2["FeedIn"] = "FEED_IN";
2505
+ EntryStatusEnum2["JuniorExempt"] = "JUNIOR_EXEMPT";
2506
+ EntryStatusEnum2["LuckyLoser"] = "LUCKY_LOSER";
2507
+ EntryStatusEnum2["OrganiserAcceptance"] = "ORGANISER_ACCEPTANCE";
2508
+ EntryStatusEnum2["Qualifier"] = "QUALIFIER";
2509
+ EntryStatusEnum2["SpecialExempt"] = "SPECIAL_EXEMPT";
2510
+ EntryStatusEnum2["Registered"] = "Registered";
2511
+ EntryStatusEnum2["Ungrouped"] = "UNGROUPED";
2512
+ EntryStatusEnum2["Unpaired"] = "UNPAIRED";
2513
+ EntryStatusEnum2["Wildcard"] = "WILDCARD";
2514
+ EntryStatusEnum2["Withdrawn"] = "WITHDRAWN";
2515
+ return EntryStatusEnum2;
2516
+ })(EntryStatusEnum || {});
2517
+ var LinkTypeEnum = /* @__PURE__ */ ((LinkTypeEnum2) => {
2518
+ LinkTypeEnum2["Loser"] = "LOSER";
2519
+ LinkTypeEnum2["Position"] = "POSITION";
2520
+ LinkTypeEnum2["Winner"] = "WINNER";
2521
+ return LinkTypeEnum2;
2522
+ })(LinkTypeEnum || {});
2523
+ var PositioningProfileEnum = /* @__PURE__ */ ((PositioningProfileEnum2) => {
2524
+ PositioningProfileEnum2["BottomUp"] = "BOTTOM_UP";
2525
+ PositioningProfileEnum2["Draw"] = "DRAW";
2526
+ PositioningProfileEnum2["LossPosition"] = "LOSS_POSITION";
2527
+ PositioningProfileEnum2["Random"] = "RANDOM";
2528
+ PositioningProfileEnum2["TopDown"] = "TOP_DOWN";
2529
+ PositioningProfileEnum2["Waterfall"] = "WATERFALL";
2530
+ return PositioningProfileEnum2;
2531
+ })(PositioningProfileEnum || {});
2532
+ var TypeEnum = /* @__PURE__ */ ((TypeEnum2) => {
2533
+ TypeEnum2["Doubles"] = "DOUBLES";
2534
+ TypeEnum2["Singles"] = "SINGLES";
2535
+ TypeEnum2["Team"] = "TEAM";
2536
+ return TypeEnum2;
2537
+ })(TypeEnum || {});
2538
+ var MatchUpStatusEnum = /* @__PURE__ */ ((MatchUpStatusEnum2) => {
2539
+ MatchUpStatusEnum2["Abandoned"] = "ABANDONED";
2540
+ MatchUpStatusEnum2["AwaitingResult"] = "AWAITING_RESULT";
2541
+ MatchUpStatusEnum2["Bye"] = "BYE";
2542
+ MatchUpStatusEnum2["Cancelled"] = "CANCELLED";
2543
+ MatchUpStatusEnum2["Completed"] = "COMPLETED";
2544
+ MatchUpStatusEnum2["DeadRubber"] = "DEAD_RUBBER";
2545
+ MatchUpStatusEnum2["Defaulted"] = "DEFAULTED";
2546
+ MatchUpStatusEnum2["DoubleDefault"] = "DOUBLE_DEFAULT";
2547
+ MatchUpStatusEnum2["DoubleWalkover"] = "DOUBLE_WALKOVER";
2548
+ MatchUpStatusEnum2["InProgress"] = "IN_PROGRESS";
2549
+ MatchUpStatusEnum2["Incomplete"] = "INCOMPLETE";
2550
+ MatchUpStatusEnum2["NotPlayed"] = "NOT_PLAYED";
2551
+ MatchUpStatusEnum2["Retired"] = "RETIRED";
2552
+ MatchUpStatusEnum2["Suspended"] = "SUSPENDED";
2553
+ MatchUpStatusEnum2["ToBePlayed"] = "TO_BE_PLAYED";
2554
+ MatchUpStatusEnum2["Walkover"] = "WALKOVER";
2555
+ return MatchUpStatusEnum2;
2556
+ })(MatchUpStatusEnum || {});
2557
+ var GenderEnum = /* @__PURE__ */ ((GenderEnum2) => {
2558
+ GenderEnum2["Any"] = "ANY";
2559
+ GenderEnum2["Female"] = "FEMALE";
2560
+ GenderEnum2["Male"] = "MALE";
2561
+ GenderEnum2["Mixed"] = "MIXED";
2562
+ return GenderEnum2;
2563
+ })(GenderEnum || {});
2564
+ var ParticipantRoleEnum = /* @__PURE__ */ ((ParticipantRoleEnum2) => {
2565
+ ParticipantRoleEnum2["Administration"] = "ADMINISTRATION";
2566
+ ParticipantRoleEnum2["Captain"] = "CAPTAIN";
2567
+ ParticipantRoleEnum2["Coach"] = "COACH";
2568
+ ParticipantRoleEnum2["Competitor"] = "COMPETITOR";
2569
+ ParticipantRoleEnum2["Media"] = "MEDIA";
2570
+ ParticipantRoleEnum2["Medical"] = "MEDICAL";
2571
+ ParticipantRoleEnum2["Official"] = "OFFICIAL";
2572
+ ParticipantRoleEnum2["Other"] = "OTHER";
2573
+ ParticipantRoleEnum2["Security"] = "SECURITY";
2574
+ return ParticipantRoleEnum2;
2575
+ })(ParticipantRoleEnum || {});
2576
+ var ParticipantTypeEnum = /* @__PURE__ */ ((ParticipantTypeEnum2) => {
2577
+ ParticipantTypeEnum2["Group"] = "GROUP";
2578
+ ParticipantTypeEnum2["Individual"] = "INDIVIDUAL";
2579
+ ParticipantTypeEnum2["Pair"] = "PAIR";
2580
+ ParticipantTypeEnum2["Team"] = "TEAM";
2581
+ return ParticipantTypeEnum2;
2582
+ })(ParticipantTypeEnum || {});
2583
+
2584
+ function decorateResult({
2585
+ context,
2586
+ result,
2587
+ stack,
2588
+ info
2589
+ }) {
2590
+ if (result && !Array.isArray(result?.stack))
2591
+ result.stack = [];
2592
+ if (result && Array.isArray(result?.stack) && typeof stack === "string") {
2593
+ result.stack.push(stack);
2594
+ }
2595
+ if (result && info) {
2596
+ result.info = info;
2597
+ }
2598
+ if (result && typeof context === "object" && Object.keys(context).length) {
2599
+ Object.assign(result, definedAttributes(context));
2600
+ }
2601
+ if (result && !result?.error && !result?.success) {
2602
+ Object.assign(result, { ...SUCCESS });
2603
+ }
2604
+ return result ?? { success: true };
2605
+ }
2606
+
2607
+ const ANY = "ANY";
2608
+ const MALE = "MALE";
2609
+ const MIXED = "MIXED";
2610
+ const OTHER$3 = "OTHER";
2611
+ const FEMALE = "FEMALE";
2612
+ const genderConstants = {
2613
+ ANY,
2614
+ MALE,
2615
+ FEMALE,
2616
+ MIXED,
2617
+ OTHER: OTHER$3
2618
+ };
2619
+
2620
+ function genderValidityCheck({
2621
+ referenceGender,
2622
+ matchUpType,
2623
+ gender
2624
+ }) {
2625
+ const stack = "genderValidityCheck";
2626
+ if (referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) && [GenderEnum.Male, GenderEnum.Female].includes(gender)) {
2627
+ const valid = gender === referenceGender;
2628
+ return valid ? { valid: true } : decorateResult({
2629
+ result: { valid: false, error: INVALID_GENDER },
2630
+ context: { gender },
2631
+ stack
2632
+ });
2633
+ }
2634
+ if (matchUpType === TypeEnum.Singles && referenceGender === MIXED)
2635
+ return decorateResult({
2636
+ info: "matchUpType SINGLES is invalid for gender MIXED",
2637
+ result: { error: INVALID_GENDER, valid: false },
2638
+ stack
2639
+ });
2640
+ return { valid: true };
2641
+ }
2642
+
2456
2643
  const typeMatch = (arr, type) => arr.filter(Boolean).every((i) => typeof i === type);
2457
2644
  const allNumeric = (arr) => arr.filter(Boolean).every(isNumeric);
2458
2645
  function getCategoryAgeDetails(params) {
@@ -2624,29 +2811,6 @@ function getCategoryAgeDetails(params) {
2624
2811
  return result;
2625
2812
  }
2626
2813
 
2627
- function decorateResult({
2628
- context,
2629
- result,
2630
- stack,
2631
- info
2632
- }) {
2633
- if (result && !Array.isArray(result?.stack))
2634
- result.stack = [];
2635
- if (result && Array.isArray(result?.stack) && typeof stack === "string") {
2636
- result.stack.push(stack);
2637
- }
2638
- if (result && info) {
2639
- result.info = info;
2640
- }
2641
- if (result && typeof context === "object" && Object.keys(context).length) {
2642
- Object.assign(result, definedAttributes(context));
2643
- }
2644
- if (result && !result?.error && !result?.success) {
2645
- Object.assign(result, { ...SUCCESS });
2646
- }
2647
- return result ?? { success: true };
2648
- }
2649
-
2650
2814
  function validateCategory({ category }) {
2651
2815
  if (!isObject(category))
2652
2816
  return { error: INVALID_VALUES };
@@ -2707,120 +2871,6 @@ function mustBeAnArray(value) {
2707
2871
  return `${value} must be an array`;
2708
2872
  }
2709
2873
 
2710
- var DrawTypeEnum = /* @__PURE__ */ ((DrawTypeEnum2) => {
2711
- DrawTypeEnum2["AdHoc"] = "AD_HOC";
2712
- DrawTypeEnum2["Compass"] = "COMPASS";
2713
- DrawTypeEnum2["CurtisConsolation"] = "CURTIS_CONSOLATION";
2714
- DrawTypeEnum2["DoubleElimination"] = "DOUBLE_ELIMINATION";
2715
- DrawTypeEnum2["FeedIn"] = "FEED_IN";
2716
- DrawTypeEnum2["FeedInChampionship"] = "FEED_IN_CHAMPIONSHIP";
2717
- DrawTypeEnum2["FeedInChampionshipToQf"] = "FEED_IN_CHAMPIONSHIP_TO_QF";
2718
- DrawTypeEnum2["FeedInChampionshipToR16"] = "FEED_IN_CHAMPIONSHIP_TO_R16";
2719
- DrawTypeEnum2["FeedInChampionshipToSf"] = "FEED_IN_CHAMPIONSHIP_TO_SF";
2720
- DrawTypeEnum2["FirstMatchLoserConsolation"] = "FIRST_MATCH_LOSER_CONSOLATION";
2721
- DrawTypeEnum2["FirstRoundLoserConsolation"] = "FIRST_ROUND_LOSER_CONSOLATION";
2722
- DrawTypeEnum2["ModifiedFeedInChampionship"] = "MODIFIED_FEED_IN_CHAMPIONSHIP";
2723
- DrawTypeEnum2["Lucky"] = "LUCKY_DRAW";
2724
- DrawTypeEnum2["Olympic"] = "OLYMPIC";
2725
- DrawTypeEnum2["Other"] = "OTHER";
2726
- DrawTypeEnum2["Playoff"] = "PLAYOFF";
2727
- DrawTypeEnum2["RoundRobin"] = "ROUND_ROBIN";
2728
- DrawTypeEnum2["RoundRobinWithPlayoff"] = "ROUND_ROBIN_WITH_PLAYOFF";
2729
- DrawTypeEnum2["SingleElimination"] = "SINGLE_ELIMINATION";
2730
- return DrawTypeEnum2;
2731
- })(DrawTypeEnum || {});
2732
- var StageTypeEnum = /* @__PURE__ */ ((StageTypeEnum2) => {
2733
- StageTypeEnum2["Consolation"] = "CONSOLATION";
2734
- StageTypeEnum2["Main"] = "MAIN";
2735
- StageTypeEnum2["PlayOff"] = "PLAY_OFF";
2736
- StageTypeEnum2["Qualifying"] = "QUALIFYING";
2737
- StageTypeEnum2["VoluntaryConsolation"] = "VOLUNTARY_CONSOLATION";
2738
- return StageTypeEnum2;
2739
- })(StageTypeEnum || {});
2740
- var EntryStatusEnum = /* @__PURE__ */ ((EntryStatusEnum2) => {
2741
- EntryStatusEnum2["Alternate"] = "ALTERNATE";
2742
- EntryStatusEnum2["Confirmed"] = "CONFIRMED";
2743
- EntryStatusEnum2["DirectAcceptance"] = "DIRECT_ACCEPTANCE";
2744
- EntryStatusEnum2["FeedIn"] = "FEED_IN";
2745
- EntryStatusEnum2["JuniorExempt"] = "JUNIOR_EXEMPT";
2746
- EntryStatusEnum2["LuckyLoser"] = "LUCKY_LOSER";
2747
- EntryStatusEnum2["OrganiserAcceptance"] = "ORGANISER_ACCEPTANCE";
2748
- EntryStatusEnum2["Qualifier"] = "QUALIFIER";
2749
- EntryStatusEnum2["SpecialExempt"] = "SPECIAL_EXEMPT";
2750
- EntryStatusEnum2["Registered"] = "Registered";
2751
- EntryStatusEnum2["Ungrouped"] = "UNGROUPED";
2752
- EntryStatusEnum2["Unpaired"] = "UNPAIRED";
2753
- EntryStatusEnum2["Wildcard"] = "WILDCARD";
2754
- EntryStatusEnum2["Withdrawn"] = "WITHDRAWN";
2755
- return EntryStatusEnum2;
2756
- })(EntryStatusEnum || {});
2757
- var LinkTypeEnum = /* @__PURE__ */ ((LinkTypeEnum2) => {
2758
- LinkTypeEnum2["Loser"] = "LOSER";
2759
- LinkTypeEnum2["Position"] = "POSITION";
2760
- LinkTypeEnum2["Winner"] = "WINNER";
2761
- return LinkTypeEnum2;
2762
- })(LinkTypeEnum || {});
2763
- var PositioningProfileEnum = /* @__PURE__ */ ((PositioningProfileEnum2) => {
2764
- PositioningProfileEnum2["BottomUp"] = "BOTTOM_UP";
2765
- PositioningProfileEnum2["Draw"] = "DRAW";
2766
- PositioningProfileEnum2["LossPosition"] = "LOSS_POSITION";
2767
- PositioningProfileEnum2["Random"] = "RANDOM";
2768
- PositioningProfileEnum2["TopDown"] = "TOP_DOWN";
2769
- PositioningProfileEnum2["Waterfall"] = "WATERFALL";
2770
- return PositioningProfileEnum2;
2771
- })(PositioningProfileEnum || {});
2772
- var TypeEnum = /* @__PURE__ */ ((TypeEnum2) => {
2773
- TypeEnum2["Doubles"] = "DOUBLES";
2774
- TypeEnum2["Singles"] = "SINGLES";
2775
- TypeEnum2["Team"] = "TEAM";
2776
- return TypeEnum2;
2777
- })(TypeEnum || {});
2778
- var MatchUpStatusEnum = /* @__PURE__ */ ((MatchUpStatusEnum2) => {
2779
- MatchUpStatusEnum2["Abandoned"] = "ABANDONED";
2780
- MatchUpStatusEnum2["AwaitingResult"] = "AWAITING_RESULT";
2781
- MatchUpStatusEnum2["Bye"] = "BYE";
2782
- MatchUpStatusEnum2["Cancelled"] = "CANCELLED";
2783
- MatchUpStatusEnum2["Completed"] = "COMPLETED";
2784
- MatchUpStatusEnum2["DeadRubber"] = "DEAD_RUBBER";
2785
- MatchUpStatusEnum2["Defaulted"] = "DEFAULTED";
2786
- MatchUpStatusEnum2["DoubleDefault"] = "DOUBLE_DEFAULT";
2787
- MatchUpStatusEnum2["DoubleWalkover"] = "DOUBLE_WALKOVER";
2788
- MatchUpStatusEnum2["InProgress"] = "IN_PROGRESS";
2789
- MatchUpStatusEnum2["Incomplete"] = "INCOMPLETE";
2790
- MatchUpStatusEnum2["NotPlayed"] = "NOT_PLAYED";
2791
- MatchUpStatusEnum2["Retired"] = "RETIRED";
2792
- MatchUpStatusEnum2["Suspended"] = "SUSPENDED";
2793
- MatchUpStatusEnum2["ToBePlayed"] = "TO_BE_PLAYED";
2794
- MatchUpStatusEnum2["Walkover"] = "WALKOVER";
2795
- return MatchUpStatusEnum2;
2796
- })(MatchUpStatusEnum || {});
2797
- var GenderEnum = /* @__PURE__ */ ((GenderEnum2) => {
2798
- GenderEnum2["Any"] = "ANY";
2799
- GenderEnum2["Female"] = "FEMALE";
2800
- GenderEnum2["Male"] = "MALE";
2801
- GenderEnum2["Mixed"] = "MIXED";
2802
- return GenderEnum2;
2803
- })(GenderEnum || {});
2804
- var ParticipantRoleEnum = /* @__PURE__ */ ((ParticipantRoleEnum2) => {
2805
- ParticipantRoleEnum2["Administration"] = "ADMINISTRATION";
2806
- ParticipantRoleEnum2["Captain"] = "CAPTAIN";
2807
- ParticipantRoleEnum2["Coach"] = "COACH";
2808
- ParticipantRoleEnum2["Competitor"] = "COMPETITOR";
2809
- ParticipantRoleEnum2["Media"] = "MEDIA";
2810
- ParticipantRoleEnum2["Medical"] = "MEDICAL";
2811
- ParticipantRoleEnum2["Official"] = "OFFICIAL";
2812
- ParticipantRoleEnum2["Other"] = "OTHER";
2813
- ParticipantRoleEnum2["Security"] = "SECURITY";
2814
- return ParticipantRoleEnum2;
2815
- })(ParticipantRoleEnum || {});
2816
- var ParticipantTypeEnum = /* @__PURE__ */ ((ParticipantTypeEnum2) => {
2817
- ParticipantTypeEnum2["Group"] = "GROUP";
2818
- ParticipantTypeEnum2["Individual"] = "INDIVIDUAL";
2819
- ParticipantTypeEnum2["Pair"] = "PAIR";
2820
- ParticipantTypeEnum2["Team"] = "TEAM";
2821
- return ParticipantTypeEnum2;
2822
- })(ParticipantTypeEnum || {});
2823
-
2824
2874
  function validateTieFormat(params) {
2825
2875
  const checkCategory = !!(params?.enforceCategory !== false && params?.category);
2826
2876
  const checkGender = !!(params?.enforceGender !== false && params?.gender);
@@ -2976,13 +3026,19 @@ function validateCollectionDefinition({
2976
3026
  if (matchUpFormat && !matchUpFormatCode.isValid(matchUpFormat)) {
2977
3027
  errors.push(`Invalid matchUpFormat: ${matchUpFormat}`);
2978
3028
  }
2979
- if (checkGender && referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) && referenceGender !== gender) {
2980
- errors.push(`Invalid gender: ${gender}`);
2981
- return decorateResult({
2982
- result: { error: INVALID_GENDER, errors },
2983
- context: { referenceGender, gender },
2984
- stack
3029
+ if (checkGender) {
3030
+ const result = genderValidityCheck({
3031
+ referenceGender,
3032
+ matchUpType,
3033
+ gender
2985
3034
  });
3035
+ if (result.error) {
3036
+ return decorateResult({
3037
+ context: { referenceGender, gender },
3038
+ result,
3039
+ stack
3040
+ });
3041
+ }
2986
3042
  }
2987
3043
  if (checkCategory && referenceCategory && category) {
2988
3044
  const result = categoryCanContain({
@@ -5710,7 +5766,7 @@ const PUBLIC = "PUBLIC";
5710
5766
  const STATUS$1 = "STATUS";
5711
5767
  const MODIFICATION = "MODIFICATION";
5712
5768
  const RETRIEVAL = "RETRIEVAL";
5713
- const OTHER$3 = "other";
5769
+ const OTHER$2 = "other";
5714
5770
  const timeItemConstants = {
5715
5771
  MUTUALLY_EXCLUSIVE_TIME_MODIFIERS,
5716
5772
  AFTER_REST,
@@ -5729,7 +5785,7 @@ const timeItemConstants = {
5729
5785
  MODIFICATION,
5730
5786
  NEXT_AVAILABLE,
5731
5787
  NOT_BEFORE,
5732
- OTHER: OTHER$3,
5788
+ OTHER: OTHER$2,
5733
5789
  PENALTY: PENALTY$1,
5734
5790
  PUBLIC,
5735
5791
  PUBLISH,
@@ -7971,19 +8027,6 @@ function getSeeding({ seedAssignments, participantId }) {
7971
8027
  );
7972
8028
  }
7973
8029
 
7974
- const ANY = "ANY";
7975
- const MALE = "MALE";
7976
- const MIXED = "MIXED";
7977
- const OTHER$2 = "OTHER";
7978
- const FEMALE = "FEMALE";
7979
- const genderConstants = {
7980
- ANY,
7981
- MALE,
7982
- FEMALE,
7983
- MIXED,
7984
- OTHER: OTHER$2
7985
- };
7986
-
7987
8030
  function getAllStructureMatchUps({
7988
8031
  scheduleVisibilityFilters,
7989
8032
  tournamentAppliedPolicies,
@@ -20884,10 +20927,11 @@ function updateMatchUpStatusCodes({
20884
20927
  );
20885
20928
  matchUp.matchUpStatusCodes = (matchUp.matchUpStatusCodes ?? []).map(
20886
20929
  (code) => {
20887
- if (code.sideNumber === sourceSideNumber) {
20888
- return { ...code, previousMatchUpStatus: sourceMatchUpStatus };
20930
+ const value = isString(code) || !isNaN(code) ? { code } : code;
20931
+ if (value.sideNumber === sourceSideNumber) {
20932
+ return { ...value, previousMatchUpStatus: sourceMatchUpStatus };
20889
20933
  }
20890
- return code;
20934
+ return value;
20891
20935
  }
20892
20936
  );
20893
20937
  }
@@ -38152,7 +38196,7 @@ function engineLogging({ result, methodName, elapsed, params, engine }) {
38152
38196
  log.result = result;
38153
38197
  }
38154
38198
  if (Object.keys(log).length > 1)
38155
- console.log(engine, log);
38199
+ globalLog$1(engine, log);
38156
38200
  if (result && devContext.makeDeepCopy)
38157
38201
  result.deepCopyIterations = getDeepCopyIterations();
38158
38202
  }
@@ -40995,6 +41039,48 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
40995
41039
  };
40996
41040
  }
40997
41041
 
41042
+ function processAccessors({
41043
+ significantCharacters,
41044
+ accessors = [],
41045
+ value
41046
+ }) {
41047
+ const extractedValues = [];
41048
+ const accessor = accessors[0];
41049
+ if (value?.[accessor]) {
41050
+ const remainingKeys = accessors.slice(1);
41051
+ if (Array.isArray(value[accessor])) {
41052
+ const values = value[accessor];
41053
+ values.forEach((nestedValue) => {
41054
+ const result = processAccessors({
41055
+ accessors: remainingKeys,
41056
+ significantCharacters,
41057
+ value: nestedValue
41058
+ });
41059
+ extractedValues.push(...result);
41060
+ });
41061
+ } else {
41062
+ value = value[accessor];
41063
+ if (remainingKeys.length) {
41064
+ const result = processAccessors({
41065
+ accessors: remainingKeys,
41066
+ significantCharacters,
41067
+ value
41068
+ });
41069
+ extractedValues.push(...result);
41070
+ } else {
41071
+ checkValue({ value });
41072
+ }
41073
+ }
41074
+ }
41075
+ function checkValue({ value: value2 }) {
41076
+ if (value2 && ["string", "number"].includes(typeof value2)) {
41077
+ const extractedValue = significantCharacters ? value2.slice(0, significantCharacters) : value2;
41078
+ extractedValues.push(extractedValue);
41079
+ }
41080
+ }
41081
+ return extractedValues;
41082
+ }
41083
+
40998
41084
  function getAttributeGroupings({
40999
41085
  targetParticipantIds,
41000
41086
  policyAttributes,
@@ -41046,8 +41132,14 @@ function extractAttributeValues({
41046
41132
  policyAttributes.forEach((policyAttribute) => {
41047
41133
  const { directive, groupings, key, significantCharacters } = policyAttribute || {};
41048
41134
  if (key) {
41049
- const keys = key.split(".");
41050
- processKeys({ value: participant, keys, significantCharacters });
41135
+ const accessors = key.split(".");
41136
+ extractedValues.push(
41137
+ ...processAccessors({
41138
+ significantCharacters,
41139
+ value: participant,
41140
+ accessors
41141
+ })
41142
+ );
41051
41143
  } else if (directive) {
41052
41144
  const includeIds = policyAttribute?.includeIds;
41053
41145
  const collectionIds = (idCollections?.[directive] || []).filter(
@@ -41076,32 +41168,6 @@ function extractAttributeValues({
41076
41168
  });
41077
41169
  const values = unique(extractedValues);
41078
41170
  return { values };
41079
- function processKeys({ value, keys = [], significantCharacters }) {
41080
- for (const [index, key] of keys.entries()) {
41081
- if (value?.[key]) {
41082
- if (Array.isArray(value[key])) {
41083
- const values2 = value[key];
41084
- const remainingKeys = keys.slice(index);
41085
- values2.forEach(
41086
- (nestedValue) => processKeys({
41087
- value: nestedValue,
41088
- keys: remainingKeys,
41089
- significantCharacters
41090
- })
41091
- );
41092
- } else {
41093
- value = value[key];
41094
- checkValue({ value, index });
41095
- }
41096
- }
41097
- }
41098
- function checkValue({ value: value2, index }) {
41099
- if (value2 && index === keys.length - 1 && ["string", "number"].includes(typeof value2)) {
41100
- const extractedValue = significantCharacters ? value2.slice(0, significantCharacters) : value2;
41101
- extractedValues.push(extractedValue);
41102
- }
41103
- }
41104
- }
41105
41171
  }
41106
41172
 
41107
41173
  function getPositionedParticipants({
@@ -41848,7 +41914,7 @@ function positionUnseededParticipants({
41848
41914
  drawDefinition,
41849
41915
  event
41850
41916
  });
41851
- let { avoidance } = appliedPolicies ?? {};
41917
+ let avoidance = (appliedPolicies ?? {})[POLICY_TYPE_AVOIDANCE];
41852
41918
  if (structure.stage === PLAY_OFF) {
41853
41919
  const groupings = entries.reduce((groupings2, entry) => {
41854
41920
  if (!groupings2[entry.groupingValue])
@@ -54718,7 +54784,7 @@ function getEntryStatusReports({
54718
54784
  }).matchUps ?? [];
54719
54785
  const nonTeamEnteredParticipantIds = nonTeamMatchUps.flatMap(
54720
54786
  ({ sides, matchUpType }) => sides?.flatMap(
54721
- (side) => matchUpType === DOUBLES_MATCHUP ? side.participant?.individualParticipantIds : side.participant?.participantId || side.participantId
54787
+ (side) => matchUpType === DOUBLES_MATCHUP ? side?.participant?.individualParticipantIds : side?.participant?.participantId || side.participantId
54722
54788
  ).filter(Boolean)
54723
54789
  ).filter(Boolean);
54724
54790
  const withDrawnParticipantIds = [];
@@ -54848,13 +54914,14 @@ function getEntryStatusReports({
54848
54914
  const individualParticipants = Object.values(participantMap ?? {}).filter(
54849
54915
  ({ participant: { participantType, participantRole } }) => participantType === INDIVIDUAL && participantRole === COMPETITOR
54850
54916
  );
54851
- const nonParticipatingParticipants = individualParticipants.filter(
54917
+ const nonParticipatingParticipantIds = individualParticipants.filter(
54852
54918
  ({ participant }) => !nonTeamEnteredParticipantIds.includes(participant.participantId)
54853
54919
  ).map(({ participant }) => participant.participantId);
54854
54920
  const tournamentEntryReport = {
54855
- nonParticipatingEntriesCount: nonParticipatingParticipants.length,
54921
+ nonParticipatingEntriesCount: nonParticipatingParticipantIds.length,
54856
54922
  individualParticipantsCount: individualParticipants.length,
54857
54923
  eventsCount: Object.values(eventReports).length,
54924
+ nonParticipatingParticipantIds,
54858
54925
  drawDefinitionsCount,
54859
54926
  tournamentId
54860
54927
  };
@@ -62772,11 +62839,11 @@ function anonymizeTournamentRecord({
62772
62839
  if ([MALE, FEMALE].includes(gender)) {
62773
62840
  counts[gender] += 1;
62774
62841
  } else {
62775
- counts[OTHER$2] += 1;
62842
+ counts[OTHER$3] += 1;
62776
62843
  }
62777
62844
  return counts;
62778
62845
  },
62779
- { [MALE]: 0, [FEMALE]: 0, [OTHER$2]: 0 }
62846
+ { [MALE]: 0, [FEMALE]: 0, [OTHER$3]: 0 }
62780
62847
  );
62781
62848
  const genderedPersons = Object.assign(
62782
62849
  {},
@@ -62792,7 +62859,7 @@ function anonymizeTournamentRecord({
62792
62859
  })?.persons || []
62793
62860
  }))
62794
62861
  );
62795
- const genderedIndices = { [MALE]: 0, [FEMALE]: 0, [OTHER$2]: 0 };
62862
+ const genderedIndices = { [MALE]: 0, [FEMALE]: 0, [OTHER$3]: 0 };
62796
62863
  const individualParticipantsCount = individualParticipants.length;
62797
62864
  const addressComponents = individualParticipants.reduce(
62798
62865
  (components, participant) => {
@@ -62826,7 +62893,7 @@ function anonymizeTournamentRecord({
62826
62893
  const addressValues = { cities, states, postalCodes };
62827
62894
  individualParticipants.forEach((individualParticipant, participantIndex) => {
62828
62895
  const person = individualParticipant?.person;
62829
- const gender = person?.sex || OTHER$2;
62896
+ const gender = person?.sex || OTHER$3;
62830
62897
  const birthYear = extractDate(person?.birthDate)?.split("-")[0];
62831
62898
  const genderedIndex = genderedIndices[gender];
62832
62899
  const generatedPerson = genderedPersons[gender][genderedIndex];
@@ -63381,7 +63448,7 @@ function processTieFormat({
63381
63448
  let maxDoublesCount = 0, maxSinglesCount = 0;
63382
63449
  let singlesMatchUpTotal = 0, doublesMatchUpTotal = 0;
63383
63450
  const categories = {};
63384
- const genders = { [MALE]: 0, [FEMALE]: 0, [MIXED]: 0, [OTHER$2]: 0, [ANY]: 0 };
63451
+ const genders = { [MALE]: 0, [FEMALE]: 0, [MIXED]: 0, [OTHER$3]: 0, [ANY]: 0 };
63385
63452
  tieFormat = typeof tieFormat === "object" ? tieFormat : tieFormatDefaults({ namedFormat: tieFormatName });
63386
63453
  tieFormat?.collectionDefinitions?.filter(Boolean).forEach((collectionDefinition) => {
63387
63454
  const { category, collectionId, matchUpType, matchUpCount, gender } = collectionDefinition;
@@ -63433,7 +63500,7 @@ function getParticipantsCount({
63433
63500
  const gendersCount = {
63434
63501
  [FEMALE]: 0,
63435
63502
  [MIXED]: 0,
63436
- [OTHER$2]: 0,
63503
+ [OTHER$3]: 0,
63437
63504
  [MALE]: 0,
63438
63505
  [ANY]: 0
63439
63506
  };
@@ -65092,6 +65159,7 @@ const utilities = {
65092
65159
  findExtension: findExtension$2,
65093
65160
  flattenJSON,
65094
65161
  garman,
65162
+ genderValidityCheck,
65095
65163
  generateHashCode,
65096
65164
  generateRange,
65097
65165
  generateScoreString,
@@ -65132,5 +65200,5 @@ const utilities = {
65132
65200
  visualizeScheduledMatchUps
65133
65201
  };
65134
65202
 
65135
- export { EntryStatusEnum, competitionEngine, competitionEngineAsync, deleteNotices, drawDefinitionConstants, drawEngine, drawEngineAsync, entryStatusConstants, errorConditionConstants, eventConstants, factoryConstants, fixtures, flightConstants, genderConstants, getNotices, keyValueConstants, matchUpActionConstants, matchUpEngine, matchUpEngineAsync, matchUpFormatCode, matchUpStatusConstants, matchUpTypes, mocksEngine, participantConstants, participantRoles, participantTypes, penaltyConstants, policyConstants, positionActionConstants, resultConstants, scaleConstants, scaleEngine, scaleEngineAsync, scoreGovernor, setDeepCopy, setDevContext, setStateProvider, setSubscriptions, surfaceConstants, timeItemConstants, tournamentEngine, tournamentEngineAsync, utilities, venueConstants, factoryVersion as version };
65203
+ export { EntryStatusEnum, competitionEngine, competitionEngineAsync, deleteNotices, drawDefinitionConstants, drawEngine, drawEngineAsync, entryStatusConstants, errorConditionConstants, eventConstants, factoryConstants, fixtures, flightConstants, genderConstants, getNotices, keyValueConstants, matchUpActionConstants, matchUpEngine, matchUpEngineAsync, matchUpFormatCode, matchUpStatusConstants, matchUpTypes, mocksEngine, participantConstants, participantRoles, participantTypes, penaltyConstants, policyConstants, positionActionConstants, resultConstants, scaleConstants, scaleEngine, scaleEngineAsync, scoreGovernor, setDeepCopy, setDevContext, setGlobalLog, setStateProvider, setSubscriptions, surfaceConstants, timeItemConstants, tournamentEngine, tournamentEngineAsync, utilities, venueConstants, factoryVersion as version };
65136
65204
  //# sourceMappingURL=index.mjs.map