tods-competition-factory 1.8.12 → 1.8.14
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 -8
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +21 -13
- package/dist/forge/query.mjs +28 -23
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +42 -27
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +4 -4
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +318 -162
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +582 -314
- 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 +4 -4
package/dist/forge/transform.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function numericSort(a, b) {
|
|
2
|
+
return a - b;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
function ensureInt(val) {
|
|
2
6
|
if (typeof val === "number")
|
|
3
7
|
return parseInt(val.toString());
|
|
@@ -982,10 +986,6 @@ function attributeFilter(params) {
|
|
|
982
986
|
}
|
|
983
987
|
}
|
|
984
988
|
|
|
985
|
-
function numericSort(a, b) {
|
|
986
|
-
return a - b;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
989
|
function UUID() {
|
|
990
990
|
const lut = [];
|
|
991
991
|
for (let i = 0; i < 256; i++) {
|
|
@@ -1219,26 +1219,6 @@ function findEvent({
|
|
|
1219
1219
|
})
|
|
1220
1220
|
};
|
|
1221
1221
|
}
|
|
1222
|
-
function getDrawDefinition({ tournamentRecord, drawId }) {
|
|
1223
|
-
if (!tournamentRecord)
|
|
1224
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
1225
|
-
if (!drawId) {
|
|
1226
|
-
return { error: MISSING_DRAW_ID };
|
|
1227
|
-
}
|
|
1228
|
-
const target = (tournamentRecord.events || []).reduce((target2, event) => {
|
|
1229
|
-
const candidate = (event.drawDefinitions || []).reduce(
|
|
1230
|
-
(drawDefinition, candidate2) => {
|
|
1231
|
-
return candidate2.drawId === drawId ? candidate2 : drawDefinition;
|
|
1232
|
-
},
|
|
1233
|
-
void 0
|
|
1234
|
-
);
|
|
1235
|
-
return candidate && candidate.drawId === drawId ? { event, drawDefinition: candidate } : target2;
|
|
1236
|
-
}, void 0);
|
|
1237
|
-
return target ? { ...target, SUCCESS } : decorateResult({
|
|
1238
|
-
result: { error: DRAW_DEFINITION_NOT_FOUND },
|
|
1239
|
-
stack: "getDrawDefinition"
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1242
1222
|
|
|
1243
1223
|
function mustBeAnArray(value) {
|
|
1244
1224
|
return `${value} must be an array`;
|
|
@@ -10566,7 +10546,7 @@ function getMatchUpDependencies(params) {
|
|
|
10566
10546
|
const allTournamentRecords = Object.values(tournamentRecords);
|
|
10567
10547
|
const allLinks = allTournamentRecords.reduce(
|
|
10568
10548
|
(allLinks2, tournamentRecord2) => {
|
|
10569
|
-
return allLinks2.concat(tournamentRecord2.events
|
|
10549
|
+
return allLinks2.concat(tournamentRecord2.events ?? []).map(
|
|
10570
10550
|
(event) => (event.drawDefinitions || []).map(
|
|
10571
10551
|
(drawDefinition2) => drawDefinition2.links || []
|
|
10572
10552
|
)
|
|
@@ -10598,7 +10578,7 @@ function getMatchUpDependencies(params) {
|
|
|
10598
10578
|
for (const sourceStructureId of sourceStructureIds) {
|
|
10599
10579
|
positionDependencies[sourceStructureId] = [];
|
|
10600
10580
|
}
|
|
10601
|
-
for (const matchUp of matchUps
|
|
10581
|
+
for (const matchUp of matchUps ?? []) {
|
|
10602
10582
|
const sourceStructureId = matchUp.containerStructureId || matchUp.structureId;
|
|
10603
10583
|
if (sourceStructureIds.includes(sourceStructureId)) {
|
|
10604
10584
|
positionDependencies[sourceStructureId].push(matchUp.matchUpId);
|
|
@@ -16999,6 +16979,41 @@ const hasSchedule = ({
|
|
|
16999
16979
|
return !!matchUpScheduleKeys.length;
|
|
17000
16980
|
};
|
|
17001
16981
|
|
|
16982
|
+
function getDrawDefinition({
|
|
16983
|
+
tournamentRecords,
|
|
16984
|
+
tournamentRecord,
|
|
16985
|
+
tournamentId,
|
|
16986
|
+
drawId
|
|
16987
|
+
}) {
|
|
16988
|
+
if (!tournamentRecord && !tournamentRecords)
|
|
16989
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
16990
|
+
if (!drawId)
|
|
16991
|
+
return { error: MISSING_DRAW_ID };
|
|
16992
|
+
if (!tournamentRecord && tournamentRecords) {
|
|
16993
|
+
if (typeof tournamentId !== "string") {
|
|
16994
|
+
tournamentId = findTournamentId({ tournamentRecords, drawId });
|
|
16995
|
+
if (!tournamentId)
|
|
16996
|
+
return { error: MISSING_TOURNAMENT_ID };
|
|
16997
|
+
}
|
|
16998
|
+
tournamentRecord = tournamentRecords[tournamentId];
|
|
16999
|
+
if (!tournamentRecord)
|
|
17000
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
17001
|
+
}
|
|
17002
|
+
const result = tournamentRecord && findEvent({ tournamentRecord, drawId });
|
|
17003
|
+
if (!result?.drawDefinition) {
|
|
17004
|
+
return decorateResult({
|
|
17005
|
+
result: { error: DRAW_DEFINITION_NOT_FOUND },
|
|
17006
|
+
stack: "getDrawDefinition"
|
|
17007
|
+
});
|
|
17008
|
+
}
|
|
17009
|
+
return {
|
|
17010
|
+
drawDefinition: result.drawDefinition,
|
|
17011
|
+
event: result.event,
|
|
17012
|
+
tournamentRecord,
|
|
17013
|
+
...SUCCESS
|
|
17014
|
+
};
|
|
17015
|
+
}
|
|
17016
|
+
|
|
17002
17017
|
function getTournamentInfo({ tournamentRecord }) {
|
|
17003
17018
|
if (!tournamentRecord)
|
|
17004
17019
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -17191,7 +17206,7 @@ function bulkRescheduleMatchUps$1({
|
|
|
17191
17206
|
const updatedInContext = allTournamentMatchUps({
|
|
17192
17207
|
matchUpFilters: { matchUpIds },
|
|
17193
17208
|
tournamentRecord
|
|
17194
|
-
}).matchUps
|
|
17209
|
+
}).matchUps ?? [];
|
|
17195
17210
|
const rescheduled = updatedInContext.filter(
|
|
17196
17211
|
({ matchUpId }) => rescheduledMatchUpIds.includes(matchUpId)
|
|
17197
17212
|
);
|