tods-competition-factory 0.83.2 → 0.83.3

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.
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
249
249
  };
250
250
 
251
251
  function factoryVersion() {
252
- return '0.83.2';
252
+ return '0.83.3';
253
253
  }
254
254
 
255
255
  const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
@@ -29387,14 +29387,27 @@ const competitionEngine = function () {
29387
29387
  return engine;
29388
29388
  }
29389
29389
 
29390
- function engineInvoke(method, params) {
29390
+ function executeFunction(tournamentRecords, method, params, methodName) {
29391
29391
  delete engine.success;
29392
29392
  delete engine.error;
29393
+ const start = Date.now();
29394
+ const result = method({
29395
+ tournamentRecords,
29396
+ ...params
29397
+ });
29398
+ const elapsed = Date.now() - start;
29399
+ const devContext = getDevContext();
29400
+ if (devContext.perf && (isNaN(devContext.perf) || elapsed > devContext.perf)) console.log('ce:', {
29401
+ methodName,
29402
+ elapsed
29403
+ });
29404
+ return result;
29405
+ }
29406
+
29407
+ function engineInvoke(method, params, methodName) {
29393
29408
  const tournamentRecords = getTournamentRecords();
29394
29409
  const snapshot = (params === null || params === void 0 ? void 0 : params.rollbackOnError) && makeDeepCopy(tournamentRecords, false, true);
29395
- const result = method({ ...params,
29396
- tournamentRecords
29397
- });
29410
+ const result = executeFunction(tournamentRecords, method, params, methodName);
29398
29411
  if (result !== null && result !== void 0 && result.error && snapshot) setState$3(snapshot);
29399
29412
  const notify = (result === null || result === void 0 ? void 0 : result.success) && (params === null || params === void 0 ? void 0 : params.delayNotify) !== true && (params === null || params === void 0 ? void 0 : params.doNotNotify) !== true;
29400
29413
  if (notify) notifySubscribers();
@@ -29404,18 +29417,18 @@ const competitionEngine = function () {
29404
29417
 
29405
29418
  function importGovernors(governors) {
29406
29419
  governors.forEach(governor => {
29407
- Object.keys(governor).forEach(method => {
29408
- engine[method] = params => {
29420
+ Object.keys(governor).forEach(methodName => {
29421
+ engine[methodName] = params => {
29409
29422
  if (getDevContext()) {
29410
- return engineInvoke(governor[method], params);
29423
+ return engineInvoke(governor[methodName], params, methodName);
29411
29424
  } else {
29412
29425
  try {
29413
- return engineInvoke(governor[method], params);
29426
+ return engineInvoke(governor[methodName], params, methodName);
29414
29427
  } catch (err) {
29415
29428
  const error = err.toString();
29416
29429
  console.log('ERROR', {
29417
29430
  error,
29418
- method,
29431
+ methodName,
29419
29432
  params: JSON.stringify(params)
29420
29433
  });
29421
29434
  console.log(err);
@@ -29439,15 +29452,13 @@ const competitionEngine = function () {
29439
29452
  error: INVALID_VALUES
29440
29453
  };
29441
29454
  const {
29442
- method,
29455
+ method: methodName,
29443
29456
  params
29444
29457
  } = directive;
29445
- if (!engine[method]) return {
29458
+ if (!engine[methodName]) return {
29446
29459
  error: METHOD_NOT_FOUND
29447
29460
  };
29448
- const result = engine[method]({ ...params,
29449
- tournamentRecords
29450
- });
29461
+ const result = executeFunction(tournamentRecords, engine[methodName], params, methodName);
29451
29462
 
29452
29463
  if (result !== null && result !== void 0 && result.error) {
29453
29464
  if (snapshot) setState$3(snapshot);
@@ -36559,7 +36570,7 @@ function addEventEntries(params) {
36559
36570
  return true;
36560
36571
  }
36561
36572
 
36562
- if (event.eventType === TEAM$1 && (participant.participantType === TEAM$1 || entryStatus === UNGROUPED && participant.participantType === INDIVIDUAL$1)) {
36573
+ if (event.eventType === TEAM$1 && (participant.participantType === TEAM$1 || isUngrouped(entryStatus) && participant.participantType === INDIVIDUAL$1)) {
36563
36574
  return true;
36564
36575
  }
36565
36576
 
@@ -47317,20 +47328,27 @@ const tournamentEngine = function () {
47317
47328
  importGovernors([queryGovernor, eventGovernor, locationGovernor, policyGovernor, scheduleGovernor, publishingGovernor, tournamentGovernor, participantGovernor]);
47318
47329
  return engine;
47319
47330
 
47320
- function executeFunction(tournamentRecord, method, params) {
47331
+ function executeFunction(tournamentRecord, method, params, methodName) {
47321
47332
  delete engine.success;
47322
47333
  delete engine.error;
47334
+ const start = Date.now();
47323
47335
  const augmentedParams = paramsMiddleWare(tournamentRecord, params);
47324
47336
  const result = method({ ...augmentedParams,
47325
47337
  tournamentRecord
47326
47338
  });
47339
+ const elapsed = Date.now() - start;
47340
+ const devContext = getDevContext();
47341
+ if (devContext.perf && (isNaN(devContext.perf) || elapsed > devContext.perf)) console.log('te:', {
47342
+ methodName,
47343
+ elapsed
47344
+ });
47327
47345
  return result;
47328
47346
  }
47329
47347
 
47330
- function engineInvoke(method, params) {
47348
+ function engineInvoke(method, params, methodName) {
47331
47349
  const tournamentRecord = (params === null || params === void 0 ? void 0 : params.sandBoxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxTournament) || getTournamentRecord(getTournamentId());
47332
47350
  const snapshot = (params === null || params === void 0 ? void 0 : params.rollbackOnError) && makeDeepCopy(tournamentRecord, false, true);
47333
- const result = executeFunction(tournamentRecord, method, params);
47351
+ const result = executeFunction(tournamentRecord, method, params, methodName);
47334
47352
  if (result !== null && result !== void 0 && result.error && snapshot) setState(snapshot);
47335
47353
  const notify = (result === null || result === void 0 ? void 0 : result.success) && (params === null || params === void 0 ? void 0 : params.delayNotify) !== true && (params === null || params === void 0 ? void 0 : params.doNotNotify) !== true;
47336
47354
  if (notify) notifySubscribers();
@@ -47340,18 +47358,18 @@ const tournamentEngine = function () {
47340
47358
 
47341
47359
  function importGovernors(governors) {
47342
47360
  governors.forEach(governor => {
47343
- Object.keys(governor).forEach(method => {
47344
- engine[method] = params => {
47361
+ Object.keys(governor).forEach(methodName => {
47362
+ engine[methodName] = params => {
47345
47363
  if (getDevContext()) {
47346
- return engineInvoke(governor[method], params);
47364
+ return engineInvoke(governor[methodName], params, methodName);
47347
47365
  } else {
47348
47366
  try {
47349
- return engineInvoke(governor[method], params, method);
47367
+ return engineInvoke(governor[methodName], params, methodName);
47350
47368
  } catch (err) {
47351
47369
  const error = err.toString();
47352
47370
  console.log('ERROR', {
47353
47371
  error,
47354
- method,
47372
+ methodName,
47355
47373
  params: JSON.stringify(params)
47356
47374
  });
47357
47375
  console.log(err);
@@ -47376,13 +47394,13 @@ const tournamentEngine = function () {
47376
47394
  error: INVALID_VALUES
47377
47395
  };
47378
47396
  const {
47379
- method,
47397
+ method: methodName,
47380
47398
  params
47381
47399
  } = directive;
47382
- if (!engine[method]) return {
47400
+ if (!engine[methodName]) return {
47383
47401
  error: METHOD_NOT_FOUND
47384
47402
  };
47385
- const result = executeFunction(tournamentRecord, engine[method], params);
47403
+ const result = executeFunction(tournamentRecord, engine[methodName], params, methodName);
47386
47404
 
47387
47405
  if (result !== null && result !== void 0 && result.error) {
47388
47406
  if (snapshot) setState(snapshot);
@@ -47473,7 +47491,7 @@ function tournamentEngineAsync(test) {
47473
47491
  return result;
47474
47492
  }
47475
47493
 
47476
- async function engineInvoke(method, params) {
47494
+ async function engineInvoke(method, params, methodName) {
47477
47495
  const tournamentRecord = (params === null || params === void 0 ? void 0 : params.sandBoxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxTournament) || getTournamentRecord(getTournamentId());
47478
47496
  const snapshot = (params === null || params === void 0 ? void 0 : params.rollbackOnError) && makeDeepCopy(tournamentRecord, false, true);
47479
47497
  const result = await executeFunctionAsync(tournamentRecord, method, params);
@@ -47488,15 +47506,13 @@ function tournamentEngineAsync(test) {
47488
47506
  for (const governor of governors) {
47489
47507
  const governorMethods = Object.keys(governor);
47490
47508
 
47491
- for (const governorMethod of governorMethods) {
47492
- engine[governorMethod] = async params => {
47509
+ for (const methodName of governorMethods) {
47510
+ engine[methodName] = async params => {
47493
47511
  if (getDevContext()) {
47494
- const result = await engineInvoke(governor[governorMethod], params // governorMethod
47495
- );
47512
+ const result = await engineInvoke(governor[methodName], params);
47496
47513
  return result;
47497
47514
  } else {
47498
- const result = await engineInvoke(governor[governorMethod], params // governorMethod
47499
- );
47515
+ const result = await engineInvoke(governor[methodName], params);
47500
47516
  return result;
47501
47517
  }
47502
47518
  };