tods-competition-factory 1.8.26 → 1.8.28

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.28";
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 (referenceGender === MIXED && (gender !== MIXED || matchUpType === TypeEnum.Singles))
2635
+ return decorateResult({
2636
+ info: "MIXED events can only contain MIXED doubles collections",
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
  }
@@ -29139,12 +29183,12 @@ function modifyCollectionDefinition$1({
29139
29183
 
29140
29184
  function resolveTournamentRecord(params) {
29141
29185
  const { method, tournamentRecords, ...args } = params;
29142
- const tournamentId = params.tournamentId || findTournamentId(args);
29186
+ if (!method)
29187
+ return { error: MISSING_VALUE };
29188
+ const tournamentId = params.tournamentId || findTournamentId({ tournamentRecords, ...args });
29143
29189
  if (typeof tournamentId !== "string")
29144
29190
  return { error: MISSING_TOURNAMENT_ID };
29145
29191
  const tournamentRecord = tournamentRecords[tournamentId];
29146
- if (!tournamentRecord)
29147
- return { error: MISSING_TOURNAMENT_RECORD };
29148
29192
  return method({ ...args, tournamentRecord });
29149
29193
  }
29150
29194
 
@@ -30264,6 +30308,7 @@ function findMatchUp({
30264
30308
  contextContent,
30265
30309
  contextProfile,
30266
30310
  drawDefinition,
30311
+ nextMatchUps,
30267
30312
  matchUpId,
30268
30313
  inContext,
30269
30314
  eventId,
@@ -30274,8 +30319,8 @@ function findMatchUp({
30274
30319
  return { error: MISSING_TOURNAMENT_RECORD };
30275
30320
  if (typeof matchUpId !== "string")
30276
30321
  return { error: MISSING_MATCHUP_ID };
30277
- if (!drawDefinition || !event) {
30278
- const matchUps = allTournamentMatchUps({ tournamentRecord }).matchUps ?? [];
30322
+ if (!drawDefinition || !event || nextMatchUps) {
30323
+ const matchUps = allTournamentMatchUps({ tournamentRecord, nextMatchUps }).matchUps ?? [];
30279
30324
  const inContextMatchUp = matchUps.find(
30280
30325
  (matchUp2) => matchUp2.matchUpId === matchUpId
30281
30326
  );
@@ -36106,7 +36151,7 @@ function credits() {
36106
36151
  This project would not have been possible without the generous input and patience
36107
36152
  of tournament organizers and directors who worked with early versions of CourtHive/TMX.
36108
36153
 
36109
- Thanks to Pavel, Ivan, Mladen, Zdenko, Antoina, Jakov, Kreso, Barry, Jeff, Bobby... to name just a few.
36154
+ Thanks to Pavel, Ivan, Mladen, Zdenko, Antonia, Jakov, Kreso, Barry, Jeff, Bobby... to name just a few.
36110
36155
 
36111
36156
  The project would not have even begun without the support of Miro, or the introduction by Sretchko.
36112
36157
  The project would not have succeeded without the enthusiasm of Randy and Bruce.
@@ -38152,7 +38197,7 @@ function engineLogging({ result, methodName, elapsed, params, engine }) {
38152
38197
  log.result = result;
38153
38198
  }
38154
38199
  if (Object.keys(log).length > 1)
38155
- console.log(engine, log);
38200
+ globalLog$1(engine, log);
38156
38201
  if (result && devContext.makeDeepCopy)
38157
38202
  result.deepCopyIterations = getDeepCopyIterations();
38158
38203
  }
@@ -40995,6 +41040,48 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
40995
41040
  };
40996
41041
  }
40997
41042
 
41043
+ function processAccessors({
41044
+ significantCharacters,
41045
+ accessors = [],
41046
+ value
41047
+ }) {
41048
+ const extractedValues = [];
41049
+ const accessor = accessors[0];
41050
+ if (value?.[accessor]) {
41051
+ const remainingKeys = accessors.slice(1);
41052
+ if (Array.isArray(value[accessor])) {
41053
+ const values = value[accessor];
41054
+ values.forEach((nestedValue) => {
41055
+ const result = processAccessors({
41056
+ accessors: remainingKeys,
41057
+ significantCharacters,
41058
+ value: nestedValue
41059
+ });
41060
+ extractedValues.push(...result);
41061
+ });
41062
+ } else {
41063
+ value = value[accessor];
41064
+ if (remainingKeys.length) {
41065
+ const result = processAccessors({
41066
+ accessors: remainingKeys,
41067
+ significantCharacters,
41068
+ value
41069
+ });
41070
+ extractedValues.push(...result);
41071
+ } else {
41072
+ checkValue({ value });
41073
+ }
41074
+ }
41075
+ }
41076
+ function checkValue({ value: value2 }) {
41077
+ if (value2 && ["string", "number"].includes(typeof value2)) {
41078
+ const extractedValue = significantCharacters ? value2.slice(0, significantCharacters) : value2;
41079
+ extractedValues.push(extractedValue);
41080
+ }
41081
+ }
41082
+ return extractedValues;
41083
+ }
41084
+
40998
41085
  function getAttributeGroupings({
40999
41086
  targetParticipantIds,
41000
41087
  policyAttributes,
@@ -41046,8 +41133,14 @@ function extractAttributeValues({
41046
41133
  policyAttributes.forEach((policyAttribute) => {
41047
41134
  const { directive, groupings, key, significantCharacters } = policyAttribute || {};
41048
41135
  if (key) {
41049
- const keys = key.split(".");
41050
- processKeys({ value: participant, keys, significantCharacters });
41136
+ const accessors = key.split(".");
41137
+ extractedValues.push(
41138
+ ...processAccessors({
41139
+ significantCharacters,
41140
+ value: participant,
41141
+ accessors
41142
+ })
41143
+ );
41051
41144
  } else if (directive) {
41052
41145
  const includeIds = policyAttribute?.includeIds;
41053
41146
  const collectionIds = (idCollections?.[directive] || []).filter(
@@ -41076,32 +41169,6 @@ function extractAttributeValues({
41076
41169
  });
41077
41170
  const values = unique(extractedValues);
41078
41171
  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
41172
  }
41106
41173
 
41107
41174
  function getPositionedParticipants({
@@ -41848,7 +41915,7 @@ function positionUnseededParticipants({
41848
41915
  drawDefinition,
41849
41916
  event
41850
41917
  });
41851
- let { avoidance } = appliedPolicies ?? {};
41918
+ let avoidance = (appliedPolicies ?? {})[POLICY_TYPE_AVOIDANCE];
41852
41919
  if (structure.stage === PLAY_OFF) {
41853
41920
  const groupings = entries.reduce((groupings2, entry) => {
41854
41921
  if (!groupings2[entry.groupingValue])
@@ -54718,7 +54785,7 @@ function getEntryStatusReports({
54718
54785
  }).matchUps ?? [];
54719
54786
  const nonTeamEnteredParticipantIds = nonTeamMatchUps.flatMap(
54720
54787
  ({ sides, matchUpType }) => sides?.flatMap(
54721
- (side) => matchUpType === DOUBLES_MATCHUP ? side.participant?.individualParticipantIds : side.participant?.participantId || side.participantId
54788
+ (side) => matchUpType === DOUBLES_MATCHUP ? side?.participant?.individualParticipantIds : side?.participant?.participantId || side.participantId
54722
54789
  ).filter(Boolean)
54723
54790
  ).filter(Boolean);
54724
54791
  const withDrawnParticipantIds = [];
@@ -54848,13 +54915,14 @@ function getEntryStatusReports({
54848
54915
  const individualParticipants = Object.values(participantMap ?? {}).filter(
54849
54916
  ({ participant: { participantType, participantRole } }) => participantType === INDIVIDUAL && participantRole === COMPETITOR
54850
54917
  );
54851
- const nonParticipatingParticipants = individualParticipants.filter(
54918
+ const nonParticipatingParticipantIds = individualParticipants.filter(
54852
54919
  ({ participant }) => !nonTeamEnteredParticipantIds.includes(participant.participantId)
54853
54920
  ).map(({ participant }) => participant.participantId);
54854
54921
  const tournamentEntryReport = {
54855
- nonParticipatingEntriesCount: nonParticipatingParticipants.length,
54922
+ nonParticipatingEntriesCount: nonParticipatingParticipantIds.length,
54856
54923
  individualParticipantsCount: individualParticipants.length,
54857
54924
  eventsCount: Object.values(eventReports).length,
54925
+ nonParticipatingParticipantIds,
54858
54926
  drawDefinitionsCount,
54859
54927
  tournamentId
54860
54928
  };
@@ -54882,7 +54950,7 @@ function getParticipantStats({
54882
54950
  if (matchUps && !Array.isArray(matchUps))
54883
54951
  return { error: INVALID_MATCHUP };
54884
54952
  const participantsProfile = withScaleValues ? { withScaleValues } : void 0;
54885
- matchUps = matchUps || allTournamentMatchUps({ tournamentRecord, participantsProfile }).matchUps;
54953
+ matchUps = matchUps ?? allTournamentMatchUps({ tournamentRecord, participantsProfile }).matchUps;
54886
54954
  if (!matchUps?.length)
54887
54955
  return { error: MISSING_MATCHUPS };
54888
54956
  const teamParticipantIds = [];
@@ -54940,6 +55008,9 @@ function getParticipantStats({
54940
55008
  participantName: participant.participantName,
54941
55009
  ratings: participant.ratings
54942
55010
  });
55011
+ const stats = participantStats.get(participant.participantId);
55012
+ if (stats)
55013
+ stats.participantName = participant.participantName;
54943
55014
  }
54944
55015
  }
54945
55016
  const getCompetitorIds = ({ side, individualParticipantIds }) => {
@@ -61892,6 +61963,7 @@ var lastNames = [
61892
61963
  "Dallas",
61893
61964
  "Diamond",
61894
61965
  "Deckard",
61966
+ "Drazic",
61895
61967
  "Dunbar",
61896
61968
  "Earhart",
61897
61969
  "Eisenstein",
@@ -61972,7 +62044,7 @@ var firstFemale = [
61972
62044
  "Amelie",
61973
62045
  "America",
61974
62046
  "Anne",
61975
- "Antoina",
62047
+ "Antonia",
61976
62048
  "Aravis",
61977
62049
  "Astrid",
61978
62050
  "Beatrice",
@@ -62772,11 +62844,11 @@ function anonymizeTournamentRecord({
62772
62844
  if ([MALE, FEMALE].includes(gender)) {
62773
62845
  counts[gender] += 1;
62774
62846
  } else {
62775
- counts[OTHER$2] += 1;
62847
+ counts[OTHER$3] += 1;
62776
62848
  }
62777
62849
  return counts;
62778
62850
  },
62779
- { [MALE]: 0, [FEMALE]: 0, [OTHER$2]: 0 }
62851
+ { [MALE]: 0, [FEMALE]: 0, [OTHER$3]: 0 }
62780
62852
  );
62781
62853
  const genderedPersons = Object.assign(
62782
62854
  {},
@@ -62792,7 +62864,7 @@ function anonymizeTournamentRecord({
62792
62864
  })?.persons || []
62793
62865
  }))
62794
62866
  );
62795
- const genderedIndices = { [MALE]: 0, [FEMALE]: 0, [OTHER$2]: 0 };
62867
+ const genderedIndices = { [MALE]: 0, [FEMALE]: 0, [OTHER$3]: 0 };
62796
62868
  const individualParticipantsCount = individualParticipants.length;
62797
62869
  const addressComponents = individualParticipants.reduce(
62798
62870
  (components, participant) => {
@@ -62826,7 +62898,7 @@ function anonymizeTournamentRecord({
62826
62898
  const addressValues = { cities, states, postalCodes };
62827
62899
  individualParticipants.forEach((individualParticipant, participantIndex) => {
62828
62900
  const person = individualParticipant?.person;
62829
- const gender = person?.sex || OTHER$2;
62901
+ const gender = person?.sex || OTHER$3;
62830
62902
  const birthYear = extractDate(person?.birthDate)?.split("-")[0];
62831
62903
  const genderedIndex = genderedIndices[gender];
62832
62904
  const generatedPerson = genderedPersons[gender][genderedIndex];
@@ -63381,7 +63453,7 @@ function processTieFormat({
63381
63453
  let maxDoublesCount = 0, maxSinglesCount = 0;
63382
63454
  let singlesMatchUpTotal = 0, doublesMatchUpTotal = 0;
63383
63455
  const categories = {};
63384
- const genders = { [MALE]: 0, [FEMALE]: 0, [MIXED]: 0, [OTHER$2]: 0, [ANY]: 0 };
63456
+ const genders = { [MALE]: 0, [FEMALE]: 0, [MIXED]: 0, [OTHER$3]: 0, [ANY]: 0 };
63385
63457
  tieFormat = typeof tieFormat === "object" ? tieFormat : tieFormatDefaults({ namedFormat: tieFormatName });
63386
63458
  tieFormat?.collectionDefinitions?.filter(Boolean).forEach((collectionDefinition) => {
63387
63459
  const { category, collectionId, matchUpType, matchUpCount, gender } = collectionDefinition;
@@ -63433,7 +63505,7 @@ function getParticipantsCount({
63433
63505
  const gendersCount = {
63434
63506
  [FEMALE]: 0,
63435
63507
  [MIXED]: 0,
63436
- [OTHER$2]: 0,
63508
+ [OTHER$3]: 0,
63437
63509
  [MALE]: 0,
63438
63510
  [ANY]: 0
63439
63511
  };
@@ -65092,6 +65164,7 @@ const utilities = {
65092
65164
  findExtension: findExtension$2,
65093
65165
  flattenJSON,
65094
65166
  garman,
65167
+ genderValidityCheck,
65095
65168
  generateHashCode,
65096
65169
  generateRange,
65097
65170
  generateScoreString,
@@ -65132,5 +65205,5 @@ const utilities = {
65132
65205
  visualizeScheduledMatchUps
65133
65206
  };
65134
65207
 
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 };
65208
+ 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
65209
  //# sourceMappingURL=index.mjs.map