tods-competition-factory 1.9.1 → 1.9.2
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 +4 -16
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +0 -11
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +4 -16
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +0 -22
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +52 -55
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +66 -92
- 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 +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1360,7 +1360,6 @@ function handleCaughtError$1({
|
|
|
1360
1360
|
const globalState = {
|
|
1361
1361
|
tournamentFactoryVersion: "0.0.0",
|
|
1362
1362
|
timers: { default: { elapsedTime: 0 } },
|
|
1363
|
-
iterators: { makeDeepCopy: 0 },
|
|
1364
1363
|
deepCopyAttributes: {
|
|
1365
1364
|
stringify: [],
|
|
1366
1365
|
ignore: [],
|
|
@@ -1437,12 +1436,6 @@ function setGlobalLog(loggingFx) {
|
|
|
1437
1436
|
function setDevContext(value) {
|
|
1438
1437
|
globalState.devContext = value;
|
|
1439
1438
|
}
|
|
1440
|
-
function setDeepCopyIterations(value) {
|
|
1441
|
-
globalState.iterators.makeDeepCopy = value;
|
|
1442
|
-
}
|
|
1443
|
-
function getDeepCopyIterations() {
|
|
1444
|
-
return globalState.iterators.makeDeepCopy;
|
|
1445
|
-
}
|
|
1446
1439
|
function disableNotifications() {
|
|
1447
1440
|
_globalStateProvider.disableNotifications();
|
|
1448
1441
|
}
|
|
@@ -1538,7 +1531,13 @@ function handleCaughtError({
|
|
|
1538
1531
|
}
|
|
1539
1532
|
function globalLog$1(engine, log) {
|
|
1540
1533
|
if (globalState.globalLog) {
|
|
1541
|
-
|
|
1534
|
+
try {
|
|
1535
|
+
globalState.globalLog(engine, log);
|
|
1536
|
+
} catch (error) {
|
|
1537
|
+
console.log("globalLog error", error);
|
|
1538
|
+
console.log(engine, log);
|
|
1539
|
+
setGlobalLog();
|
|
1540
|
+
}
|
|
1542
1541
|
} else {
|
|
1543
1542
|
console.log(engine, log);
|
|
1544
1543
|
}
|
|
@@ -1869,13 +1868,6 @@ function makeDeepCopy(sourceObject, convertExtensions, internalUse, removeExtens
|
|
|
1869
1868
|
if (!deepCopy?.enabled && !internalUse || typeof sourceObject !== "object" || typeof sourceObject === "function" || sourceObject === null || typeof deepCopy?.threshold === "number" && iteration >= deepCopy.threshold) {
|
|
1870
1869
|
return sourceObject;
|
|
1871
1870
|
}
|
|
1872
|
-
const devContext = getDevContext({ makeDeepCopy: true });
|
|
1873
|
-
if (devContext) {
|
|
1874
|
-
setDeepCopyIterations(iteration);
|
|
1875
|
-
if (typeof devContext === "object" && (iteration > (devContext.iterationThreshold || 15) || devContext.firstIteration && iteration === 0) && devContext.log && (!devContext.notInternalUse || devContext.notInternalUse && !internalUse)) {
|
|
1876
|
-
console.log({ devContext, iteration, internalUse }, sourceObject);
|
|
1877
|
-
}
|
|
1878
|
-
}
|
|
1879
1871
|
const targetObject = Array.isArray(sourceObject) ? [] : {};
|
|
1880
1872
|
const sourceObjectKeys = Object.keys(sourceObject).filter(
|
|
1881
1873
|
(key) => !internalUse || !ignore || Array.isArray(ignore) && !ignore.includes(key) || typeof ignore === "function" && !ignore(key)
|
|
@@ -2422,7 +2414,7 @@ const matchUpFormatCode = {
|
|
|
2422
2414
|
};
|
|
2423
2415
|
|
|
2424
2416
|
function factoryVersion() {
|
|
2425
|
-
return "1.9.
|
|
2417
|
+
return "1.9.2";
|
|
2426
2418
|
}
|
|
2427
2419
|
|
|
2428
2420
|
function getObjectTieFormat(obj) {
|
|
@@ -10336,11 +10328,10 @@ function modifyMatchUpScore({
|
|
|
10336
10328
|
}
|
|
10337
10329
|
if (Array.isArray(defaultedProcessCodes) && inContextMatchUp && !inContextMatchUp.sides?.every(({ participantId }) => participantId)) {
|
|
10338
10330
|
if (matchUpStatus === DEFAULTED) {
|
|
10339
|
-
|
|
10340
|
-
matchUp.processCodes
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
}
|
|
10331
|
+
matchUp.processCodes = unique([
|
|
10332
|
+
...matchUp.processCodes ?? [],
|
|
10333
|
+
...defaultedProcessCodes
|
|
10334
|
+
]);
|
|
10344
10335
|
} else {
|
|
10345
10336
|
for (const processCode of defaultedProcessCodes || []) {
|
|
10346
10337
|
const codeIndex = processCode && matchUp?.processCodes?.lastIndexOf(processCode);
|
|
@@ -26538,6 +26529,34 @@ function updateFactoryExtension({ tournamentRecord, value }) {
|
|
|
26538
26529
|
addExtension$1({ element: tournamentRecord, extension: updatedExtension });
|
|
26539
26530
|
}
|
|
26540
26531
|
|
|
26532
|
+
function engineLogging({
|
|
26533
|
+
methodName,
|
|
26534
|
+
elapsed,
|
|
26535
|
+
engine,
|
|
26536
|
+
params,
|
|
26537
|
+
result
|
|
26538
|
+
}) {
|
|
26539
|
+
const devContext = getDevContext();
|
|
26540
|
+
if (typeof devContext !== "object")
|
|
26541
|
+
return;
|
|
26542
|
+
const log = { method: methodName };
|
|
26543
|
+
const logError = result?.error && (devContext.errors === true || Array.isArray(devContext.errors) && devContext.errors.includes(methodName));
|
|
26544
|
+
const specifiedMethodParams = Array.isArray(devContext.params) && devContext.params?.includes(methodName);
|
|
26545
|
+
const logParams = devContext.params && !Array.isArray(devContext.params) || specifiedMethodParams;
|
|
26546
|
+
const exclude = Array.isArray(devContext.exclude) && devContext.exclude.includes(methodName);
|
|
26547
|
+
if (!exclude && ![void 0, false].includes(devContext.perf) && (isNaN(devContext.perf) || elapsed > devContext.perf)) {
|
|
26548
|
+
log.elapsed = elapsed;
|
|
26549
|
+
}
|
|
26550
|
+
if (!exclude && (logError || logParams)) {
|
|
26551
|
+
log.params = params;
|
|
26552
|
+
}
|
|
26553
|
+
if (!exclude && (logError || devContext.result && !Array.isArray(devContext.result) && (!Array.isArray(devContext.params) || specifiedMethodParams) || Array.isArray(devContext.result) && devContext.result?.includes(methodName))) {
|
|
26554
|
+
log.result = result;
|
|
26555
|
+
}
|
|
26556
|
+
if (Object.keys(log).length > 1)
|
|
26557
|
+
globalLog$1(engine, log);
|
|
26558
|
+
}
|
|
26559
|
+
|
|
26541
26560
|
function notifySubscribers(params) {
|
|
26542
26561
|
const { mutationStatus, tournamentId, directives, timeStamp } = params || {};
|
|
26543
26562
|
const { topics } = getTopics();
|
|
@@ -40664,27 +40683,6 @@ function setState$4(records, deepCopyOption = true) {
|
|
|
40664
40683
|
return setTournamentRecords(deepCopyOption ? makeDeepCopy(records) : records);
|
|
40665
40684
|
}
|
|
40666
40685
|
|
|
40667
|
-
function engineLogging({ result, methodName, elapsed, params, engine }) {
|
|
40668
|
-
const devContext = getDevContext();
|
|
40669
|
-
const log = { method: methodName };
|
|
40670
|
-
const logError = result?.error && (devContext.errors === true || Array.isArray(devContext.errors) && devContext.errors.includes(methodName));
|
|
40671
|
-
const specifiedMethodParams = Array.isArray(devContext.params) && devContext.params?.includes(methodName);
|
|
40672
|
-
const logParams = devContext.params && !Array.isArray(devContext.params) || specifiedMethodParams;
|
|
40673
|
-
const exclude = Array.isArray(devContext.exclude) && devContext.exclude.includes(methodName);
|
|
40674
|
-
if (!exclude && ![void 0, false].includes(devContext.perf) && (isNaN(devContext.perf) || elapsed > devContext.perf))
|
|
40675
|
-
log.elapsed = elapsed;
|
|
40676
|
-
if (!exclude && (logError || logParams)) {
|
|
40677
|
-
log.params = params;
|
|
40678
|
-
}
|
|
40679
|
-
if (!exclude && (logError || devContext.result && !Array.isArray(devContext.result) && (!Array.isArray(devContext.params) || specifiedMethodParams) || Array.isArray(devContext.result) && devContext.result?.includes(methodName))) {
|
|
40680
|
-
log.result = result;
|
|
40681
|
-
}
|
|
40682
|
-
if (Object.keys(log).length > 1)
|
|
40683
|
-
globalLog$1(engine, log);
|
|
40684
|
-
if (result && devContext.makeDeepCopy)
|
|
40685
|
-
result.deepCopyIterations = getDeepCopyIterations();
|
|
40686
|
-
}
|
|
40687
|
-
|
|
40688
40686
|
const competitionEngine = function() {
|
|
40689
40687
|
const engine = {
|
|
40690
40688
|
getState: (params) => getState$3({
|
|
@@ -40816,6 +40814,7 @@ const competitionEngine = function() {
|
|
|
40816
40814
|
return { error: INVALID_VALUES };
|
|
40817
40815
|
const tournamentRecords = getTournamentRecords();
|
|
40818
40816
|
const activeTournamentId = getTournamentId();
|
|
40817
|
+
const start = Date.now();
|
|
40819
40818
|
const snapshot = rollbackOnError && makeDeepCopy(tournamentRecords, false, true);
|
|
40820
40819
|
let timeStamp;
|
|
40821
40820
|
const results = [];
|
|
@@ -40825,10 +40824,8 @@ const competitionEngine = function() {
|
|
|
40825
40824
|
const { method: methodName, params } = directive;
|
|
40826
40825
|
if (!engine[methodName]) {
|
|
40827
40826
|
const result3 = { error: METHOD_NOT_FOUND, methodName };
|
|
40828
|
-
const
|
|
40829
|
-
|
|
40830
|
-
console.log("ce:", result3);
|
|
40831
|
-
}
|
|
40827
|
+
const elapsed = Date.now() - start;
|
|
40828
|
+
engineLogging({ result: result3, methodName, elapsed, params, engine: "ce:" });
|
|
40832
40829
|
return result3;
|
|
40833
40830
|
}
|
|
40834
40831
|
const result2 = executeFunction(
|
|
@@ -56513,11 +56510,12 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
56513
56510
|
}
|
|
56514
56511
|
if (substitution || side.substitutions?.length === 1) {
|
|
56515
56512
|
if (substitution) {
|
|
56516
|
-
|
|
56517
|
-
|
|
56518
|
-
|
|
56519
|
-
|
|
56520
|
-
|
|
56513
|
+
if (substitutionProcessCodes && tieMatchUp) {
|
|
56514
|
+
tieMatchUp.processCodes = unique([
|
|
56515
|
+
...tieMatchUp?.processCodes ?? [],
|
|
56516
|
+
...substitutionProcessCodes
|
|
56517
|
+
]);
|
|
56518
|
+
}
|
|
56521
56519
|
} else {
|
|
56522
56520
|
for (const substitutionProcessCode of substitutionProcessCodes || []) {
|
|
56523
56521
|
const codeIndex = tieMatchUp?.processCodes?.lastIndexOf(
|
|
@@ -61671,6 +61669,7 @@ const tournamentEngine = (() => {
|
|
|
61671
61669
|
function executionQueue(directives, rollbackOnError) {
|
|
61672
61670
|
if (!Array.isArray(directives))
|
|
61673
61671
|
return { error: INVALID_VALUES };
|
|
61672
|
+
const start = Date.now();
|
|
61674
61673
|
const tournamentId = getTournamentId();
|
|
61675
61674
|
const tournamentRecord = getTournamentRecord(tournamentId);
|
|
61676
61675
|
const snapshot = rollbackOnError && makeDeepCopy(tournamentRecord, false, true);
|
|
@@ -61681,10 +61680,8 @@ const tournamentEngine = (() => {
|
|
|
61681
61680
|
const { method: methodName, params } = directive;
|
|
61682
61681
|
if (!engine[methodName]) {
|
|
61683
61682
|
const result3 = { error: METHOD_NOT_FOUND, methodName };
|
|
61684
|
-
const
|
|
61685
|
-
|
|
61686
|
-
console.log("te:", result3);
|
|
61687
|
-
}
|
|
61683
|
+
const elapsed = Date.now() - start;
|
|
61684
|
+
engineLogging({ result: result3, methodName, elapsed, params, engine: "te:" });
|
|
61688
61685
|
return result3;
|
|
61689
61686
|
}
|
|
61690
61687
|
const result2 = executeFunction(
|