tods-competition-factory 2.2.17 → 2.2.19
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 +7 -7
- package/dist/tods-competition-factory.d.ts +3 -0
- package/dist/tods-competition-factory.development.cjs.js +129 -107
- 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 +12 -12
|
@@ -3790,16 +3790,19 @@ declare function generateDrawDefinition(params: GenerateDrawDefinitionArgs): Res
|
|
|
3790
3790
|
};
|
|
3791
3791
|
|
|
3792
3792
|
type GenerateQualifyingStructureArgs = {
|
|
3793
|
+
hasExistingDrawDefinition?: boolean;
|
|
3793
3794
|
appliedPolicies?: PolicyDefinitions;
|
|
3794
3795
|
qualifyingRoundNumber: number;
|
|
3795
3796
|
drawDefinition: DrawDefinition;
|
|
3796
3797
|
qualifyingPositions?: number;
|
|
3797
3798
|
participantsCount?: number;
|
|
3798
3799
|
targetStructureId: string;
|
|
3800
|
+
qualifyingOnly?: boolean;
|
|
3799
3801
|
drawType?: DrawTypeUnion;
|
|
3800
3802
|
structureOptions?: any;
|
|
3801
3803
|
matchUpFormat?: string;
|
|
3802
3804
|
structureName?: string;
|
|
3805
|
+
tieFormat?: TieFormat;
|
|
3803
3806
|
structureId?: string;
|
|
3804
3807
|
roundTarget: number;
|
|
3805
3808
|
drawSize?: number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.2.
|
|
6
|
+
return '2.2.19';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SINGLES_MATCHUP = 'SINGLES';
|
|
@@ -10261,14 +10261,14 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
|
|
|
10261
10261
|
tournamentRecord?.processCodes;
|
|
10262
10262
|
const competitiveProfile = contextProfile?.withCompetitiveness && getMatchUpCompetitiveProfile({ ...contextContent, matchUp });
|
|
10263
10263
|
const finishingPositionRange = matchUp.finishingPositionRange ?? additionalContext.finishingPositionRange;
|
|
10264
|
+
const roundOfPlay = stage !== QUALIFYING && isConvertableInteger(initialRoundOfPlay) && initialRoundOfPlay + (roundNumber || 0);
|
|
10264
10265
|
const onlyDefined = (obj) => definedAttributes(obj, undefined, true);
|
|
10265
10266
|
const matchUpWithContext = {
|
|
10266
10267
|
...onlyDefined(context),
|
|
10267
10268
|
...onlyDefined({
|
|
10268
|
-
matchUpFormat:
|
|
10269
|
-
tieFormat:
|
|
10269
|
+
matchUpFormat: matchUpType === TEAM$1 ? undefined : matchUpFormat,
|
|
10270
|
+
tieFormat: matchUpType !== TEAM$1 ? undefined : tieFormat,
|
|
10270
10271
|
gender: collectionDefinition?.gender ?? event?.gender,
|
|
10271
|
-
roundOfPlay: stage !== QUALIFYING && isConvertableInteger(initialRoundOfPlay) && initialRoundOfPlay + (roundNumber || 0),
|
|
10272
10272
|
endDate: matchUp.endDate ?? endDate,
|
|
10273
10273
|
discipline: event?.discipline,
|
|
10274
10274
|
category: matchUpCategory,
|
|
@@ -10289,6 +10289,7 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
|
|
|
10289
10289
|
roundOffset,
|
|
10290
10290
|
structureId,
|
|
10291
10291
|
roundNumber,
|
|
10292
|
+
roundOfPlay,
|
|
10292
10293
|
feedRound,
|
|
10293
10294
|
roundName,
|
|
10294
10295
|
drawName,
|
|
@@ -15719,7 +15720,7 @@ const roundRobinGroups = {
|
|
|
15719
15720
|
};
|
|
15720
15721
|
|
|
15721
15722
|
function generateRoundRobin(params) {
|
|
15722
|
-
const { groupNameBase = 'Group', playoffAttributes, stageSequence = 1, structureOptions, appliedPolicies, seedingProfile, stage = MAIN, matchUpType, roundTarget, structureId, groupNames, drawSize, idPrefix, isMock, uuids, } = params;
|
|
15723
|
+
const { hasExistingDrawDefinition, groupNameBase = 'Group', playoffAttributes, stageSequence = 1, structureOptions, appliedPolicies, qualifyingOnly, seedingProfile, stage = MAIN, matchUpType, roundTarget, structureId, groupNames, tieFormat, drawSize, idPrefix, isMock, uuids, } = params;
|
|
15723
15724
|
const structureName = params.structureName ?? playoffAttributes?.['0']?.name ?? constantToString(MAIN);
|
|
15724
15725
|
const { groupCount, groupSize } = deriveGroups({
|
|
15725
15726
|
structureOptions,
|
|
@@ -15741,21 +15742,26 @@ function generateRoundRobin(params) {
|
|
|
15741
15742
|
const structureName = groupNames?.[structureOrder - 1] ?? `${groupNameBase} ${structureOrder}`;
|
|
15742
15743
|
return structureTemplate({
|
|
15743
15744
|
structureId: uuids?.pop(),
|
|
15745
|
+
hasExistingDrawDefinition,
|
|
15744
15746
|
structureType: ITEM,
|
|
15745
15747
|
finishingPosition,
|
|
15748
|
+
qualifyingOnly,
|
|
15746
15749
|
structureOrder,
|
|
15747
15750
|
structureName,
|
|
15751
|
+
tieFormat,
|
|
15748
15752
|
matchUps,
|
|
15749
15753
|
});
|
|
15750
15754
|
});
|
|
15751
15755
|
const structure = structureTemplate({
|
|
15752
15756
|
structureId: structureId ?? uuids?.pop(),
|
|
15757
|
+
hasExistingDrawDefinition,
|
|
15753
15758
|
structureType: CONTAINER,
|
|
15754
15759
|
finishingPosition,
|
|
15755
15760
|
seedingProfile,
|
|
15756
15761
|
structureName,
|
|
15757
15762
|
stageSequence,
|
|
15758
15763
|
structures,
|
|
15764
|
+
tieFormat,
|
|
15759
15765
|
stage,
|
|
15760
15766
|
});
|
|
15761
15767
|
if (roundTarget)
|
|
@@ -20078,6 +20084,38 @@ function generateQualifyingLink({ targetEntryRound = 1, finishingPositions, sour
|
|
|
20078
20084
|
return { link };
|
|
20079
20085
|
}
|
|
20080
20086
|
|
|
20087
|
+
function generateTieMatchUps({ matchUp, tieFormat, isMock, uuids }) {
|
|
20088
|
+
const { collectionDefinitions } = tieFormat ?? {};
|
|
20089
|
+
const tieMatchUps = (collectionDefinitions ?? [])
|
|
20090
|
+
.map((collectionDefinition) => generateCollectionMatchUps({ matchUp, collectionDefinition, uuids, isMock }))
|
|
20091
|
+
.filter(Boolean)
|
|
20092
|
+
.flat();
|
|
20093
|
+
return { tieMatchUps };
|
|
20094
|
+
}
|
|
20095
|
+
function generateCollectionMatchUps({ collectionPositionOffset = 0, collectionDefinition, matchUpsLimit, matchUp, isMock, uuids, }) {
|
|
20096
|
+
const { matchUpCount, matchUpType, collectionId, processCodes } = collectionDefinition || {};
|
|
20097
|
+
const numberToGenerate = matchUpsLimit ?? matchUpCount ?? 0;
|
|
20098
|
+
const getMatchUpId = (index) => {
|
|
20099
|
+
if (!isMock && !matchUp?.isMock)
|
|
20100
|
+
return uuids?.pop() ?? UUID();
|
|
20101
|
+
const collectionId = collectionDefinition?.collectionId;
|
|
20102
|
+
return uuids?.pop() ?? `${matchUp?.matchUpId}-${collectionId}-TMU-${index + 1}`;
|
|
20103
|
+
};
|
|
20104
|
+
return generateRange(0, numberToGenerate).map((index) => {
|
|
20105
|
+
const collectionPosition = collectionPositionOffset + index + 1;
|
|
20106
|
+
return {
|
|
20107
|
+
sides: [{ sideNumber: 1 }, { sideNumber: 2 }],
|
|
20108
|
+
matchUpId: getMatchUpId(index),
|
|
20109
|
+
matchUpStatus: TO_BE_PLAYED,
|
|
20110
|
+
collectionPosition,
|
|
20111
|
+
collectionId,
|
|
20112
|
+
processCodes,
|
|
20113
|
+
matchUpType,
|
|
20114
|
+
isMock,
|
|
20115
|
+
};
|
|
20116
|
+
});
|
|
20117
|
+
}
|
|
20118
|
+
|
|
20081
20119
|
function generateMatchUpId({ roundPosition, roundNumber, idPrefix, uuids }) {
|
|
20082
20120
|
return idPrefix ? `${idPrefix}-${roundNumber}-${roundPosition}` : uuids?.pop() || UUID();
|
|
20083
20121
|
}
|
|
@@ -20205,7 +20243,7 @@ function generateQualifyingStructure(params) {
|
|
|
20205
20243
|
return decorateResult({ result: { error: INVALID_VALUES }, stack });
|
|
20206
20244
|
}
|
|
20207
20245
|
let drawSize = params.drawSize ?? coerceEven(params.participantsCount);
|
|
20208
|
-
const { qualifyingRoundNumber, qualifyingPositions, targetStructureId, structureOptions, appliedPolicies, drawDefinition, matchUpFormat, structureName, structureId, roundTarget, drawType, idPrefix, isMock, uuids, } = params;
|
|
20246
|
+
const { hasExistingDrawDefinition, qualifyingRoundNumber, qualifyingPositions, targetStructureId, structureOptions, appliedPolicies, qualifyingOnly, drawDefinition, matchUpFormat, structureName, structureId, roundTarget, tieFormat, drawType, idPrefix, isMock, uuids, } = params;
|
|
20209
20247
|
if (!params.drawSize)
|
|
20210
20248
|
return decorateResult({
|
|
20211
20249
|
result: { error: MISSING_DRAW_SIZE },
|
|
@@ -20245,12 +20283,15 @@ function generateQualifyingStructure(params) {
|
|
|
20245
20283
|
const { maxRoundNumber, structures, groupCount } = generateRoundRobin({
|
|
20246
20284
|
structureName: structureName ?? qualifyingStructureName,
|
|
20247
20285
|
structureId: structureId ?? uuids?.pop(),
|
|
20286
|
+
hasExistingDrawDefinition,
|
|
20248
20287
|
stage: QUALIFYING,
|
|
20249
20288
|
structureOptions,
|
|
20250
20289
|
appliedPolicies,
|
|
20290
|
+
qualifyingOnly,
|
|
20251
20291
|
stageSequence,
|
|
20252
20292
|
matchUpType,
|
|
20253
20293
|
roundTarget,
|
|
20294
|
+
tieFormat,
|
|
20254
20295
|
idPrefix,
|
|
20255
20296
|
drawSize,
|
|
20256
20297
|
isMock,
|
|
@@ -20302,6 +20343,13 @@ function generateQualifyingStructure(params) {
|
|
|
20302
20343
|
finishingPositions,
|
|
20303
20344
|
linkType,
|
|
20304
20345
|
})?.link;
|
|
20346
|
+
if (tieFormat) {
|
|
20347
|
+
matchUps = getAllStructureMatchUps({ structure })?.matchUps || [];
|
|
20348
|
+
matchUps?.forEach((matchUp) => {
|
|
20349
|
+
const { tieMatchUps } = generateTieMatchUps({ tieFormat, matchUp, isMock });
|
|
20350
|
+
Object.assign(matchUp, { tieMatchUps, matchUpType });
|
|
20351
|
+
});
|
|
20352
|
+
}
|
|
20305
20353
|
return {
|
|
20306
20354
|
qualifyingDrawPositionsCount: drawSize,
|
|
20307
20355
|
qualifiersCount,
|
|
@@ -21518,38 +21566,6 @@ function generatePlayoffLink({ playoffStructureId, finishingPositions, sourceStr
|
|
|
21518
21566
|
};
|
|
21519
21567
|
}
|
|
21520
21568
|
|
|
21521
|
-
function generateTieMatchUps({ matchUp, tieFormat, isMock, uuids }) {
|
|
21522
|
-
const { collectionDefinitions } = tieFormat ?? {};
|
|
21523
|
-
const tieMatchUps = (collectionDefinitions ?? [])
|
|
21524
|
-
.map((collectionDefinition) => generateCollectionMatchUps({ matchUp, collectionDefinition, uuids, isMock }))
|
|
21525
|
-
.filter(Boolean)
|
|
21526
|
-
.flat();
|
|
21527
|
-
return { tieMatchUps };
|
|
21528
|
-
}
|
|
21529
|
-
function generateCollectionMatchUps({ collectionPositionOffset = 0, collectionDefinition, matchUpsLimit, matchUp, isMock, uuids, }) {
|
|
21530
|
-
const { matchUpCount, matchUpType, collectionId, processCodes } = collectionDefinition || {};
|
|
21531
|
-
const numberToGenerate = matchUpsLimit ?? matchUpCount ?? 0;
|
|
21532
|
-
const getMatchUpId = (index) => {
|
|
21533
|
-
if (!isMock && !matchUp?.isMock)
|
|
21534
|
-
return uuids?.pop() ?? UUID();
|
|
21535
|
-
const collectionId = collectionDefinition?.collectionId;
|
|
21536
|
-
return uuids?.pop() ?? `${matchUp?.matchUpId}-${collectionId}-TMU-${index + 1}`;
|
|
21537
|
-
};
|
|
21538
|
-
return generateRange(0, numberToGenerate).map((index) => {
|
|
21539
|
-
const collectionPosition = collectionPositionOffset + index + 1;
|
|
21540
|
-
return {
|
|
21541
|
-
sides: [{ sideNumber: 1 }, { sideNumber: 2 }],
|
|
21542
|
-
matchUpId: getMatchUpId(index),
|
|
21543
|
-
matchUpStatus: TO_BE_PLAYED,
|
|
21544
|
-
collectionPosition,
|
|
21545
|
-
collectionId,
|
|
21546
|
-
processCodes,
|
|
21547
|
-
matchUpType,
|
|
21548
|
-
isMock,
|
|
21549
|
-
};
|
|
21550
|
-
});
|
|
21551
|
-
}
|
|
21552
|
-
|
|
21553
21569
|
function generateAndPopulateRRplayoffStructures(params) {
|
|
21554
21570
|
const stack = 'generateAndPopulateRRplayoffStructures';
|
|
21555
21571
|
if (!params.playoffGroups) {
|
|
@@ -21591,11 +21607,7 @@ function generateAndPopulateRRplayoffStructures(params) {
|
|
|
21591
21607
|
const tieFormat = resolveTieFormat({ drawDefinition, event })?.tieFormat;
|
|
21592
21608
|
if (tieFormat) {
|
|
21593
21609
|
addedMatchUps.forEach((matchUp) => {
|
|
21594
|
-
const { tieMatchUps } = generateTieMatchUps({
|
|
21595
|
-
isMock: params.isMock,
|
|
21596
|
-
tieFormat,
|
|
21597
|
-
matchUp,
|
|
21598
|
-
});
|
|
21610
|
+
const { tieMatchUps } = generateTieMatchUps({ isMock: params.isMock, tieFormat, matchUp });
|
|
21599
21611
|
Object.assign(matchUp, { tieMatchUps, matchUpType: TEAM_MATCHUP });
|
|
21600
21612
|
});
|
|
21601
21613
|
}
|
|
@@ -27091,12 +27103,15 @@ function generateQualifyingStructures({ hasExistingDrawDefinition, qualifyingPro
|
|
|
27091
27103
|
const { structures, groupCount, maxRoundNumber } = generateRoundRobin({
|
|
27092
27104
|
structureName: structureProfile.structureName || qualifyingStructureName,
|
|
27093
27105
|
structureId: structureId || uuids?.pop(),
|
|
27106
|
+
hasExistingDrawDefinition,
|
|
27094
27107
|
stage: QUALIFYING,
|
|
27095
27108
|
structureOptions,
|
|
27096
27109
|
appliedPolicies,
|
|
27110
|
+
qualifyingOnly,
|
|
27097
27111
|
stageSequence,
|
|
27098
27112
|
matchUpType,
|
|
27099
27113
|
roundTarget,
|
|
27114
|
+
tieFormat,
|
|
27100
27115
|
drawSize,
|
|
27101
27116
|
idPrefix,
|
|
27102
27117
|
isMock,
|
|
@@ -27156,6 +27171,13 @@ function generateQualifyingStructures({ hasExistingDrawDefinition, qualifyingPro
|
|
|
27156
27171
|
linkType = drawType === ROUND_ROBIN ? POSITION : WINNER;
|
|
27157
27172
|
finalQualifyingStructureId = structure.structureId;
|
|
27158
27173
|
finalQualifyingRoundNumber = roundLimit;
|
|
27174
|
+
if (tieFormat) {
|
|
27175
|
+
matchUps = getAllStructureMatchUps({ structure })?.matchUps || [];
|
|
27176
|
+
matchUps?.forEach((matchUp) => {
|
|
27177
|
+
const { tieMatchUps } = generateTieMatchUps({ tieFormat, matchUp, isMock });
|
|
27178
|
+
Object.assign(matchUp, { tieMatchUps, matchUpType });
|
|
27179
|
+
});
|
|
27180
|
+
}
|
|
27159
27181
|
structures.push(structure);
|
|
27160
27182
|
stageSequence += 1;
|
|
27161
27183
|
}
|
|
@@ -27800,11 +27822,7 @@ function generateDrawTypeAndModifyDrawDefinition(params) {
|
|
|
27800
27822
|
if (tieFormat) {
|
|
27801
27823
|
matchUps?.forEach((matchUp) => {
|
|
27802
27824
|
if (!existingMatchUpIds.includes(matchUp.matchUpId)) {
|
|
27803
|
-
const { tieMatchUps } = generateTieMatchUps({
|
|
27804
|
-
tieFormat,
|
|
27805
|
-
matchUp,
|
|
27806
|
-
isMock,
|
|
27807
|
-
});
|
|
27825
|
+
const { tieMatchUps } = generateTieMatchUps({ tieFormat, matchUp, isMock });
|
|
27808
27826
|
Object.assign(matchUp, { tieMatchUps, matchUpType });
|
|
27809
27827
|
}
|
|
27810
27828
|
});
|
|
@@ -33146,7 +33164,7 @@ function checkTieFormat({ tieFormat }) {
|
|
|
33146
33164
|
return { tieFormat };
|
|
33147
33165
|
}
|
|
33148
33166
|
|
|
33149
|
-
function checkFormatScopeEquivalence({ tournamentRecord, drawDefinition, matchUpFormat, matchUpType, tieFormat, event, }) {
|
|
33167
|
+
function checkFormatScopeEquivalence({ existingQualifyingStructures, tournamentRecord, drawDefinition, matchUpFormat, matchUpType, tieFormat, event, }) {
|
|
33150
33168
|
if (matchUpFormat || tieFormat) {
|
|
33151
33169
|
const equivalentInScope = (matchUpFormat && event?.matchUpFormat === matchUpFormat) ||
|
|
33152
33170
|
(event?.tieFormat && tieFormat && JSON.stringify(event.tieFormat) === JSON.stringify(tieFormat));
|
|
@@ -33155,7 +33173,10 @@ function checkFormatScopeEquivalence({ tournamentRecord, drawDefinition, matchUp
|
|
|
33155
33173
|
const result = checkTieFormat({ tieFormat });
|
|
33156
33174
|
if (result.error)
|
|
33157
33175
|
return result;
|
|
33158
|
-
|
|
33176
|
+
const existingQualifyingTieFormats = existingQualifyingStructures?.every((structure) => structure.tieFormat);
|
|
33177
|
+
if (!existingQualifyingStructures?.length || existingQualifyingTieFormats) {
|
|
33178
|
+
drawDefinition.tieFormat = result.tieFormat ?? tieFormat;
|
|
33179
|
+
}
|
|
33159
33180
|
}
|
|
33160
33181
|
else if (matchUpFormat) {
|
|
33161
33182
|
const result = setMatchUpMatchUpFormat({
|
|
@@ -33323,10 +33344,17 @@ function existingPolicyDefinitions({ policyDefinitions, appliedPolicies, policie
|
|
|
33323
33344
|
}
|
|
33324
33345
|
|
|
33325
33346
|
function setUpDrawGeneration(params) {
|
|
33326
|
-
const { tournamentRecord,
|
|
33347
|
+
const { tournamentRecord, policyDefinitions, appliedPolicies, matchUpFormat, matchUpType, tieFormat, drawType, stack, event, } = params;
|
|
33327
33348
|
const existingDrawDefinition = params.drawId
|
|
33328
33349
|
? event?.drawDefinitions?.find((d) => d.drawId === params.drawId)
|
|
33329
33350
|
: undefined;
|
|
33351
|
+
const structureId = existingDrawDefinition?.structures?.find((structure) => structure.stage === MAIN && structure.stageSequence === 1)?.structureId;
|
|
33352
|
+
const existingQualifyingStructures = existingDrawDefinition
|
|
33353
|
+
? existingDrawDefinition.structures?.filter((structure) => structure.stage === QUALIFYING)
|
|
33354
|
+
: [];
|
|
33355
|
+
const existingQualifyingPlaceholderStructureId = existingQualifyingStructures?.length === 1 &&
|
|
33356
|
+
!existingQualifyingStructures[0].matchUps?.length &&
|
|
33357
|
+
existingQualifyingStructures[0].structureId;
|
|
33330
33358
|
if (existingDrawDefinition && drawType !== existingDrawDefinition.drawType)
|
|
33331
33359
|
existingDrawDefinition.drawType = drawType;
|
|
33332
33360
|
const drawDefinition = existingDrawDefinition ??
|
|
@@ -33336,6 +33364,7 @@ function setUpDrawGeneration(params) {
|
|
|
33336
33364
|
drawType,
|
|
33337
33365
|
});
|
|
33338
33366
|
const equivalenceResult = checkFormatScopeEquivalence({
|
|
33367
|
+
existingQualifyingStructures,
|
|
33339
33368
|
tournamentRecord,
|
|
33340
33369
|
drawDefinition,
|
|
33341
33370
|
matchUpFormat,
|
|
@@ -33348,13 +33377,6 @@ function setUpDrawGeneration(params) {
|
|
|
33348
33377
|
const attachmentResult = policyAttachment({ appliedPolicies, policyDefinitions, drawDefinition, stack });
|
|
33349
33378
|
if (attachmentResult.error)
|
|
33350
33379
|
return attachmentResult;
|
|
33351
|
-
const structureId = existingDrawDefinition?.structures?.find((structure) => structure.stage === MAIN && structure.stageSequence === 1)?.structureId;
|
|
33352
|
-
const existingQualifyingStructures = existingDrawDefinition
|
|
33353
|
-
? existingDrawDefinition.structures?.filter((structure) => structure.stage === QUALIFYING)
|
|
33354
|
-
: [];
|
|
33355
|
-
const existingQualifyingPlaceholderStructureId = existingQualifyingStructures?.length === 1 &&
|
|
33356
|
-
!existingQualifyingStructures[0].matchUps?.length &&
|
|
33357
|
-
existingQualifyingStructures[0].structureId;
|
|
33358
33380
|
return { drawDefinition, structureId, existingDrawDefinition, existingQualifyingPlaceholderStructureId };
|
|
33359
33381
|
}
|
|
33360
33382
|
|
|
@@ -58469,7 +58491,7 @@ function executeFunction(engine, method, params, methodName, engineType) {
|
|
|
58469
58491
|
const augmentedParams = params ? paramsMiddleware(tournamentRecords, params) : undefined;
|
|
58470
58492
|
if (augmentedParams?.error)
|
|
58471
58493
|
return augmentedParams;
|
|
58472
|
-
const result = invoke({
|
|
58494
|
+
const result = invoke$1({
|
|
58473
58495
|
params: augmentedParams,
|
|
58474
58496
|
tournamentRecords,
|
|
58475
58497
|
tournamentRecord,
|
|
@@ -58480,7 +58502,7 @@ function executeFunction(engine, method, params, methodName, engineType) {
|
|
|
58480
58502
|
engineLogging({ result, methodName, elapsed, params: paramsToLog, engineType });
|
|
58481
58503
|
return result;
|
|
58482
58504
|
}
|
|
58483
|
-
function invoke({ tournamentRecords, tournamentRecord, params, methodName, method }) {
|
|
58505
|
+
function invoke$1({ tournamentRecords, tournamentRecord, params, methodName, method }) {
|
|
58484
58506
|
if (getDevContext()) {
|
|
58485
58507
|
return method({ tournamentRecords, tournamentRecord, ...params });
|
|
58486
58508
|
}
|
|
@@ -58988,58 +59010,58 @@ const matchUpEngine = (() => {
|
|
|
58988
59010
|
}
|
|
58989
59011
|
return engine;
|
|
58990
59012
|
}
|
|
58991
|
-
importGovernors([scoreGovernor]);
|
|
59013
|
+
importGovernors(engine, [scoreGovernor]);
|
|
58992
59014
|
return engine;
|
|
58993
|
-
|
|
58994
|
-
|
|
58995
|
-
|
|
58996
|
-
|
|
58997
|
-
|
|
58998
|
-
|
|
59015
|
+
})();
|
|
59016
|
+
function importGovernors(engine, governors) {
|
|
59017
|
+
governors.forEach((governor) => {
|
|
59018
|
+
Object.keys(governor).forEach((methodName) => {
|
|
59019
|
+
engine[methodName] = (params) => {
|
|
59020
|
+
if (getDevContext()) {
|
|
59021
|
+
return invoke(engine, { params, governor, methodName });
|
|
59022
|
+
}
|
|
59023
|
+
else {
|
|
59024
|
+
try {
|
|
59025
|
+
return invoke(engine, { params, governor, methodName });
|
|
58999
59026
|
}
|
|
59000
|
-
|
|
59001
|
-
|
|
59002
|
-
|
|
59003
|
-
|
|
59004
|
-
|
|
59005
|
-
|
|
59006
|
-
|
|
59007
|
-
methodName,
|
|
59008
|
-
params,
|
|
59009
|
-
err,
|
|
59010
|
-
});
|
|
59011
|
-
}
|
|
59027
|
+
catch (err) {
|
|
59028
|
+
handleCaughtError({
|
|
59029
|
+
engineName: 'matchUpEngine',
|
|
59030
|
+
methodName,
|
|
59031
|
+
params,
|
|
59032
|
+
err,
|
|
59033
|
+
});
|
|
59012
59034
|
}
|
|
59013
|
-
}
|
|
59014
|
-
}
|
|
59035
|
+
}
|
|
59036
|
+
};
|
|
59015
59037
|
});
|
|
59038
|
+
});
|
|
59039
|
+
}
|
|
59040
|
+
function invoke(engine, { params, governor, methodName }) {
|
|
59041
|
+
engine.error = undefined;
|
|
59042
|
+
engine.success = false;
|
|
59043
|
+
const matchUp = params?.matchUp || getMatchUp();
|
|
59044
|
+
const matchUps = params?.matchUps || getMatchUps();
|
|
59045
|
+
const snapshot = params?.rollbackOnError && makeDeepCopy(matchUp, false, true);
|
|
59046
|
+
params = {
|
|
59047
|
+
...params,
|
|
59048
|
+
matchUpId: matchUp?.matchUpId,
|
|
59049
|
+
matchUps,
|
|
59050
|
+
matchUp,
|
|
59051
|
+
};
|
|
59052
|
+
const result = governor[methodName](params);
|
|
59053
|
+
if (result?.error) {
|
|
59054
|
+
if (snapshot)
|
|
59055
|
+
setState(snapshot);
|
|
59056
|
+
return { ...result, rolledBack: !!snapshot };
|
|
59016
59057
|
}
|
|
59017
|
-
|
|
59018
|
-
|
|
59019
|
-
|
|
59020
|
-
|
|
59021
|
-
|
|
59022
|
-
|
|
59023
|
-
|
|
59024
|
-
...params,
|
|
59025
|
-
matchUpId: matchUp?.matchUpId,
|
|
59026
|
-
matchUps,
|
|
59027
|
-
matchUp,
|
|
59028
|
-
};
|
|
59029
|
-
const result = governor[methodName](params);
|
|
59030
|
-
if (result?.error) {
|
|
59031
|
-
if (snapshot)
|
|
59032
|
-
setState(snapshot);
|
|
59033
|
-
return { ...result, rolledBack: !!snapshot };
|
|
59034
|
-
}
|
|
59035
|
-
const notify = result?.success && params?.delayNotify !== true && params?.doNotNotify !== true;
|
|
59036
|
-
if (notify)
|
|
59037
|
-
notifySubscribers();
|
|
59038
|
-
if (notify || !result?.success || params?.doNotNotify)
|
|
59039
|
-
deleteNotices();
|
|
59040
|
-
return result;
|
|
59041
|
-
}
|
|
59042
|
-
})();
|
|
59058
|
+
const notify = result?.success && params?.delayNotify !== true && params?.doNotNotify !== true;
|
|
59059
|
+
if (notify)
|
|
59060
|
+
notifySubscribers();
|
|
59061
|
+
if (notify || !result?.success || params?.doNotNotify)
|
|
59062
|
+
deleteNotices();
|
|
59063
|
+
return result;
|
|
59064
|
+
}
|
|
59043
59065
|
|
|
59044
59066
|
let devContextSet = false;
|
|
59045
59067
|
const mocksEngine = (() => {
|