tods-competition-factory 2.2.48 → 2.3.0
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 +8 -8
- package/dist/tods-competition-factory.d.ts +38 -0
- package/dist/tods-competition-factory.development.cjs.js +51 -31
- 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 +21 -18
|
@@ -5730,6 +5730,37 @@ declare function setMatchUpStatus(params: SetMatchUpStatusArgs): ResultType | {
|
|
|
5730
5730
|
};
|
|
5731
5731
|
};
|
|
5732
5732
|
|
|
5733
|
+
type SetMatchUpStateArgs = {
|
|
5734
|
+
tournamentRecords?: {
|
|
5735
|
+
[key: string]: Tournament;
|
|
5736
|
+
};
|
|
5737
|
+
policyDefinitions?: PolicyDefinitions;
|
|
5738
|
+
appliedPolicies?: PolicyDefinitions;
|
|
5739
|
+
matchUpStatus?: MatchUpStatusUnion;
|
|
5740
|
+
allowChangePropagation?: boolean;
|
|
5741
|
+
disableScoreValidation?: boolean;
|
|
5742
|
+
projectedWinningSide?: number;
|
|
5743
|
+
propagateExitStatus?: boolean;
|
|
5744
|
+
matchUpStatusCodes?: string[];
|
|
5745
|
+
tournamentRecord?: Tournament;
|
|
5746
|
+
drawDefinition: DrawDefinition;
|
|
5747
|
+
autoCalcDisabled?: boolean;
|
|
5748
|
+
disableAutoCalc?: boolean;
|
|
5749
|
+
enableAutoCalc?: boolean;
|
|
5750
|
+
matchUpFormat?: string;
|
|
5751
|
+
matchUpTieId?: string;
|
|
5752
|
+
tieMatchUpId?: string;
|
|
5753
|
+
removeScore?: boolean;
|
|
5754
|
+
winningSide?: number;
|
|
5755
|
+
matchUpId: string;
|
|
5756
|
+
schedule?: any;
|
|
5757
|
+
notes?: string;
|
|
5758
|
+
outcome?: any;
|
|
5759
|
+
event?: Event$1;
|
|
5760
|
+
score?: any;
|
|
5761
|
+
};
|
|
5762
|
+
declare function setMatchUpState(params: SetMatchUpStateArgs): any;
|
|
5763
|
+
|
|
5733
5764
|
declare function bulkMatchUpStatusUpdate(params: any): ResultType | {
|
|
5734
5765
|
success?: boolean;
|
|
5735
5766
|
error?: ErrorType;
|
|
@@ -5860,6 +5891,7 @@ declare const mutate$9_resetScorecard: typeof resetScorecard;
|
|
|
5860
5891
|
declare const mutate$9_resetTieFormat: typeof resetTieFormat;
|
|
5861
5892
|
declare const mutate$9_setDelegatedOutcome: typeof setDelegatedOutcome;
|
|
5862
5893
|
declare const mutate$9_setMatchUpFormat: typeof setMatchUpFormat;
|
|
5894
|
+
declare const mutate$9_setMatchUpState: typeof setMatchUpState;
|
|
5863
5895
|
declare const mutate$9_setMatchUpStatus: typeof setMatchUpStatus;
|
|
5864
5896
|
declare const mutate$9_setOrderOfFinish: typeof setOrderOfFinish;
|
|
5865
5897
|
declare const mutate$9_substituteParticipant: typeof substituteParticipant;
|
|
@@ -5886,6 +5918,7 @@ declare namespace mutate$9 {
|
|
|
5886
5918
|
mutate$9_resetTieFormat as resetTieFormat,
|
|
5887
5919
|
mutate$9_setDelegatedOutcome as setDelegatedOutcome,
|
|
5888
5920
|
mutate$9_setMatchUpFormat as setMatchUpFormat,
|
|
5921
|
+
mutate$9_setMatchUpState as setMatchUpState,
|
|
5889
5922
|
mutate$9_setMatchUpStatus as setMatchUpStatus,
|
|
5890
5923
|
mutate$9_setOrderOfFinish as setOrderOfFinish,
|
|
5891
5924
|
mutate$9_substituteParticipant as substituteParticipant,
|
|
@@ -6655,6 +6688,7 @@ declare const index$e_resetScorecard: typeof resetScorecard;
|
|
|
6655
6688
|
declare const index$e_resetTieFormat: typeof resetTieFormat;
|
|
6656
6689
|
declare const index$e_setDelegatedOutcome: typeof setDelegatedOutcome;
|
|
6657
6690
|
declare const index$e_setMatchUpFormat: typeof setMatchUpFormat;
|
|
6691
|
+
declare const index$e_setMatchUpState: typeof setMatchUpState;
|
|
6658
6692
|
declare const index$e_setMatchUpStatus: typeof setMatchUpStatus;
|
|
6659
6693
|
declare const index$e_setOrderOfFinish: typeof setOrderOfFinish;
|
|
6660
6694
|
declare const index$e_substituteParticipant: typeof substituteParticipant;
|
|
@@ -6723,6 +6757,7 @@ declare namespace index$e {
|
|
|
6723
6757
|
index$e_resetTieFormat as resetTieFormat,
|
|
6724
6758
|
index$e_setDelegatedOutcome as setDelegatedOutcome,
|
|
6725
6759
|
index$e_setMatchUpFormat as setMatchUpFormat,
|
|
6760
|
+
index$e_setMatchUpState as setMatchUpState,
|
|
6726
6761
|
index$e_setMatchUpStatus as setMatchUpStatus,
|
|
6727
6762
|
index$e_setOrderOfFinish as setOrderOfFinish,
|
|
6728
6763
|
index$e_substituteParticipant as substituteParticipant,
|
|
@@ -12401,6 +12436,9 @@ declare const drawDefinitionConstants: {
|
|
|
12401
12436
|
RANDOM: any;
|
|
12402
12437
|
TOP_DOWN: any;
|
|
12403
12438
|
BOTTOM_UP: any;
|
|
12439
|
+
CLUSTER: string;
|
|
12440
|
+
ADJACENT: string;
|
|
12441
|
+
SEPARATE: string;
|
|
12404
12442
|
WATERFALL: string;
|
|
12405
12443
|
WIN_RATIO: string;
|
|
12406
12444
|
ROUND_OUTCOME: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.
|
|
6
|
+
return '2.3.0';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SINGLES_MATCHUP = 'SINGLES';
|
|
@@ -2256,7 +2256,7 @@ function isValidMatchUpFormat({ matchUpFormat }) {
|
|
|
2256
2256
|
const preserveRedundant = !!((setParts && tiebreakTo && setsTo === tiebreakAt) ||
|
|
2257
2257
|
(finalSetParts && finalSetTiebreakTo && finalSetTo === finalTiebreakAt));
|
|
2258
2258
|
const stringified = stringify(parsedFormat, preserveRedundant);
|
|
2259
|
-
return stringified === matchUpFormat;
|
|
2259
|
+
return stringified === matchUpFormat.replace(/G/, '');
|
|
2260
2260
|
}
|
|
2261
2261
|
|
|
2262
2262
|
const validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
|
|
@@ -4347,6 +4347,7 @@ const aggregateOrder = {
|
|
|
4347
4347
|
[VOLUNTARY_CONSOLATION]: 5,
|
|
4348
4348
|
};
|
|
4349
4349
|
const CLUSTER = 'CLUSTER';
|
|
4350
|
+
const ADJACENT = 'ADJACENT';
|
|
4350
4351
|
const SEPARATE = 'SEPARATE';
|
|
4351
4352
|
const WATERFALL = 'WATERFALL';
|
|
4352
4353
|
const ITEM = 'ITEM';
|
|
@@ -4484,6 +4485,9 @@ const drawDefinitionConstants = {
|
|
|
4484
4485
|
RANDOM,
|
|
4485
4486
|
TOP_DOWN,
|
|
4486
4487
|
BOTTOM_UP,
|
|
4488
|
+
CLUSTER,
|
|
4489
|
+
ADJACENT,
|
|
4490
|
+
SEPARATE,
|
|
4487
4491
|
WATERFALL,
|
|
4488
4492
|
WIN_RATIO: WIN_RATIO$1,
|
|
4489
4493
|
ROUND_OUTCOME,
|
|
@@ -16161,8 +16165,9 @@ function generateBlockPattern({ positioning, size }) {
|
|
|
16161
16165
|
const selected = [];
|
|
16162
16166
|
const firstMember = (arr) => arr[0];
|
|
16163
16167
|
const lastMember = (arr) => arr[arr.length - 1];
|
|
16164
|
-
const getMember = (arr, i) => (positioning && [CLUSTER, WATERFALL].includes(positioning) && i % 2
|
|
16165
|
-
|
|
16168
|
+
const getMember = (arr, i) => (positioning && [CLUSTER, ADJACENT, WATERFALL].includes(positioning) && i % 2
|
|
16169
|
+
? lastMember(arr)
|
|
16170
|
+
: firstMember(arr)) || firstMember(arr);
|
|
16166
16171
|
const noneSelected = (chunk, i) => {
|
|
16167
16172
|
if (chunk.every((member) => !selected.includes(member))) {
|
|
16168
16173
|
const member = getMember(chunk, i);
|
|
@@ -47205,6 +47210,7 @@ var mutate$7 = {
|
|
|
47205
47210
|
resetTieFormat: resetTieFormat,
|
|
47206
47211
|
setDelegatedOutcome: setDelegatedOutcome,
|
|
47207
47212
|
setMatchUpFormat: setMatchUpFormat,
|
|
47213
|
+
setMatchUpState: setMatchUpState,
|
|
47208
47214
|
setMatchUpStatus: setMatchUpStatus,
|
|
47209
47215
|
setOrderOfFinish: setOrderOfFinish,
|
|
47210
47216
|
substituteParticipant: substituteParticipant,
|
|
@@ -47271,6 +47277,7 @@ var index$9 = {
|
|
|
47271
47277
|
resetTieFormat: resetTieFormat,
|
|
47272
47278
|
setDelegatedOutcome: setDelegatedOutcome,
|
|
47273
47279
|
setMatchUpFormat: setMatchUpFormat,
|
|
47280
|
+
setMatchUpState: setMatchUpState,
|
|
47274
47281
|
setMatchUpStatus: setMatchUpStatus,
|
|
47275
47282
|
setOrderOfFinish: setOrderOfFinish,
|
|
47276
47283
|
substituteParticipant: substituteParticipant,
|
|
@@ -55530,12 +55537,12 @@ function proConflicts({ tournamentRecords, matchUps, }) {
|
|
|
55530
55537
|
const sourceMatchUpIds = deps[matchUpId].matchUpIds;
|
|
55531
55538
|
sourceMatchUpIds.length && profile.sourceMatchUpIds.push(...sourceMatchUpIds);
|
|
55532
55539
|
const matchUpParticipantIds = sides
|
|
55533
|
-
?.
|
|
55540
|
+
?.flatMap((side) => [side.participant?.individualParticipantIds, side.participantId])
|
|
55534
55541
|
.flat()
|
|
55535
55542
|
.filter(Boolean) ?? [];
|
|
55536
55543
|
const potentialMatchUpParticipantIds = potentialParticipants
|
|
55537
55544
|
?.flat()
|
|
55538
|
-
.
|
|
55545
|
+
.flatMap(({ individualParticipantIds, participantId }) => [individualParticipantIds, participantId])
|
|
55539
55546
|
.flat()
|
|
55540
55547
|
.filter(Boolean) || [];
|
|
55541
55548
|
profile.participantIds.push(...potentialMatchUpParticipantIds, ...matchUpParticipantIds);
|
|
@@ -55550,6 +55557,41 @@ function proConflicts({ tournamentRecords, matchUps, }) {
|
|
|
55550
55557
|
}));
|
|
55551
55558
|
const sourceDistance = (a, b) => deps[a].sources.reduce((distance, round, index) => (round.includes(b) && index + 1) || distance, 0);
|
|
55552
55559
|
const rowIssues = rowProfiles.map(() => []);
|
|
55560
|
+
const addWarningToMatchUp = (matchUpId, warnedMatchUpIds, participantConflicts) => {
|
|
55561
|
+
if (!participantConflicts[matchUpId])
|
|
55562
|
+
participantConflicts[matchUpId] = {};
|
|
55563
|
+
if (!participantConflicts[matchUpId][SCHEDULE_WARNING]) {
|
|
55564
|
+
participantConflicts[matchUpId][SCHEDULE_WARNING] = warnedMatchUpIds.filter((id) => id !== matchUpId);
|
|
55565
|
+
}
|
|
55566
|
+
};
|
|
55567
|
+
const processParticipantWarnings = (previousRow, row, participantConflicts) => {
|
|
55568
|
+
const previousRowWarnings = row.participantIds.filter((id) => previousRow.participantIds.includes(id));
|
|
55569
|
+
previousRowWarnings.forEach((participantId) => {
|
|
55570
|
+
const warnedMatchUpIds = row.matchUpIds
|
|
55571
|
+
.concat(previousRow.matchUpIds)
|
|
55572
|
+
.filter((matchUpId) => deps[matchUpId].participantIds.includes(participantId));
|
|
55573
|
+
warnedMatchUpIds.forEach((matchUpId) => {
|
|
55574
|
+
addWarningToMatchUp(matchUpId, warnedMatchUpIds, participantConflicts);
|
|
55575
|
+
});
|
|
55576
|
+
});
|
|
55577
|
+
};
|
|
55578
|
+
const addConflictToMatchUp = (matchUpId, conflictedMatchUpIds, participantConflicts) => {
|
|
55579
|
+
if (!participantConflicts[matchUpId])
|
|
55580
|
+
participantConflicts[matchUpId] = {};
|
|
55581
|
+
if (!participantConflicts[matchUpId][SCHEDULE_CONFLICT]) {
|
|
55582
|
+
participantConflicts[matchUpId][SCHEDULE_CONFLICT] = conflictedMatchUpIds.filter((id) => id !== matchUpId);
|
|
55583
|
+
}
|
|
55584
|
+
};
|
|
55585
|
+
const processParticipantConflicts = (row) => {
|
|
55586
|
+
const participantConflicts = {};
|
|
55587
|
+
const instances = instanceCount(row.participantIds);
|
|
55588
|
+
const conflictedParticipantIds = new Set(Object.keys(instances).filter((key) => instances[key] > 1));
|
|
55589
|
+
const conflictedMatchUpIds = row.matchUpIds.filter((matchUpId) => deps[matchUpId].participantIds.some((id) => conflictedParticipantIds.has(id)));
|
|
55590
|
+
conflictedMatchUpIds.forEach((matchUpId) => {
|
|
55591
|
+
addConflictToMatchUp(matchUpId, conflictedMatchUpIds, participantConflicts);
|
|
55592
|
+
});
|
|
55593
|
+
return participantConflicts;
|
|
55594
|
+
};
|
|
55553
55595
|
const annotate = (matchUpId, issue, issueType, issueIds) => {
|
|
55554
55596
|
if (!mappedMatchUps[matchUpId].schedule[SCHEDULE_STATE]) {
|
|
55555
55597
|
mappedMatchUps[matchUpId].schedule[SCHEDULE_STATE] = issue;
|
|
@@ -55569,31 +55611,9 @@ function proConflicts({ tournamentRecords, matchUps, }) {
|
|
|
55569
55611
|
rowProfiles.forEach((row, rowIndex) => {
|
|
55570
55612
|
const previousRow = rowIndex ? rowProfiles[rowIndex - 1] : undefined;
|
|
55571
55613
|
const subsequentRows = rowProfiles.slice(rowIndex + 1);
|
|
55572
|
-
const participantConflicts =
|
|
55573
|
-
|
|
55574
|
-
|
|
55575
|
-
const conflictedMatchUpIds = row.matchUpIds.filter((matchUpId) => deps[matchUpId].participantIds.some((id) => conflictedParticipantIds.includes(id)));
|
|
55576
|
-
conflictedMatchUpIds.forEach((matchUpId) => {
|
|
55577
|
-
if (!participantConflicts[matchUpId])
|
|
55578
|
-
participantConflicts[matchUpId] = {};
|
|
55579
|
-
if (!participantConflicts[matchUpId][SCHEDULE_CONFLICT]) {
|
|
55580
|
-
participantConflicts[matchUpId][SCHEDULE_CONFLICT] = conflictedMatchUpIds.filter((id) => id !== matchUpId);
|
|
55581
|
-
}
|
|
55582
|
-
});
|
|
55583
|
-
const previousRowWarnings = previousRow && row.participantIds.filter((id) => previousRow.participantIds.includes(id));
|
|
55584
|
-
if (previousRowWarnings) {
|
|
55585
|
-
previousRowWarnings.forEach((participantId) => {
|
|
55586
|
-
const warnedMatchUpIds = row.matchUpIds
|
|
55587
|
-
.concat(previousRow.matchUpIds)
|
|
55588
|
-
.filter((matchUpId) => deps[matchUpId].participantIds.includes(participantId));
|
|
55589
|
-
warnedMatchUpIds.forEach((matchUpId) => {
|
|
55590
|
-
if (!participantConflicts[matchUpId])
|
|
55591
|
-
participantConflicts[matchUpId] = {};
|
|
55592
|
-
if (!participantConflicts[matchUpId][SCHEDULE_WARNING]) {
|
|
55593
|
-
participantConflicts[matchUpId][SCHEDULE_WARNING] = warnedMatchUpIds.filter((id) => id !== matchUpId);
|
|
55594
|
-
}
|
|
55595
|
-
});
|
|
55596
|
-
});
|
|
55614
|
+
const participantConflicts = processParticipantConflicts(row);
|
|
55615
|
+
if (previousRow) {
|
|
55616
|
+
processParticipantWarnings(previousRow, row, participantConflicts);
|
|
55597
55617
|
}
|
|
55598
55618
|
row.matchUpIds.forEach((matchUpId) => {
|
|
55599
55619
|
const sourceMatchUpIds = deps[matchUpId].matchUpIds;
|