tods-competition-factory 1.8.37 → 1.8.39
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/forge/generate.mjs +8 -6
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +4 -6
- package/dist/forge/query.mjs.map +1 -1
- package/dist/index.mjs +42 -17
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +61 -30
- 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
|
@@ -2929,7 +2929,7 @@ var matchUpFormatCode = {
|
|
|
2929
2929
|
};
|
|
2930
2930
|
|
|
2931
2931
|
function factoryVersion() {
|
|
2932
|
-
return '1.8.
|
|
2932
|
+
return '1.8.39';
|
|
2933
2933
|
}
|
|
2934
2934
|
|
|
2935
2935
|
function getObjectTieFormat(obj) {
|
|
@@ -22848,7 +22848,7 @@ function getDrawDefinition$1(_a) {
|
|
|
22848
22848
|
function bulkScheduleMatchUps$1(_a) {
|
|
22849
22849
|
var e_1, _b, e_2, _c;
|
|
22850
22850
|
var _d, _e, _f, _g;
|
|
22851
|
-
var _h = _a.
|
|
22851
|
+
var _h = _a.scheduleCompletedMatchUps, scheduleCompletedMatchUps = _h === void 0 ? false : _h, _j = _a.scheduleByeMatchUps, scheduleByeMatchUps = _j === void 0 ? false : _j, _k = _a.errorOnAnachronism, errorOnAnachronism = _k === void 0 ? false : _k, _l = _a.checkChronology, checkChronology = _l === void 0 ? true : _l, matchUpDependencies = _a.matchUpDependencies, tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord, matchUpDetails = _a.matchUpDetails, matchUpIds = _a.matchUpIds, schedule = _a.schedule;
|
|
22852
22852
|
if (!tournamentRecord)
|
|
22853
22853
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
22854
22854
|
if (!matchUpDetails && (!matchUpIds || !Array.isArray(matchUpIds)))
|
|
@@ -22875,19 +22875,23 @@ function bulkScheduleMatchUps$1(_a) {
|
|
|
22875
22875
|
}
|
|
22876
22876
|
// first organize matchUpIds by drawId
|
|
22877
22877
|
var drawIdMap = inContextMatchUps.reduce(function (drawIdMap, matchUp) {
|
|
22878
|
-
var matchUpId = matchUp.matchUpId, drawId = matchUp.drawId;
|
|
22879
|
-
if (
|
|
22880
|
-
|
|
22881
|
-
|
|
22882
|
-
|
|
22883
|
-
|
|
22878
|
+
var matchUpId = matchUp.matchUpId, drawId = matchUp.drawId, matchUpStatus = matchUp.matchUpStatus;
|
|
22879
|
+
if ((scheduleByeMatchUps || matchUpStatus !== BYE) &&
|
|
22880
|
+
(scheduleCompletedMatchUps ||
|
|
22881
|
+
!completedMatchUpStatuses.includes(matchUpStatus))) {
|
|
22882
|
+
if (drawIdMap[drawId]) {
|
|
22883
|
+
drawIdMap[drawId].push(matchUpId);
|
|
22884
|
+
}
|
|
22885
|
+
else {
|
|
22886
|
+
drawIdMap[drawId] = [matchUpId];
|
|
22887
|
+
}
|
|
22884
22888
|
}
|
|
22885
22889
|
return drawIdMap;
|
|
22886
22890
|
}, {});
|
|
22887
22891
|
var detailMatchUpIds = matchUpDetails === null || matchUpDetails === void 0 ? void 0 : matchUpDetails.map(function (detail) { return detail.matchUpId; });
|
|
22888
22892
|
try {
|
|
22889
|
-
for (var
|
|
22890
|
-
var drawId =
|
|
22893
|
+
for (var _m = __values(Object.keys(drawIdMap)), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
22894
|
+
var drawId = _o.value;
|
|
22891
22895
|
var drawDefinition = getDrawDefinition$1({
|
|
22892
22896
|
tournamentRecord: tournamentRecord,
|
|
22893
22897
|
drawId: drawId,
|
|
@@ -22941,7 +22945,7 @@ function bulkScheduleMatchUps$1(_a) {
|
|
|
22941
22945
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
22942
22946
|
finally {
|
|
22943
22947
|
try {
|
|
22944
|
-
if (
|
|
22948
|
+
if (_o && !_o.done && (_b = _m.return)) _b.call(_m);
|
|
22945
22949
|
}
|
|
22946
22950
|
finally { if (e_1) throw e_1.error; }
|
|
22947
22951
|
}
|
|
@@ -22952,7 +22956,7 @@ function bulkScheduleMatchUps$1(_a) {
|
|
|
22952
22956
|
function bulkScheduleMatchUps(_a) {
|
|
22953
22957
|
var e_1, _b;
|
|
22954
22958
|
var _c;
|
|
22955
|
-
var errorOnAnachronism = _a.errorOnAnachronism, matchUpContextIds = _a.matchUpContextIds, tournamentRecords = _a.tournamentRecords, checkChronology = _a.checkChronology, matchUpDetails = _a.matchUpDetails, schedule = _a.schedule;
|
|
22959
|
+
var _d = _a.scheduleCompletedMatchUps, scheduleCompletedMatchUps = _d === void 0 ? false : _d, _e = _a.scheduleByeMatchUps, scheduleByeMatchUps = _e === void 0 ? false : _e, errorOnAnachronism = _a.errorOnAnachronism, matchUpContextIds = _a.matchUpContextIds, tournamentRecords = _a.tournamentRecords, checkChronology = _a.checkChronology, matchUpDetails = _a.matchUpDetails, schedule = _a.schedule;
|
|
22956
22960
|
if (!tournamentRecords)
|
|
22957
22961
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
22958
22962
|
if (!Array.isArray(matchUpContextIds) && !Array.isArray(matchUpDetails))
|
|
@@ -22971,6 +22975,8 @@ function bulkScheduleMatchUps(_a) {
|
|
|
22971
22975
|
if ((matchUpIds === null || matchUpIds === void 0 ? void 0 : matchUpIds.length) || (tournamentMatchUpDetails === null || tournamentMatchUpDetails === void 0 ? void 0 : tournamentMatchUpDetails.length)) {
|
|
22972
22976
|
var result = bulkScheduleMatchUps$1({
|
|
22973
22977
|
matchUpDetails: tournamentMatchUpDetails,
|
|
22978
|
+
scheduleCompletedMatchUps: scheduleCompletedMatchUps,
|
|
22979
|
+
scheduleByeMatchUps: scheduleByeMatchUps,
|
|
22974
22980
|
matchUpDependencies: matchUpDependencies,
|
|
22975
22981
|
errorOnAnachronism: errorOnAnachronism,
|
|
22976
22982
|
tournamentRecords: tournamentRecords,
|
|
@@ -22988,8 +22994,8 @@ function bulkScheduleMatchUps(_a) {
|
|
|
22988
22994
|
}
|
|
22989
22995
|
};
|
|
22990
22996
|
try {
|
|
22991
|
-
for (var
|
|
22992
|
-
var tournamentRecord =
|
|
22997
|
+
for (var _f = __values(Object.values(tournamentRecords)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
22998
|
+
var tournamentRecord = _g.value;
|
|
22993
22999
|
var state_1 = _loop_1(tournamentRecord);
|
|
22994
23000
|
if (typeof state_1 === "object")
|
|
22995
23001
|
return state_1.value;
|
|
@@ -22998,7 +23004,7 @@ function bulkScheduleMatchUps(_a) {
|
|
|
22998
23004
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
22999
23005
|
finally {
|
|
23000
23006
|
try {
|
|
23001
|
-
if (
|
|
23007
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
23002
23008
|
}
|
|
23003
23009
|
finally { if (e_1) throw e_1.error; }
|
|
23004
23010
|
}
|
|
@@ -29391,12 +29397,17 @@ function getEventSeedAssignments(_a) {
|
|
|
29391
29397
|
}
|
|
29392
29398
|
|
|
29393
29399
|
function processEventEntry(_a) {
|
|
29394
|
-
var
|
|
29400
|
+
var convertExtensions = _a.convertExtensions, seedAssignments = _a.seedAssignments, participant = _a.participant, withSeeding = _a.withSeeding, seedValue = _a.seedValue, eventId = _a.eventId, ranking = _a.ranking, entry = _a.entry;
|
|
29395
29401
|
var entryStatus = entry.entryStatus, entryStage = entry.entryStage, entryPosition = entry.entryPosition, extensions = entry.extensions;
|
|
29396
|
-
var entryExtensions = (extensions === null || extensions === void 0 ? void 0 : extensions.length)
|
|
29402
|
+
var entryExtensions = (extensions === null || extensions === void 0 ? void 0 : extensions.length) && convertExtensions
|
|
29397
29403
|
? Object.assign.apply(Object, __spreadArray([{}], __read(extensionsToAttributes(extensions)), false)) : {};
|
|
29398
|
-
var attributes = Object.assign(entryExtensions,
|
|
29399
|
-
entryPosition: entryPosition,
|
|
29404
|
+
var attributes = Object.assign(entryExtensions, {
|
|
29405
|
+
entryPosition: entryPosition,
|
|
29406
|
+
entryStatus: entryStatus,
|
|
29407
|
+
entryStage: entryStage,
|
|
29408
|
+
ranking: ranking,
|
|
29409
|
+
eventId: eventId,
|
|
29410
|
+
});
|
|
29400
29411
|
participant.events[eventId] = definedAttributes(attributes, false, false, true);
|
|
29401
29412
|
if (withSeeding) {
|
|
29402
29413
|
if (seedAssignments)
|
|
@@ -29757,9 +29768,9 @@ function getParticipantEntries(params) {
|
|
|
29757
29768
|
if (publishStatuses)
|
|
29758
29769
|
eventsPublishStatuses[eventId] = publishStatuses;
|
|
29759
29770
|
if (withEvents || withSeeding || withRankingProfile) {
|
|
29760
|
-
var
|
|
29771
|
+
var extensionConversions = convertExtensions
|
|
29761
29772
|
? Object.assign.apply(Object, __spreadArray([{}], __read(extensionsToAttributes(extensions)), false)) : {};
|
|
29762
|
-
derivedEventInfo[eventId] = __assign(__assign({},
|
|
29773
|
+
derivedEventInfo[eventId] = __assign(__assign({}, extensionConversions), { eventName: eventName, eventType: eventType, category: category, eventId: eventId, gender: gender });
|
|
29763
29774
|
var scaleNames = [
|
|
29764
29775
|
category === null || category === void 0 ? void 0 : category.categoryName,
|
|
29765
29776
|
category === null || category === void 0 ? void 0 : category.ageCategoryCode,
|
|
@@ -29791,7 +29802,7 @@ function getParticipantEntries(params) {
|
|
|
29791
29802
|
return;
|
|
29792
29803
|
var participant = participantMap[id];
|
|
29793
29804
|
processEventEntry({
|
|
29794
|
-
|
|
29805
|
+
convertExtensions: convertExtensions,
|
|
29795
29806
|
seedAssignments: seedAssignments,
|
|
29796
29807
|
participant: participant,
|
|
29797
29808
|
withSeeding: withSeeding,
|
|
@@ -35244,10 +35255,15 @@ function processAlreadyScheduledMatchUps(_a) {
|
|
|
35244
35255
|
var e_1, _b;
|
|
35245
35256
|
var _c, _d;
|
|
35246
35257
|
var matchUpPotentialParticipantIds = _a.matchUpPotentialParticipantIds, individualParticipantProfiles = _a.individualParticipantProfiles, dateScheduledMatchUpIds = _a.dateScheduledMatchUpIds, greatestAverageMinutes = _a.greatestAverageMinutes, dateScheduledMatchUps = _a.dateScheduledMatchUps, matchUpNotBeforeTimes = _a.matchUpNotBeforeTimes, matchUpScheduleTimes = _a.matchUpScheduleTimes, matchUpDependencies = _a.matchUpDependencies, clearScheduleDates = _a.clearScheduleDates, scheduleDate = _a.scheduleDate, minutesMap = _a.minutesMap, matchUps = _a.matchUps;
|
|
35258
|
+
var byeScheduledMatchUpIds = [];
|
|
35247
35259
|
if (!dateScheduledMatchUpIds) {
|
|
35248
35260
|
dateScheduledMatchUps = matchUps === null || matchUps === void 0 ? void 0 : matchUps.filter(function (matchUp) {
|
|
35249
35261
|
var schedule = matchUp.schedule || {};
|
|
35250
|
-
|
|
35262
|
+
var isByeMatchUp = matchUp.matchUpStatus === BYE;
|
|
35263
|
+
if (isByeMatchUp)
|
|
35264
|
+
byeScheduledMatchUpIds.push(matchUp.matchUpId);
|
|
35265
|
+
return (!isByeMatchUp &&
|
|
35266
|
+
hasSchedule({ schedule: schedule }) &&
|
|
35251
35267
|
(!scheduleDate || matchUp.schedule.scheduledDate === scheduleDate));
|
|
35252
35268
|
});
|
|
35253
35269
|
dateScheduledMatchUpIds = dateScheduledMatchUps.map(getMatchUpId);
|
|
@@ -35298,7 +35314,12 @@ function processAlreadyScheduledMatchUps(_a) {
|
|
|
35298
35314
|
}
|
|
35299
35315
|
finally { if (e_1) throw e_1.error; }
|
|
35300
35316
|
}
|
|
35301
|
-
return {
|
|
35317
|
+
return {
|
|
35318
|
+
dateScheduledMatchUpIds: dateScheduledMatchUpIds,
|
|
35319
|
+
byeScheduledMatchUpIds: byeScheduledMatchUpIds,
|
|
35320
|
+
dateScheduledMatchUps: dateScheduledMatchUps,
|
|
35321
|
+
clearDate: clearDate,
|
|
35322
|
+
};
|
|
35302
35323
|
}
|
|
35303
35324
|
|
|
35304
35325
|
// groups schedule profile rounds where adjacent hashes are equivalent
|
|
@@ -35443,7 +35464,10 @@ function generateBookings(_a) {
|
|
|
35443
35464
|
(!scheduleDate || matchUp.schedule.scheduledDate === scheduleDate));
|
|
35444
35465
|
});
|
|
35445
35466
|
}
|
|
35446
|
-
var relevantMatchUps = dateScheduledMatchUps === null || dateScheduledMatchUps === void 0 ? void 0 : dateScheduledMatchUps.filter(function (matchUp) {
|
|
35467
|
+
var relevantMatchUps = dateScheduledMatchUps === null || dateScheduledMatchUps === void 0 ? void 0 : dateScheduledMatchUps.filter(function (matchUp) {
|
|
35468
|
+
return (!venueIds.length || venueIds.includes(matchUp.schedule.venueId)) &&
|
|
35469
|
+
matchUp.matchUpStatus !== BYE;
|
|
35470
|
+
});
|
|
35447
35471
|
var bookings = relevantMatchUps === null || relevantMatchUps === void 0 ? void 0 : relevantMatchUps.map(function (_a) {
|
|
35448
35472
|
var eventId = _a.eventId, schedule = _a.schedule, matchUpFormat = _a.matchUpFormat;
|
|
35449
35473
|
var _b = eventDetails[eventId], event = _b.event, scheduleTiming = _b.scheduleTiming;
|
|
@@ -35536,6 +35560,7 @@ function getVenueSchedulingDetails(_a) {
|
|
|
35536
35560
|
var venueScheduledRoundDetails = {};
|
|
35537
35561
|
// checking that matchUpDependencies is scoped to only those matchUps that are already or are to be scheduled on the same date
|
|
35538
35562
|
var allDateScheduledMatchUpIds = [];
|
|
35563
|
+
var allDateScheduledByeMatchUpIds = [];
|
|
35539
35564
|
var allDateMatchUpIds = [];
|
|
35540
35565
|
var _loop_1 = function (venue) {
|
|
35541
35566
|
var _d;
|
|
@@ -35584,8 +35609,10 @@ function getVenueSchedulingDetails(_a) {
|
|
|
35584
35609
|
minutesMap: minutesMap,
|
|
35585
35610
|
matchUps: matchUps,
|
|
35586
35611
|
});
|
|
35587
|
-
var clearDate = processResult.clearDate;
|
|
35588
35612
|
(dateScheduledMatchUpIds = processResult.dateScheduledMatchUpIds, dateScheduledMatchUps = processResult.dateScheduledMatchUps);
|
|
35613
|
+
var byeScheduledMatchUpIds = processResult.byeScheduledMatchUpIds, clearDate = processResult.clearDate;
|
|
35614
|
+
if (byeScheduledMatchUpIds === null || byeScheduledMatchUpIds === void 0 ? void 0 : byeScheduledMatchUpIds.length)
|
|
35615
|
+
allDateScheduledByeMatchUpIds.push.apply(allDateScheduledByeMatchUpIds, __spreadArray([], __read(byeScheduledMatchUpIds), false));
|
|
35589
35616
|
var _g = getMatchUpsToSchedule({
|
|
35590
35617
|
matchUpPotentialParticipantIds: matchUpPotentialParticipantIds,
|
|
35591
35618
|
scheduleCompletedMatchUps: scheduleCompletedMatchUps,
|
|
@@ -35629,6 +35656,7 @@ function getVenueSchedulingDetails(_a) {
|
|
|
35629
35656
|
finally { if (e_1) throw e_1.error; }
|
|
35630
35657
|
}
|
|
35631
35658
|
return {
|
|
35659
|
+
allDateScheduledByeMatchUpIds: allDateScheduledByeMatchUpIds,
|
|
35632
35660
|
allDateScheduledMatchUpIds: allDateScheduledMatchUpIds,
|
|
35633
35661
|
venueScheduledRoundDetails: venueScheduledRoundDetails,
|
|
35634
35662
|
allDateMatchUpIds: allDateMatchUpIds,
|
|
@@ -36265,7 +36293,7 @@ function proScheduler(_a) {
|
|
|
36265
36293
|
matchUps: matchUps,
|
|
36266
36294
|
courts: courts,
|
|
36267
36295
|
venues: venues,
|
|
36268
|
-
}), allDateScheduledMatchUpIds = _k.allDateScheduledMatchUpIds, venueScheduledRoundDetails = _k.venueScheduledRoundDetails, allDateMatchUpIds = _k.allDateMatchUpIds;
|
|
36296
|
+
}), allDateScheduledByeMatchUpIds = _k.allDateScheduledByeMatchUpIds, allDateScheduledMatchUpIds = _k.allDateScheduledMatchUpIds, venueScheduledRoundDetails = _k.venueScheduledRoundDetails, allDateMatchUpIds = _k.allDateMatchUpIds;
|
|
36269
36297
|
var dateScheduledMatchUps = matchUps.filter(function (_a) {
|
|
36270
36298
|
var matchUpId = _a.matchUpId;
|
|
36271
36299
|
return allDateScheduledMatchUpIds.includes(matchUpId);
|
|
@@ -36586,6 +36614,7 @@ function proScheduler(_a) {
|
|
|
36586
36614
|
}
|
|
36587
36615
|
finally { if (e_3) throw e_3.error; }
|
|
36588
36616
|
}
|
|
36617
|
+
if (!dryRun && (allDateScheduledByeMatchUpIds === null || allDateScheduledByeMatchUpIds === void 0 ? void 0 : allDateScheduledByeMatchUpIds.length)) ;
|
|
36589
36618
|
try {
|
|
36590
36619
|
for (var _l = (e_4 = void 0, __values(dateSchedulingProfile.venues)), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
36591
36620
|
var venue = _m.value;
|
|
@@ -37933,8 +37962,10 @@ function getRoundProfile(matchUps) {
|
|
|
37933
37962
|
return winningSide || completedMatchUpStatuses.includes(matchUpStatus);
|
|
37934
37963
|
}).length || 0;
|
|
37935
37964
|
var scheduledCount = matchUps.filter(function (_a) {
|
|
37936
|
-
var schedule = _a.schedule;
|
|
37937
|
-
return (schedule === null || schedule === void 0 ? void 0 : schedule.scheduledDate) &&
|
|
37965
|
+
var schedule = _a.schedule, matchUpStatus = _a.matchUpStatus;
|
|
37966
|
+
return (schedule === null || schedule === void 0 ? void 0 : schedule.scheduledDate) &&
|
|
37967
|
+
(schedule === null || schedule === void 0 ? void 0 : schedule.scheduledTime) &&
|
|
37968
|
+
matchUpStatus !== BYE;
|
|
37938
37969
|
}).length || 0;
|
|
37939
37970
|
var consideredCount = matchUpsCount - byeCount;
|
|
37940
37971
|
var isComplete = consideredCount === completedCount;
|
|
@@ -64472,7 +64503,7 @@ function generateDrawDefinition(params) {
|
|
|
64472
64503
|
tournamentRecord: tournamentRecord,
|
|
64473
64504
|
event: event,
|
|
64474
64505
|
}).appliedPolicies) !== null && _j !== void 0 ? _j : {};
|
|
64475
|
-
var policyDefinitions = (_k = params.policyDefinitions) !== null && _k !== void 0 ? _k : {};
|
|
64506
|
+
var policyDefinitions = makeDeepCopy((_k = params.policyDefinitions) !== null && _k !== void 0 ? _k : {}, false, true);
|
|
64476
64507
|
var drawTypeCoercion = (_q = (_o = (_l = params.drawTypeCoercion) !== null && _l !== void 0 ? _l : (_m = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_DRAWS]) === null || _m === void 0 ? void 0 : _m.drawTypeCoercion) !== null && _o !== void 0 ? _o : (_p = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_DRAWS]) === null || _p === void 0 ? void 0 : _p.drawTypeCoercion) !== null && _q !== void 0 ? _q : true;
|
|
64477
64508
|
var drawType = (drawTypeCoercion &&
|
|
64478
64509
|
params.drawSize === 2 &&
|