tods-competition-factory 1.8.8 → 1.8.10
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 +6 -15
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +2 -2
- package/dist/forge/query.mjs +11 -16
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +2 -2
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +13 -19
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +51 -56
- 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 +1 -1
package/dist/forge/query.d.ts
CHANGED
|
@@ -1660,6 +1660,7 @@ type GetPolicyDefinitionsArgs = {
|
|
|
1660
1660
|
declare function getPolicyDefinitions({ policyTypes, tournamentRecord, drawDefinition, structure, event, }: GetPolicyDefinitionsArgs): {
|
|
1661
1661
|
policyDefinitions?: PolicyDefinitions;
|
|
1662
1662
|
error?: ErrorType;
|
|
1663
|
+
info?: string;
|
|
1663
1664
|
};
|
|
1664
1665
|
|
|
1665
1666
|
type ResultType = {
|
|
@@ -2133,9 +2134,8 @@ interface ParticipantScaleItemArgs {
|
|
|
2133
2134
|
requireTimeStamp?: boolean;
|
|
2134
2135
|
participant: Participant;
|
|
2135
2136
|
}
|
|
2136
|
-
declare function participantScaleItem({ requireTimeStamp, scaleAttributes, participant, }: ParticipantScaleItemArgs): {
|
|
2137
|
+
declare function participantScaleItem({ requireTimeStamp, scaleAttributes, participant, }: ParticipantScaleItemArgs): ResultType & {
|
|
2137
2138
|
scaleItem?: ScaleItem;
|
|
2138
|
-
error?: ErrorType;
|
|
2139
2139
|
};
|
|
2140
2140
|
|
|
2141
2141
|
type GetValidGroupSizesArgs = {
|
package/dist/forge/query.mjs
CHANGED
|
@@ -289,10 +289,6 @@ const INVALID_SCALE_ITEM = {
|
|
|
289
289
|
message: "Invalid scaleItem",
|
|
290
290
|
code: "ERR_INVALID_SCALE_ITEM"
|
|
291
291
|
};
|
|
292
|
-
const SCALE_ITEM_NOT_FOUND = {
|
|
293
|
-
message: "No scaleItem found",
|
|
294
|
-
code: "ERR_NOT_FOUND_SCALE_ITEM"
|
|
295
|
-
};
|
|
296
292
|
const INVALID_OBJECT = {
|
|
297
293
|
message: "Invalid object",
|
|
298
294
|
code: "ERR_INVALID_OBJECT"
|
|
@@ -976,7 +972,7 @@ function getPolicyDefinitions({
|
|
|
976
972
|
if (policy)
|
|
977
973
|
policyDefinitions[policyType] = policy;
|
|
978
974
|
}
|
|
979
|
-
return Object.keys(policyDefinitions).length ? { policyDefinitions } : {
|
|
975
|
+
return Object.keys(policyDefinitions).length ? { policyDefinitions } : { info: POLICY_NOT_FOUND.message };
|
|
980
976
|
}
|
|
981
977
|
|
|
982
978
|
const RANKING = "RANKING";
|
|
@@ -1723,7 +1719,7 @@ function findPolicy({
|
|
|
1723
1719
|
structure,
|
|
1724
1720
|
event
|
|
1725
1721
|
});
|
|
1726
|
-
return appliedPolicies?.[policyType] ? { policy: appliedPolicies[policyType] } : {
|
|
1722
|
+
return appliedPolicies?.[policyType] ? { policy: appliedPolicies[policyType] } : { info: POLICY_NOT_FOUND?.message };
|
|
1727
1723
|
}
|
|
1728
1724
|
|
|
1729
1725
|
function getScheduleTiming({
|
|
@@ -11106,7 +11102,11 @@ function getRounds({
|
|
|
11106
11102
|
const keepComplete = !excludeCompletedRounds || !isComplete;
|
|
11107
11103
|
const keepScheduled = !excludeScheduledRounds || !isScheduled;
|
|
11108
11104
|
const event = venueId || scheduleDate ? events?.find(({ eventId }) => eventId === round.eventId) : void 0;
|
|
11109
|
-
const
|
|
11105
|
+
const startDate = event?.startDate || tournamentRecord?.startDate;
|
|
11106
|
+
const endDate = event?.endDate || tournamentRecord?.endDate;
|
|
11107
|
+
const validStartDate = !scheduleDate || !startDate || new Date(scheduleDate) >= new Date(startDate);
|
|
11108
|
+
const validEndDate = !scheduleDate || !endDate || new Date(scheduleDate) <= new Date(endDate);
|
|
11109
|
+
const validDate = validStartDate && validEndDate;
|
|
11110
11110
|
const validVenue = !venueId || event?.validVenueIds.includes(venueId);
|
|
11111
11111
|
const keepRound = keepComplete && keepScheduled && validVenue && validDate;
|
|
11112
11112
|
if (!keepRound)
|
|
@@ -11244,7 +11244,7 @@ function participantScaleItem({
|
|
|
11244
11244
|
return { error: INVALID_VALUES };
|
|
11245
11245
|
if (!participant.timeItems)
|
|
11246
11246
|
participant.timeItems = [];
|
|
11247
|
-
if (
|
|
11247
|
+
if (Array.isArray(participant.timeItems)) {
|
|
11248
11248
|
const { accessor, scaleType, eventType, scaleName } = scaleAttributes;
|
|
11249
11249
|
const filterType = [SCALE, scaleType, eventType, scaleName].join(".");
|
|
11250
11250
|
const filteredTimeItems = participant.timeItems.filter((timeItem2) => timeItem2?.itemType === filterType).filter((timeItem2) => !requireTimeStamp || timeItem2?.itemDate).sort(
|
|
@@ -11264,12 +11264,10 @@ function participantScaleItem({
|
|
|
11264
11264
|
scaleName: scaleName2,
|
|
11265
11265
|
scaleType: scaleType2
|
|
11266
11266
|
};
|
|
11267
|
-
return { scaleItem };
|
|
11268
|
-
} else {
|
|
11269
|
-
return { error: SCALE_ITEM_NOT_FOUND };
|
|
11267
|
+
return { ...SUCCESS, scaleItem };
|
|
11270
11268
|
}
|
|
11271
11269
|
}
|
|
11272
|
-
return {
|
|
11270
|
+
return { ...SUCCESS, scaleItem: void 0 };
|
|
11273
11271
|
}
|
|
11274
11272
|
|
|
11275
11273
|
function addFinishingRounds({
|
|
@@ -12090,8 +12088,6 @@ function getParticipantEntries(params) {
|
|
|
12090
12088
|
participantMap,
|
|
12091
12089
|
withPotentialMatchUps,
|
|
12092
12090
|
withRankingProfile,
|
|
12093
|
-
withScheduleTimes,
|
|
12094
|
-
withScheduleItems,
|
|
12095
12091
|
scheduleAnalysis,
|
|
12096
12092
|
withTeamMatchUps,
|
|
12097
12093
|
withStatistics,
|
|
@@ -12101,8 +12097,7 @@ function getParticipantEntries(params) {
|
|
|
12101
12097
|
withEvents,
|
|
12102
12098
|
withDraws
|
|
12103
12099
|
} = params;
|
|
12104
|
-
|
|
12105
|
-
console.log({ withScheduleItems });
|
|
12100
|
+
const withScheduleTimes = params.withScheduleTimes ?? params.withScheduleItems;
|
|
12106
12101
|
const targetParticipantIds = participantFilters?.participantIds;
|
|
12107
12102
|
const getRelevantParticipantIds = (participantId) => {
|
|
12108
12103
|
const relevantParticipantIds = [participantId];
|