tods-competition-factory 2.0.40 → 2.0.41
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 +5 -5
- package/dist/tods-competition-factory.d.ts +16 -2
- package/dist/tods-competition-factory.development.cjs.js +34 -70
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -8716,6 +8716,17 @@ declare function checkSetIsComplete({ ignoreTiebreak, matchUpScoringFormat, matc
|
|
|
8716
8716
|
info: string;
|
|
8717
8717
|
};
|
|
8718
8718
|
|
|
8719
|
+
type AnalyzeScoreArgs = {
|
|
8720
|
+
existingMatchUpStatus?: string;
|
|
8721
|
+
matchUpStatus?: string;
|
|
8722
|
+
matchUpFormat?: string;
|
|
8723
|
+
winningSide?: number;
|
|
8724
|
+
score: Score;
|
|
8725
|
+
};
|
|
8726
|
+
declare function analyzeScore({ existingMatchUpStatus, matchUpFormat, matchUpStatus, winningSide, score, }: AnalyzeScoreArgs): {
|
|
8727
|
+
valid: boolean;
|
|
8728
|
+
};
|
|
8729
|
+
|
|
8719
8730
|
type ParseScoreArgs = {
|
|
8720
8731
|
scoreString: string;
|
|
8721
8732
|
tiebreakTo?: number;
|
|
@@ -8734,6 +8745,7 @@ declare function analyzeSet(params: any): {
|
|
|
8734
8745
|
[key: string]: any;
|
|
8735
8746
|
};
|
|
8736
8747
|
|
|
8748
|
+
declare const query_analyzeScore: typeof analyzeScore;
|
|
8737
8749
|
declare const query_analyzeSet: typeof analyzeSet;
|
|
8738
8750
|
declare const query_checkScoreHasValue: typeof checkScoreHasValue;
|
|
8739
8751
|
declare const query_checkSetIsComplete: typeof checkSetIsComplete;
|
|
@@ -8744,13 +8756,14 @@ declare const query_parseScoreString: typeof parseScoreString;
|
|
|
8744
8756
|
declare const query_validateScore: typeof validateScore;
|
|
8745
8757
|
declare const query_validateTieFormat: typeof validateTieFormat;
|
|
8746
8758
|
declare namespace query {
|
|
8747
|
-
export { query_analyzeSet as analyzeSet, query_checkScoreHasValue as checkScoreHasValue, query_checkSetIsComplete as checkSetIsComplete, query_getSetComplement as getSetComplement, query_getTiebreakComplement as getTiebreakComplement, query_isValidMatchUpFormat as isValidMatchUpFormat, query_parseScoreString as parseScoreString, query_validateScore as validateScore, query_validateTieFormat as validateTieFormat };
|
|
8759
|
+
export { query_analyzeScore as analyzeScore, query_analyzeSet as analyzeSet, query_checkScoreHasValue as checkScoreHasValue, query_checkSetIsComplete as checkSetIsComplete, query_getSetComplement as getSetComplement, query_getTiebreakComplement as getTiebreakComplement, query_isValidMatchUpFormat as isValidMatchUpFormat, query_parseScoreString as parseScoreString, query_validateScore as validateScore, query_validateTieFormat as validateTieFormat };
|
|
8748
8760
|
}
|
|
8749
8761
|
|
|
8750
8762
|
declare const index$6_addGame: typeof addGame;
|
|
8751
8763
|
declare const index$6_addPoint: typeof addPoint;
|
|
8752
8764
|
declare const index$6_addSet: typeof addSet;
|
|
8753
8765
|
declare const index$6_addShot: typeof addShot;
|
|
8766
|
+
declare const index$6_analyzeScore: typeof analyzeScore;
|
|
8754
8767
|
declare const index$6_analyzeSet: typeof analyzeSet;
|
|
8755
8768
|
declare const index$6_calculateHistoryScore: typeof calculateHistoryScore;
|
|
8756
8769
|
declare const index$6_checkScoreHasValue: typeof checkScoreHasValue;
|
|
@@ -8773,7 +8786,7 @@ declare const index$6_undo: typeof undo;
|
|
|
8773
8786
|
declare const index$6_validateScore: typeof validateScore;
|
|
8774
8787
|
declare const index$6_validateTieFormat: typeof validateTieFormat;
|
|
8775
8788
|
declare namespace index$6 {
|
|
8776
|
-
export { index$6_addGame as addGame, index$6_addPoint as addPoint, index$6_addSet as addSet, index$6_addShot as addShot, index$6_analyzeSet as analyzeSet, index$6_calculateHistoryScore as calculateHistoryScore, index$6_checkScoreHasValue as checkScoreHasValue, index$6_checkSetIsComplete as checkSetIsComplete, index$6_clearHistory as clearHistory, generate$1 as generate, index$6_generateScoreString as generateScoreString, index$6_generateTieMatchUpScore as generateTieMatchUpScore, index$6_getSetComplement as getSetComplement, index$6_getTiebreakComplement as getTiebreakComplement, help as helpers, index$6_isValidMatchUpFormat as isValidMatchUpFormat, index$6_keyValueScore as keyValueScore, mutate$3 as mutate, parse as parseMatchUpFormat, index$6_parseScoreString as parseScoreString, index$6_query as query, index$6_redo as redo, index$6_reverseScore as reverseScore, index$6_setServingSide as setServingSide, stringify as stringifyMatchUpFormat, index$6_tidyScore as tidyScore, index$6_umo as umo, index$6_undo as undo, index$6_validateScore as validateScore, index$6_validateTieFormat as validateTieFormat };
|
|
8789
|
+
export { index$6_addGame as addGame, index$6_addPoint as addPoint, index$6_addSet as addSet, index$6_addShot as addShot, index$6_analyzeScore as analyzeScore, index$6_analyzeSet as analyzeSet, index$6_calculateHistoryScore as calculateHistoryScore, index$6_checkScoreHasValue as checkScoreHasValue, index$6_checkSetIsComplete as checkSetIsComplete, index$6_clearHistory as clearHistory, generate$1 as generate, index$6_generateScoreString as generateScoreString, index$6_generateTieMatchUpScore as generateTieMatchUpScore, index$6_getSetComplement as getSetComplement, index$6_getTiebreakComplement as getTiebreakComplement, help as helpers, index$6_isValidMatchUpFormat as isValidMatchUpFormat, index$6_keyValueScore as keyValueScore, mutate$3 as mutate, parse as parseMatchUpFormat, index$6_parseScoreString as parseScoreString, index$6_query as query, index$6_redo as redo, index$6_reverseScore as reverseScore, index$6_setServingSide as setServingSide, stringify as stringifyMatchUpFormat, index$6_tidyScore as tidyScore, index$6_umo as umo, index$6_undo as undo, index$6_validateScore as validateScore, index$6_validateTieFormat as validateTieFormat };
|
|
8777
8790
|
}
|
|
8778
8791
|
|
|
8779
8792
|
type ModifyCollectionDefinitionArgs = {
|
|
@@ -10849,6 +10862,7 @@ declare const extensionConstants: {
|
|
|
10849
10862
|
DISABLED: string;
|
|
10850
10863
|
DISABLE_LINKS: string;
|
|
10851
10864
|
DISABLE_AUTO_CALC: string;
|
|
10865
|
+
DISPLAY: string;
|
|
10852
10866
|
DRAW_DELETIONS: string;
|
|
10853
10867
|
DRAW_PROFILE: string;
|
|
10854
10868
|
ENTRY_PROFILE: string;
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var namesData$1 = require('@Fixtures/data/teams.json');
|
|
6
|
+
|
|
5
7
|
function factoryVersion() {
|
|
6
|
-
return '2.0.
|
|
8
|
+
return '2.0.41';
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
function isFunction(obj) {
|
|
@@ -2712,6 +2714,7 @@ const DELEGATED_OUTCOME = 'delegatedOutcome';
|
|
|
2712
2714
|
const DISABLED = 'disabled';
|
|
2713
2715
|
const DISABLE_LINKS = 'disableLinks';
|
|
2714
2716
|
const DISABLE_AUTO_CALC = 'disableAutoCalc';
|
|
2717
|
+
const DISPLAY = 'display';
|
|
2715
2718
|
const DRAW_DELETIONS = 'drawDeletions';
|
|
2716
2719
|
const DRAW_PROFILE = 'drawProfile';
|
|
2717
2720
|
const ENTRY_PROFILE = 'entryProfile';
|
|
@@ -2743,6 +2746,7 @@ const extensionConstants = {
|
|
|
2743
2746
|
DISABLED,
|
|
2744
2747
|
DISABLE_LINKS,
|
|
2745
2748
|
DISABLE_AUTO_CALC,
|
|
2749
|
+
DISPLAY,
|
|
2746
2750
|
DRAW_DELETIONS,
|
|
2747
2751
|
DRAW_PROFILE,
|
|
2748
2752
|
ENTRY_PROFILE,
|
|
@@ -21072,9 +21076,9 @@ function modifyMatchUpScore(params) {
|
|
|
21072
21076
|
}
|
|
21073
21077
|
|
|
21074
21078
|
function attemptToModifyScore(params) {
|
|
21075
|
-
const {
|
|
21079
|
+
const { matchUpStatusCodes, matchUpStatus, structure, matchUp, dualMatchUp } = params;
|
|
21076
21080
|
const matchUpStatusIsValid = isDirectingMatchUpStatus({ matchUpStatus }) ||
|
|
21077
|
-
([CANCELLED$1, ABANDONED$1].includes(matchUpStatus) &&
|
|
21081
|
+
([CANCELLED$1, ABANDONED$1].includes(matchUpStatus) && dualMatchUp);
|
|
21078
21082
|
const stack = 'attemptToModifyScore';
|
|
21079
21083
|
const isCollectionMatchUp = Boolean(matchUp.collectionId);
|
|
21080
21084
|
const isAdHocMatchUp = isAdHoc({ structure });
|
|
@@ -21083,10 +21087,11 @@ function attemptToModifyScore(params) {
|
|
|
21083
21087
|
return { error: MISSING_ASSIGNMENTS };
|
|
21084
21088
|
}
|
|
21085
21089
|
const removeScore = [WALKOVER$2].includes(matchUpStatus);
|
|
21090
|
+
const updatedMatchUpStatus = matchUpStatusIsValid ? matchUpStatus : (params.winningSide && COMPLETED$1) || INCOMPLETE;
|
|
21086
21091
|
const result = modifyMatchUpScore({
|
|
21087
21092
|
...params,
|
|
21088
21093
|
matchUpStatusCodes: (matchUpStatusIsValid && matchUpStatusCodes) || [],
|
|
21089
|
-
matchUpStatus:
|
|
21094
|
+
matchUpStatus: updatedMatchUpStatus,
|
|
21090
21095
|
context: stack,
|
|
21091
21096
|
removeScore,
|
|
21092
21097
|
});
|
|
@@ -30311,6 +30316,7 @@ function analyzeScore({ existingMatchUpStatus, matchUpFormat, matchUpStatus, win
|
|
|
30311
30316
|
const matchUpScoringFormat = matchUpFormat ? parse(matchUpFormat) : undefined;
|
|
30312
30317
|
const maxSetsCount = Math.max(...setsWinCounts);
|
|
30313
30318
|
const maxSetsInstances = instanceCount(setsWinCounts)[maxSetsCount];
|
|
30319
|
+
const timed = matchUpScoringFormat?.setFormat?.timed || matchUpScoringFormat?.finalSetFormat?.timed;
|
|
30314
30320
|
const bestOf = matchUpScoringFormat?.bestOf;
|
|
30315
30321
|
const setsToWin = (bestOf && Math.ceil(bestOf / 2)) || 1;
|
|
30316
30322
|
const relevantMatchUpStatus = matchUpStatus ?? existingMatchUpStatus;
|
|
@@ -30347,10 +30353,13 @@ function analyzeScore({ existingMatchUpStatus, matchUpFormat, matchUpStatus, win
|
|
|
30347
30353
|
maxSetsInstances === 1 &&
|
|
30348
30354
|
setsWinCounts.indexOf(maxSetsCount) + 1) ||
|
|
30349
30355
|
undefined;
|
|
30350
|
-
const valid = validSets &&
|
|
30356
|
+
const valid = !!(validSets &&
|
|
30351
30357
|
((winningSide && winningSideSetsCount > losingSideSetsCount && winningSide === calculatedWinningSide) ||
|
|
30352
|
-
(
|
|
30353
|
-
|
|
30358
|
+
(winningSide && irregularEnding) ||
|
|
30359
|
+
(!winningSide &&
|
|
30360
|
+
!calculatedWinningSide &&
|
|
30361
|
+
(![COMPLETED$1, DEFAULTED, RETIRED$1, WALKOVER$2].includes(relevantMatchUpStatus) ||
|
|
30362
|
+
(timed && relevantMatchUpStatus === COMPLETED$1)))));
|
|
30354
30363
|
return { valid };
|
|
30355
30364
|
}
|
|
30356
30365
|
|
|
@@ -30760,6 +30769,7 @@ function checkValidTiebreakSetOutcome({ setObject, setFormat, sideTiebreakScores
|
|
|
30760
30769
|
|
|
30761
30770
|
var query$a = {
|
|
30762
30771
|
__proto__: null,
|
|
30772
|
+
analyzeScore: analyzeScore,
|
|
30763
30773
|
analyzeSet: analyzeSet,
|
|
30764
30774
|
checkScoreHasValue: checkScoreHasValue,
|
|
30765
30775
|
checkSetIsComplete: checkSetIsComplete,
|
|
@@ -30777,6 +30787,7 @@ var scoreGovernor = {
|
|
|
30777
30787
|
addPoint: addPoint,
|
|
30778
30788
|
addSet: addSet,
|
|
30779
30789
|
addShot: addShot,
|
|
30790
|
+
analyzeScore: analyzeScore,
|
|
30780
30791
|
analyzeSet: analyzeSet,
|
|
30781
30792
|
calculateHistoryScore: calculateHistoryScore,
|
|
30782
30793
|
checkScoreHasValue: checkScoreHasValue,
|
|
@@ -34113,6 +34124,7 @@ function getDrawData(params) {
|
|
|
34113
34124
|
drawType,
|
|
34114
34125
|
drawId,
|
|
34115
34126
|
}))(drawDefinition);
|
|
34127
|
+
drawInfo.display = findExtension({ element: drawDefinition, name: DISPLAY }).extension?.value;
|
|
34116
34128
|
let mainStageSeedAssignments, qualificationStageSeedAssignments;
|
|
34117
34129
|
const { allStructuresLinked, sourceStructureIds, hasDrawFeedProfile, structureGroups } = getStructureGroups({
|
|
34118
34130
|
drawDefinition,
|
|
@@ -34169,14 +34181,11 @@ function getDrawData(params) {
|
|
|
34169
34181
|
structure,
|
|
34170
34182
|
});
|
|
34171
34183
|
let participantResults = positionAssignments?.filter(xa(PARTICIPANT_ID)).map((assignment) => {
|
|
34184
|
+
const participantResult = findExtension({ element: assignment, name: TALLY })?.extension?.value;
|
|
34172
34185
|
const { drawPosition, participantId } = assignment;
|
|
34173
|
-
const { extension } = findExtension({
|
|
34174
|
-
element: assignment,
|
|
34175
|
-
name: TALLY,
|
|
34176
|
-
});
|
|
34177
34186
|
participantPlacements = true;
|
|
34178
34187
|
return {
|
|
34179
|
-
participantResult
|
|
34188
|
+
participantResult,
|
|
34180
34189
|
participantId,
|
|
34181
34190
|
drawPosition,
|
|
34182
34191
|
};
|
|
@@ -34209,6 +34218,7 @@ function getDrawData(params) {
|
|
|
34209
34218
|
stage,
|
|
34210
34219
|
}))(structure)
|
|
34211
34220
|
: {};
|
|
34221
|
+
structureInfo.display = findExtension({ element: structure, name: DISPLAY }).extension?.value;
|
|
34212
34222
|
structureInfo.sourceStructureIds = sourceStructureIds[structureId];
|
|
34213
34223
|
structureInfo.hasDrawFeedProfile = hasDrawFeedProfile[structureId];
|
|
34214
34224
|
structureInfo.positionAssignments = positionAssignments;
|
|
@@ -34390,6 +34400,10 @@ function getEventData(params) {
|
|
|
34390
34400
|
ballType,
|
|
34391
34401
|
discipline,
|
|
34392
34402
|
}))(event);
|
|
34403
|
+
eventInfo.display = findExtension({
|
|
34404
|
+
element: event,
|
|
34405
|
+
name: DISPLAY,
|
|
34406
|
+
}).extension?.value;
|
|
34393
34407
|
const eventData = {
|
|
34394
34408
|
tournamentInfo,
|
|
34395
34409
|
venuesData,
|
|
@@ -44185,7 +44199,8 @@ function setMatchUpStatus(params) {
|
|
|
44185
44199
|
params.drawDefinition = result.drawDefinition;
|
|
44186
44200
|
params.event = result.event;
|
|
44187
44201
|
}
|
|
44188
|
-
const { disableScoreValidation, policyDefinitions, tournamentRecord, disableAutoCalc, enableAutoCalc, drawDefinition,
|
|
44202
|
+
const { disableScoreValidation, policyDefinitions, tournamentRecord, disableAutoCalc, enableAutoCalc, drawDefinition, matchUpId, schedule, event, notes, } = params;
|
|
44203
|
+
const matchUpFormat = params.matchUpFormat || params.outcome?.matchUpFormat;
|
|
44189
44204
|
const { policy } = findPolicy({
|
|
44190
44205
|
policyType: POLICY_TYPE_SCORING,
|
|
44191
44206
|
tournamentRecord,
|
|
@@ -47277,7 +47292,7 @@ var firstMale = [
|
|
|
47277
47292
|
"Winston",
|
|
47278
47293
|
"Zoran"
|
|
47279
47294
|
];
|
|
47280
|
-
var namesData
|
|
47295
|
+
var namesData = {
|
|
47281
47296
|
lastNames: lastNames,
|
|
47282
47297
|
firstFemale: firstFemale,
|
|
47283
47298
|
firstMale: firstMale
|
|
@@ -47288,7 +47303,7 @@ function generatePersonData(params) {
|
|
|
47288
47303
|
if (!count || (sex && ![MALE, FEMALE].includes(sex)))
|
|
47289
47304
|
return { personData: [], error: INVALID_VALUES };
|
|
47290
47305
|
const buffer = Math.ceil(count * 1.3);
|
|
47291
|
-
const { lastNames, firstFemale, firstMale } = namesData
|
|
47306
|
+
const { lastNames, firstFemale, firstMale } = namesData;
|
|
47292
47307
|
const ISOs = countries.map(({ iso }) => iso).filter(Boolean);
|
|
47293
47308
|
const lastNameDupeCount = Math.ceil(buffer / lastNames.length);
|
|
47294
47309
|
const femaleDupeCount = Math.ceil(buffer / firstFemale.length);
|
|
@@ -47442,62 +47457,8 @@ function generatePersons(params) {
|
|
|
47442
47457
|
};
|
|
47443
47458
|
}
|
|
47444
47459
|
|
|
47445
|
-
var namesData = [
|
|
47446
|
-
"Ace Academy",
|
|
47447
|
-
"Avengers",
|
|
47448
|
-
"Ball Bouncers",
|
|
47449
|
-
"Baseliners",
|
|
47450
|
-
"Captivators",
|
|
47451
|
-
"Civil Disobedients",
|
|
47452
|
-
"Continentals",
|
|
47453
|
-
"Court Royal",
|
|
47454
|
-
"Court Sharks",
|
|
47455
|
-
"Diamond Dogs",
|
|
47456
|
-
"Danger Zone",
|
|
47457
|
-
"Doubles Dominators",
|
|
47458
|
-
"Double Faults",
|
|
47459
|
-
"Tricksters",
|
|
47460
|
-
"Eliminators",
|
|
47461
|
-
"Court Crusaders",
|
|
47462
|
-
"Fuzz Busters",
|
|
47463
|
-
"Game Changers",
|
|
47464
|
-
"Goal Gurus",
|
|
47465
|
-
"Good Volley",
|
|
47466
|
-
"Green Machine",
|
|
47467
|
-
"Hawk Eyes",
|
|
47468
|
-
"Inside Outers",
|
|
47469
|
-
"Killer Instinct",
|
|
47470
|
-
"Line Toers",
|
|
47471
|
-
"Masters of Mayhem",
|
|
47472
|
-
"Matter Catchers",
|
|
47473
|
-
"Cheap Shot",
|
|
47474
|
-
"Mean Machines",
|
|
47475
|
-
"Mindspace Invaders",
|
|
47476
|
-
"Net Centric",
|
|
47477
|
-
"Net Positive",
|
|
47478
|
-
"Smash Mullet",
|
|
47479
|
-
"Over Your Head",
|
|
47480
|
-
"Spin Meisters",
|
|
47481
|
-
"Aggressors",
|
|
47482
|
-
"Racket Machine",
|
|
47483
|
-
"Slice Happy",
|
|
47484
|
-
"Refs Nightmare",
|
|
47485
|
-
"Sandeaters",
|
|
47486
|
-
"Sun Seekers",
|
|
47487
|
-
"Slicer Dicers",
|
|
47488
|
-
"Sparkle Soul Tribe",
|
|
47489
|
-
"Stacked Deck",
|
|
47490
|
-
"Cross Stringers",
|
|
47491
|
-
"The Emergence",
|
|
47492
|
-
"Total Demolition",
|
|
47493
|
-
"Touch and Go",
|
|
47494
|
-
"Upside Downers",
|
|
47495
|
-
"Vertically Challenged",
|
|
47496
|
-
"Visual Spectacle"
|
|
47497
|
-
];
|
|
47498
|
-
|
|
47499
47460
|
function nameMocks({ nameRoot = 'TEAM', count = 1 } = {}) {
|
|
47500
|
-
const shuffledTeamNames = shuffleArray(namesData);
|
|
47461
|
+
const shuffledTeamNames = shuffleArray(namesData$1);
|
|
47501
47462
|
const names = shuffledTeamNames.slice(0, count);
|
|
47502
47463
|
if (names.length < count) {
|
|
47503
47464
|
generateRange(0, count - names.length).forEach((i) => names.push(`${nameRoot} ${i + 1}`));
|
|
@@ -49707,10 +49668,13 @@ function processLeagueProfiles(params) {
|
|
|
49707
49668
|
const mockTournamentNames = [
|
|
49708
49669
|
'Generated Tournament',
|
|
49709
49670
|
'CourtHive Challenge',
|
|
49671
|
+
'Replication Crisis',
|
|
49710
49672
|
'Open Competition',
|
|
49711
49673
|
'Factory Follies',
|
|
49712
49674
|
'Mock Tournament',
|
|
49675
|
+
'Atomic Culture',
|
|
49713
49676
|
'Racket Rally',
|
|
49677
|
+
'Stats Fail',
|
|
49714
49678
|
];
|
|
49715
49679
|
function generateTournamentRecord(params) {
|
|
49716
49680
|
let { startDate, endDate } = params ?? {};
|