tods-competition-factory 1.7.7 → 1.7.8
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 +139 -138
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +139 -138
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +139 -88
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.d.ts +1 -1
- package/dist/forge/utilities.mjs +126 -75
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +268 -167
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +372 -250
- 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 +3 -3
package/dist/forge/generate.mjs
CHANGED
|
@@ -926,93 +926,6 @@ function getTopics() {
|
|
|
926
926
|
return _globalStateProvider.getTopics();
|
|
927
927
|
}
|
|
928
928
|
|
|
929
|
-
function isObject(obj) {
|
|
930
|
-
return typeof obj === "object";
|
|
931
|
-
}
|
|
932
|
-
const extractAttributes = (atz) => (o) => !atz || typeof o !== "object" ? void 0 : Array.isArray(atz) && atz.map((a) => ({ [a]: o[a] })) || typeof atz === "object" && Object.keys(atz).map((key) => ({ [key]: o[key] })) || typeof atz === "string" && getAttr(o, atz);
|
|
933
|
-
function getAttr(o, attr) {
|
|
934
|
-
const attrs = attr.split(".");
|
|
935
|
-
for (const a of attrs) {
|
|
936
|
-
o = o?.[a];
|
|
937
|
-
if (!o)
|
|
938
|
-
return;
|
|
939
|
-
}
|
|
940
|
-
return o;
|
|
941
|
-
}
|
|
942
|
-
function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
943
|
-
if (typeof obj !== "object" || obj === null)
|
|
944
|
-
return obj;
|
|
945
|
-
const deepCopy = deepCopyEnabled();
|
|
946
|
-
if (!deepCopy?.enabled)
|
|
947
|
-
shallow = true;
|
|
948
|
-
const ignoreValues = ["", void 0, null];
|
|
949
|
-
if (ignoreFalse)
|
|
950
|
-
ignoreValues.push(false);
|
|
951
|
-
const definedKeys = Object.keys(obj).filter(
|
|
952
|
-
(key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
|
|
953
|
-
);
|
|
954
|
-
return Object.assign(
|
|
955
|
-
{},
|
|
956
|
-
...definedKeys.map((key) => {
|
|
957
|
-
return Array.isArray(obj[key]) ? {
|
|
958
|
-
[key]: shallow ? obj[key] : obj[key].map((m) => definedAttributes(m))
|
|
959
|
-
} : { [key]: shallow ? obj[key] : definedAttributes(obj[key]) };
|
|
960
|
-
})
|
|
961
|
-
);
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
function attributeFilter(params) {
|
|
965
|
-
if (params === null)
|
|
966
|
-
return {};
|
|
967
|
-
const { source, template } = params || {};
|
|
968
|
-
if (!template)
|
|
969
|
-
return source;
|
|
970
|
-
const target = {};
|
|
971
|
-
attributeCopy(source, template, target);
|
|
972
|
-
return target;
|
|
973
|
-
function attributeCopy(valuesObject, templateObject, outputObject) {
|
|
974
|
-
if (!valuesObject || !templateObject)
|
|
975
|
-
return void 0;
|
|
976
|
-
const vKeys = Object.keys(valuesObject);
|
|
977
|
-
const oKeys = Object.keys(templateObject);
|
|
978
|
-
const orMap = Object.assign(
|
|
979
|
-
{},
|
|
980
|
-
...oKeys.filter((key) => key.indexOf("||")).map((key) => key.split("||").map((or) => ({ [or]: key }))).flat()
|
|
981
|
-
);
|
|
982
|
-
const allKeys = oKeys.concat(...Object.keys(orMap));
|
|
983
|
-
const wildcard = allKeys.includes("*");
|
|
984
|
-
for (const vKey of vKeys) {
|
|
985
|
-
if (allKeys.indexOf(vKey) >= 0 || wildcard) {
|
|
986
|
-
const templateKey = orMap[vKey] || vKey;
|
|
987
|
-
const tobj = templateObject[templateKey] || wildcard;
|
|
988
|
-
const vobj = valuesObject[vKey];
|
|
989
|
-
if (typeof tobj === "object" && typeof vobj !== "function" && !Array.isArray(tobj)) {
|
|
990
|
-
if (Array.isArray(vobj)) {
|
|
991
|
-
const mappedElements = vobj.map((arrayMember) => {
|
|
992
|
-
const target2 = {};
|
|
993
|
-
const result = attributeCopy(arrayMember, tobj, target2);
|
|
994
|
-
return result !== false ? target2 : void 0;
|
|
995
|
-
}).filter(Boolean);
|
|
996
|
-
outputObject[vKey] = mappedElements;
|
|
997
|
-
} else if (vobj) {
|
|
998
|
-
outputObject[vKey] = {};
|
|
999
|
-
attributeCopy(vobj, tobj, outputObject[vKey]);
|
|
1000
|
-
}
|
|
1001
|
-
} else {
|
|
1002
|
-
const value = valuesObject[vKey];
|
|
1003
|
-
const exclude = Array.isArray(tobj) && !tobj.includes(value);
|
|
1004
|
-
if (exclude)
|
|
1005
|
-
return false;
|
|
1006
|
-
if (templateObject[vKey] || wildcard && templateObject[vKey] !== false) {
|
|
1007
|
-
outputObject[vKey] = value;
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
return void 0;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
929
|
const validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
|
|
1017
930
|
const dateValidation = /^([\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1]))([ T](0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)?([.,][\d]{3})?Z?$/;
|
|
1018
931
|
|
|
@@ -1195,6 +1108,144 @@ function extensionsToAttributes(extensions) {
|
|
|
1195
1108
|
}).filter(Boolean);
|
|
1196
1109
|
}
|
|
1197
1110
|
|
|
1111
|
+
function getAccessorValue({ element, accessor }) {
|
|
1112
|
+
if (typeof accessor !== "string")
|
|
1113
|
+
return { values: [] };
|
|
1114
|
+
const targetElement = makeDeepCopy(element);
|
|
1115
|
+
const attributes = accessor.split(".");
|
|
1116
|
+
const values = [];
|
|
1117
|
+
let value;
|
|
1118
|
+
processKeys({ targetElement, attributes });
|
|
1119
|
+
const result = { value };
|
|
1120
|
+
if (values.length)
|
|
1121
|
+
result.values = values;
|
|
1122
|
+
return result;
|
|
1123
|
+
function processKeys({
|
|
1124
|
+
targetElement: targetElement2,
|
|
1125
|
+
attributes: attributes2 = [],
|
|
1126
|
+
significantCharacters
|
|
1127
|
+
}) {
|
|
1128
|
+
for (const [index, attribute] of attributes2.entries()) {
|
|
1129
|
+
if (targetElement2?.[attribute]) {
|
|
1130
|
+
const remainingKeys = attributes2.slice(index + 1);
|
|
1131
|
+
if (!remainingKeys.length) {
|
|
1132
|
+
if (!value)
|
|
1133
|
+
value = targetElement2[attribute];
|
|
1134
|
+
if (!values.includes(targetElement2[attribute])) {
|
|
1135
|
+
values.push(targetElement2[attribute]);
|
|
1136
|
+
}
|
|
1137
|
+
} else if (Array.isArray(targetElement2[attribute])) {
|
|
1138
|
+
const values2 = targetElement2[attribute];
|
|
1139
|
+
values2.forEach(
|
|
1140
|
+
(nestedTarget) => processKeys({
|
|
1141
|
+
targetElement: nestedTarget,
|
|
1142
|
+
attributes: remainingKeys
|
|
1143
|
+
})
|
|
1144
|
+
);
|
|
1145
|
+
} else {
|
|
1146
|
+
targetElement2 = targetElement2[attribute];
|
|
1147
|
+
checkValue({ targetElement: targetElement2, index });
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
function checkValue({ targetElement: targetElement3, index }) {
|
|
1152
|
+
if (targetElement3 && index === attributes2.length - 1 && ["string", "number"].includes(typeof targetElement3)) {
|
|
1153
|
+
const extractedValue = significantCharacters ? targetElement3.slice(0, significantCharacters) : targetElement3;
|
|
1154
|
+
if (value) {
|
|
1155
|
+
if (!values.includes(extractedValue)) {
|
|
1156
|
+
values.push(extractedValue);
|
|
1157
|
+
}
|
|
1158
|
+
} else {
|
|
1159
|
+
value = extractedValue;
|
|
1160
|
+
values.push(extractedValue);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
function isObject(obj) {
|
|
1168
|
+
return typeof obj === "object";
|
|
1169
|
+
}
|
|
1170
|
+
const extractAttributes = (accessor) => (element) => !accessor || typeof element !== "object" ? void 0 : Array.isArray(accessor) && accessor.map((a) => ({
|
|
1171
|
+
[a]: getAccessorValue({ element, accessor: a })?.value
|
|
1172
|
+
})) || typeof accessor === "object" && Object.keys(accessor).map((key) => ({
|
|
1173
|
+
[key]: getAccessorValue({ element, accessor: key })?.value
|
|
1174
|
+
})) || (typeof accessor === "string" && getAccessorValue({ element, accessor }))?.value;
|
|
1175
|
+
function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
1176
|
+
if (typeof obj !== "object" || obj === null)
|
|
1177
|
+
return obj;
|
|
1178
|
+
const deepCopy = deepCopyEnabled();
|
|
1179
|
+
if (!deepCopy?.enabled)
|
|
1180
|
+
shallow = true;
|
|
1181
|
+
const ignoreValues = ["", void 0, null];
|
|
1182
|
+
if (ignoreFalse)
|
|
1183
|
+
ignoreValues.push(false);
|
|
1184
|
+
const definedKeys = Object.keys(obj).filter(
|
|
1185
|
+
(key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
|
|
1186
|
+
);
|
|
1187
|
+
return Object.assign(
|
|
1188
|
+
{},
|
|
1189
|
+
...definedKeys.map((key) => {
|
|
1190
|
+
return Array.isArray(obj[key]) ? {
|
|
1191
|
+
[key]: shallow ? obj[key] : obj[key].map((m) => definedAttributes(m))
|
|
1192
|
+
} : { [key]: shallow ? obj[key] : definedAttributes(obj[key]) };
|
|
1193
|
+
})
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
function attributeFilter(params) {
|
|
1198
|
+
if (params === null)
|
|
1199
|
+
return {};
|
|
1200
|
+
const { source, template } = params || {};
|
|
1201
|
+
if (!template)
|
|
1202
|
+
return source;
|
|
1203
|
+
const target = {};
|
|
1204
|
+
attributeCopy(source, template, target);
|
|
1205
|
+
return target;
|
|
1206
|
+
function attributeCopy(valuesObject, templateObject, outputObject) {
|
|
1207
|
+
if (!valuesObject || !templateObject)
|
|
1208
|
+
return void 0;
|
|
1209
|
+
const vKeys = Object.keys(valuesObject);
|
|
1210
|
+
const oKeys = Object.keys(templateObject);
|
|
1211
|
+
const orMap = Object.assign(
|
|
1212
|
+
{},
|
|
1213
|
+
...oKeys.filter((key) => key.indexOf("||")).map((key) => key.split("||").map((or) => ({ [or]: key }))).flat()
|
|
1214
|
+
);
|
|
1215
|
+
const allKeys = oKeys.concat(...Object.keys(orMap));
|
|
1216
|
+
const wildcard = allKeys.includes("*");
|
|
1217
|
+
for (const vKey of vKeys) {
|
|
1218
|
+
if (allKeys.indexOf(vKey) >= 0 || wildcard) {
|
|
1219
|
+
const templateKey = orMap[vKey] || vKey;
|
|
1220
|
+
const tobj = templateObject[templateKey] || wildcard;
|
|
1221
|
+
const vobj = valuesObject[vKey];
|
|
1222
|
+
if (typeof tobj === "object" && typeof vobj !== "function" && !Array.isArray(tobj)) {
|
|
1223
|
+
if (Array.isArray(vobj)) {
|
|
1224
|
+
const mappedElements = vobj.map((arrayMember) => {
|
|
1225
|
+
const target2 = {};
|
|
1226
|
+
const result = attributeCopy(arrayMember, tobj, target2);
|
|
1227
|
+
return result !== false ? target2 : void 0;
|
|
1228
|
+
}).filter(Boolean);
|
|
1229
|
+
outputObject[vKey] = mappedElements;
|
|
1230
|
+
} else if (vobj) {
|
|
1231
|
+
outputObject[vKey] = {};
|
|
1232
|
+
attributeCopy(vobj, tobj, outputObject[vKey]);
|
|
1233
|
+
}
|
|
1234
|
+
} else {
|
|
1235
|
+
const value = valuesObject[vKey];
|
|
1236
|
+
const exclude = Array.isArray(tobj) && !tobj.includes(value);
|
|
1237
|
+
if (exclude)
|
|
1238
|
+
return false;
|
|
1239
|
+
if (templateObject[vKey] || wildcard && templateObject[vKey] !== false) {
|
|
1240
|
+
outputObject[vKey] = value;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
return void 0;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1198
1249
|
function numericSort(a, b) {
|
|
1199
1250
|
return a - b;
|
|
1200
1251
|
}
|
|
@@ -4256,7 +4307,7 @@ function isAdHoc({ drawDefinition, structure }) {
|
|
|
4256
4307
|
const hasDrawPosition = matchUps?.find(
|
|
4257
4308
|
(matchUp) => matchUp?.drawPositions?.length
|
|
4258
4309
|
);
|
|
4259
|
-
return !structure?.structures && !(drawDefinition?.drawType && drawDefinition.drawType !== AD_HOC) && !hasRoundPosition && !hasDrawPosition;
|
|
4310
|
+
return !structure?.structures && structure?.stage !== VOLUNTARY_CONSOLATION && !(drawDefinition?.drawType && drawDefinition.drawType !== AD_HOC) && !hasRoundPosition && !hasDrawPosition;
|
|
4260
4311
|
}
|
|
4261
4312
|
|
|
4262
4313
|
const POLICY_ROUND_NAMING_DEFAULT = {
|
|
@@ -17731,56 +17782,6 @@ function participantScheduledMatchUps({
|
|
|
17731
17782
|
return { scheduledMatchUps };
|
|
17732
17783
|
}
|
|
17733
17784
|
|
|
17734
|
-
function getAccessorValue({ element, accessor }) {
|
|
17735
|
-
if (typeof accessor !== "string")
|
|
17736
|
-
return { values: [] };
|
|
17737
|
-
const targetElement = makeDeepCopy(element);
|
|
17738
|
-
const attributes = accessor.split(".");
|
|
17739
|
-
const values = [];
|
|
17740
|
-
let value;
|
|
17741
|
-
processKeys({ targetElement, attributes });
|
|
17742
|
-
const result = { value };
|
|
17743
|
-
if (values.length)
|
|
17744
|
-
result.values = values;
|
|
17745
|
-
return result;
|
|
17746
|
-
function processKeys({
|
|
17747
|
-
targetElement: targetElement2,
|
|
17748
|
-
attributes: attributes2 = [],
|
|
17749
|
-
significantCharacters
|
|
17750
|
-
}) {
|
|
17751
|
-
for (const [index, attribute] of attributes2.entries()) {
|
|
17752
|
-
if (targetElement2?.[attribute]) {
|
|
17753
|
-
if (Array.isArray(targetElement2[attribute])) {
|
|
17754
|
-
const values2 = targetElement2[attribute];
|
|
17755
|
-
const remainingKeys = attributes2.slice(index);
|
|
17756
|
-
values2.forEach(
|
|
17757
|
-
(nestedTarget) => processKeys({
|
|
17758
|
-
targetElement: nestedTarget,
|
|
17759
|
-
attributes: remainingKeys
|
|
17760
|
-
})
|
|
17761
|
-
);
|
|
17762
|
-
} else {
|
|
17763
|
-
targetElement2 = targetElement2[attribute];
|
|
17764
|
-
checkValue({ targetElement: targetElement2, index });
|
|
17765
|
-
}
|
|
17766
|
-
}
|
|
17767
|
-
}
|
|
17768
|
-
function checkValue({ targetElement: targetElement3, index }) {
|
|
17769
|
-
if (targetElement3 && index === attributes2.length - 1 && ["string", "number"].includes(typeof targetElement3)) {
|
|
17770
|
-
const extractedValue = significantCharacters ? targetElement3.slice(0, significantCharacters) : targetElement3;
|
|
17771
|
-
if (value) {
|
|
17772
|
-
if (!values.includes(extractedValue)) {
|
|
17773
|
-
values.push(extractedValue);
|
|
17774
|
-
}
|
|
17775
|
-
} else {
|
|
17776
|
-
value = extractedValue;
|
|
17777
|
-
values.push(extractedValue);
|
|
17778
|
-
}
|
|
17779
|
-
}
|
|
17780
|
-
}
|
|
17781
|
-
}
|
|
17782
|
-
}
|
|
17783
|
-
|
|
17784
17785
|
function participantScaleItem({
|
|
17785
17786
|
requireTimeStamp,
|
|
17786
17787
|
scaleAttributes,
|