tods-competition-factory 1.6.28 → 1.6.30

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/index.mjs CHANGED
@@ -329,7 +329,7 @@ const matchUpFormatCode = {
329
329
  };
330
330
 
331
331
  function factoryVersion() {
332
- return "1.6.28";
332
+ return "1.6.30";
333
333
  }
334
334
 
335
335
  function getObjectTieFormat(obj) {
@@ -1425,7 +1425,8 @@ var syncGlobalState$1 = {
1425
1425
  setSubscriptions: setSubscriptions$1,
1426
1426
  setTournamentId: setTournamentId$1,
1427
1427
  setTournamentRecord: setTournamentRecord$2,
1428
- setTournamentRecords: setTournamentRecords$1
1428
+ setTournamentRecords: setTournamentRecords$1,
1429
+ handleCaughtError: handleCaughtError$1
1429
1430
  };
1430
1431
  function disableNotifications$1() {
1431
1432
  syncGlobalState.disableNotifications = true;
@@ -1531,6 +1532,26 @@ function callListener$1({ topic, notices }) {
1531
1532
  method(notices);
1532
1533
  }
1533
1534
  }
1535
+ function handleCaughtError$1({
1536
+ engineName,
1537
+ methodName,
1538
+ params,
1539
+ err
1540
+ }) {
1541
+ let error;
1542
+ if (typeof err === "string") {
1543
+ error = err.toUpperCase();
1544
+ } else if (err instanceof Error) {
1545
+ error = err.message;
1546
+ }
1547
+ console.log("ERROR", {
1548
+ tournamentId: getTournamentId$1(),
1549
+ params: JSON.stringify(params),
1550
+ engine: engineName,
1551
+ methodName,
1552
+ error
1553
+ });
1554
+ }
1534
1555
 
1535
1556
  const globalState = {
1536
1557
  tournamentFactoryVersion: "0.0.0",
@@ -1550,6 +1571,8 @@ const requiredStateProviderMethods = [
1550
1571
  "cycleMutationStatus",
1551
1572
  "deleteNotice",
1552
1573
  "deleteNotices",
1574
+ "disableNotifications",
1575
+ "enableNotifications",
1553
1576
  "getNotices",
1554
1577
  "getTopics",
1555
1578
  "getTournamentId",
@@ -1649,8 +1672,8 @@ function cycleMutationStatus() {
1649
1672
  function addNotice(notice) {
1650
1673
  return _globalStateProvider.addNotice(notice);
1651
1674
  }
1652
- function getNotices(topic) {
1653
- return _globalStateProvider.getNotices(topic);
1675
+ function getNotices(params) {
1676
+ return _globalStateProvider.getNotices(params);
1654
1677
  }
1655
1678
  function deleteNotice({ key, topic }) {
1656
1679
  return _globalStateProvider.deleteNotice({ key, topic });
@@ -1685,6 +1708,20 @@ function setTournamentId(tournamentId) {
1685
1708
  function removeTournamentRecord(tournamentId) {
1686
1709
  return _globalStateProvider.removeTournamentRecord(tournamentId);
1687
1710
  }
1711
+ function handleCaughtError({
1712
+ engineName,
1713
+ methodName,
1714
+ params,
1715
+ err
1716
+ }) {
1717
+ const caughtErrorHandler = typeof _globalStateProvider.handleCaughtError === "function" && _globalStateProvider.handleCaughtError || syncGlobalState$1.handleCaughtError;
1718
+ return caughtErrorHandler({
1719
+ engineName,
1720
+ methodName,
1721
+ params,
1722
+ err
1723
+ });
1724
+ }
1688
1725
 
1689
1726
  function isObject(obj) {
1690
1727
  return typeof obj === "object";
@@ -38377,18 +38414,11 @@ const competitionEngine = function() {
38377
38414
  try {
38378
38415
  return engineInvoke(governor[methodName], params, methodName);
38379
38416
  } catch (err) {
38380
- const activeTournamentId = getTournamentId();
38381
- let error;
38382
- if (typeof err === "string") {
38383
- error = err.toUpperCase();
38384
- } else if (err instanceof Error) {
38385
- error = err.message;
38386
- }
38387
- console.log("ERROR", {
38388
- params: JSON.stringify(params),
38389
- activeTournamentId,
38417
+ handleCaughtError({
38418
+ engineName: "competitionEngine",
38390
38419
  methodName,
38391
- error
38420
+ params,
38421
+ err
38392
38422
  });
38393
38423
  }
38394
38424
  }
@@ -38545,26 +38575,19 @@ function competitionEngineAsync(test) {
38545
38575
  async function importGovernors(governors) {
38546
38576
  for (const governor of governors) {
38547
38577
  const govKeys = Object.keys(governor);
38548
- for (const method of govKeys) {
38549
- engine[method] = async function(params) {
38578
+ for (const methodName of govKeys) {
38579
+ engine[methodName] = async function(params) {
38550
38580
  if (getDevContext()) {
38551
- return await engineInvoke(governor[method], params);
38581
+ return await engineInvoke(governor[methodName], params);
38552
38582
  } else {
38553
38583
  try {
38554
- return await engineInvoke(governor[method], params);
38584
+ return await engineInvoke(governor[methodName], params);
38555
38585
  } catch (err) {
38556
- const activeTournamentId = getTournamentId();
38557
- let error;
38558
- if (typeof err === "string") {
38559
- error = err.toUpperCase();
38560
- } else if (err instanceof Error) {
38561
- error = err.message;
38562
- }
38563
- console.log("ERROR", {
38564
- params: JSON.stringify(params),
38565
- activeTournamentId,
38566
- method,
38567
- error
38586
+ handleCaughtError({
38587
+ engineName: "competitionEngine",
38588
+ methodName,
38589
+ params,
38590
+ err
38568
38591
  });
38569
38592
  }
38570
38593
  }
@@ -40001,9 +40024,9 @@ function processPlayoffGroups({
40001
40024
  for (const playoffGroup of playoffGroups) {
40002
40025
  const finishingPositions = playoffGroup.finishingPositions;
40003
40026
  const positionsPlayedOff = positionRangeMap && finishingPositions.map((p) => positionRangeMap[p]?.finishingPositions).flat();
40004
- const playoffDrawType = playoffGroup.drawType || SINGLE_ELIMINATION;
40005
40027
  const participantsInDraw = groupCount * finishingPositions.length;
40006
40028
  const drawSize = nextPowerOf2(participantsInDraw);
40029
+ const playoffDrawType = drawSize === 2 && SINGLE_ELIMINATION || playoffGroup.drawType || SINGLE_ELIMINATION;
40007
40030
  if (positionsPlayedOff) {
40008
40031
  finishingPositionOffset = Math.min(...positionsPlayedOff) - 1;
40009
40032
  }
@@ -40571,8 +40594,6 @@ function generateDrawStructuresAndLinks$1(params) {
40571
40594
  const {
40572
40595
  enforceMinimumDrawSize = true,
40573
40596
  overwriteExisting,
40574
- drawTypeCoercion,
40575
- // coerce to SINGLE_ELIMINATION for drawSize: 2
40576
40597
  appliedPolicies,
40577
40598
  staggeredEntry,
40578
40599
  // optional - specifies main structure FEED_IN for drawTypes CURTIS_CONSOLATION, FEED_IN_CHAMPIONSHIPS, FMLC
@@ -40582,8 +40603,9 @@ function generateDrawStructuresAndLinks$1(params) {
40582
40603
  isMock,
40583
40604
  uuids
40584
40605
  } = params || {};
40606
+ const drawTypeCoercion = params.drawTypeCoercion ?? appliedPolicies?.[POLICY_TYPE_DRAWS]?.drawTypeCoercion ?? true;
40585
40607
  const stack = "generateDrawStructuresAndLinks";
40586
- let drawType = params.drawType ?? SINGLE_ELIMINATION;
40608
+ let drawType = drawTypeCoercion && params.drawSize === 2 && DrawTypeEnum.SingleElimination || params.drawType || DrawTypeEnum.SingleElimination;
40587
40609
  const structures = [], links = [];
40588
40610
  const matchUpType = params?.matchUpType ?? SINGLES$1;
40589
40611
  const existingQualifyingStructures = drawDefinition?.structures?.filter(
@@ -48690,25 +48712,19 @@ const drawEngine = function() {
48690
48712
  return engine;
48691
48713
  function importGovernors(governors) {
48692
48714
  governors.forEach((governor) => {
48693
- Object.keys(governor).forEach((governorMethod) => {
48694
- engine[governorMethod] = (params) => {
48715
+ Object.keys(governor).forEach((methodName) => {
48716
+ engine[methodName] = (params) => {
48695
48717
  if (getDevContext()) {
48696
- return invoke({ params, governor, governorMethod });
48718
+ return invoke({ params, governor, methodName });
48697
48719
  } else {
48698
48720
  try {
48699
- return invoke({ params, governor, governorMethod });
48721
+ return invoke({ params, governor, methodName });
48700
48722
  } catch (err) {
48701
- let error;
48702
- if (typeof err === "string") {
48703
- error = err.toUpperCase();
48704
- } else if (err instanceof Error) {
48705
- error = err.message;
48706
- }
48707
- console.log("ERROR", {
48708
- params: JSON.stringify(params),
48709
- drawId: drawDefinition$1?.drawId,
48710
- method: governorMethod,
48711
- error
48723
+ handleCaughtError({
48724
+ engineName: "drawEngine",
48725
+ methodName,
48726
+ params,
48727
+ err
48712
48728
  });
48713
48729
  }
48714
48730
  }
@@ -48716,7 +48732,7 @@ const drawEngine = function() {
48716
48732
  });
48717
48733
  });
48718
48734
  }
48719
- function invoke({ params, governor, governorMethod }) {
48735
+ function invoke({ params, governor, methodName }) {
48720
48736
  delete engine.success;
48721
48737
  delete engine.error;
48722
48738
  const snapshot = params?.rollbackOnError && makeDeepCopy(drawDefinition$1, false, true);
@@ -48727,7 +48743,7 @@ const drawEngine = function() {
48727
48743
  tournamentParticipants: tournamentParticipants$1,
48728
48744
  drawDefinition: drawDefinition$1
48729
48745
  };
48730
- const result = governor[governorMethod](params);
48746
+ const result = governor[methodName](params);
48731
48747
  if (result?.error) {
48732
48748
  if (snapshot)
48733
48749
  setState$3(snapshot);
@@ -48820,25 +48836,19 @@ function drawEngineAsync(test) {
48820
48836
  async function importGovernors(governors) {
48821
48837
  for (const governor of governors) {
48822
48838
  const governorMethods = Object.keys(governor);
48823
- for (const governorMethod of governorMethods) {
48824
- engine[governorMethod] = async (params) => {
48839
+ for (const methodName of governorMethods) {
48840
+ engine[methodName] = async (params) => {
48825
48841
  if (getDevContext()) {
48826
- return await invoke({ params, governor, governorMethod });
48842
+ return await invoke({ params, governor, methodName });
48827
48843
  } else {
48828
48844
  try {
48829
- return await invoke({ params, governor, governorMethod });
48845
+ return await invoke({ params, governor, methodName });
48830
48846
  } catch (err) {
48831
- let error;
48832
- if (typeof err === "string") {
48833
- error = err.toUpperCase();
48834
- } else if (err instanceof Error) {
48835
- error = err.message;
48836
- }
48837
- console.log("ERROR", {
48838
- params: JSON.stringify(params),
48839
- drawId: drawDefinition?.drawId,
48840
- method: governorMethod,
48841
- error
48847
+ handleCaughtError({
48848
+ engineName: "drawEngine",
48849
+ methodName,
48850
+ params,
48851
+ err
48842
48852
  });
48843
48853
  }
48844
48854
  }
@@ -48846,7 +48856,7 @@ function drawEngineAsync(test) {
48846
48856
  }
48847
48857
  }
48848
48858
  }
48849
- async function invoke({ params, governor, governorMethod }) {
48859
+ async function invoke({ params, governor, methodName }) {
48850
48860
  delete engine.success;
48851
48861
  delete engine.error;
48852
48862
  const snapshot = params?.rollbackOnError && makeDeepCopy(drawDefinition, false, true);
@@ -48857,7 +48867,7 @@ function drawEngineAsync(test) {
48857
48867
  tournamentParticipants,
48858
48868
  drawDefinition
48859
48869
  };
48860
- const result2 = governor[governorMethod](params);
48870
+ const result2 = governor[methodName](params);
48861
48871
  if (result2?.error) {
48862
48872
  if (snapshot)
48863
48873
  setState$3(snapshot);
@@ -49355,24 +49365,19 @@ const matchUpEngine = (() => {
49355
49365
  return engine;
49356
49366
  function importGovernors(governors) {
49357
49367
  governors.forEach((governor) => {
49358
- Object.keys(governor).forEach((governorMethod) => {
49359
- engine[governorMethod] = (params) => {
49368
+ Object.keys(governor).forEach((methodName) => {
49369
+ engine[methodName] = (params) => {
49360
49370
  if (getDevContext()) {
49361
- return invoke({ params, governor, governorMethod });
49371
+ return invoke({ params, governor, methodName });
49362
49372
  } else {
49363
49373
  try {
49364
- return invoke({ params, governor, governorMethod });
49374
+ return invoke({ params, governor, methodName });
49365
49375
  } catch (err) {
49366
- let error;
49367
- if (typeof err === "string") {
49368
- error = err.toUpperCase();
49369
- } else if (err instanceof Error) {
49370
- error = err.message;
49371
- }
49372
- console.log("ERROR", {
49373
- params: JSON.stringify(params),
49374
- method: governorMethod,
49375
- error
49376
+ handleCaughtError({
49377
+ engineName: "matchUpEngine",
49378
+ methodName,
49379
+ params,
49380
+ err
49376
49381
  });
49377
49382
  }
49378
49383
  }
@@ -49380,7 +49385,7 @@ const matchUpEngine = (() => {
49380
49385
  });
49381
49386
  });
49382
49387
  }
49383
- function invoke({ params, governor, governorMethod }) {
49388
+ function invoke({ params, governor, methodName }) {
49384
49389
  engine.error = void 0;
49385
49390
  engine.success = false;
49386
49391
  const matchUp = params?.matchUp || getMatchUp();
@@ -49392,7 +49397,7 @@ const matchUpEngine = (() => {
49392
49397
  matchUps,
49393
49398
  matchUp
49394
49399
  };
49395
- const result = governor[governorMethod](params);
49400
+ const result = governor[methodName](params);
49396
49401
  if (result?.error) {
49397
49402
  if (snapshot)
49398
49403
  setState$2(snapshot);
@@ -49452,24 +49457,19 @@ function matchUpEngineAsync(test) {
49452
49457
  async function importGovernors(governors) {
49453
49458
  for (const governor of governors) {
49454
49459
  const governorMethods = Object.keys(governor);
49455
- for (const governorMethod of governorMethods) {
49456
- engine[governorMethod] = async (params) => {
49460
+ for (const methodName of governorMethods) {
49461
+ engine[methodName] = async (params) => {
49457
49462
  if (getDevContext()) {
49458
- return await invoke({ params, governor, governorMethod });
49463
+ return await invoke({ params, governor, methodName });
49459
49464
  } else {
49460
49465
  try {
49461
- return await invoke({ params, governor, governorMethod });
49466
+ return await invoke({ params, governor, methodName });
49462
49467
  } catch (err) {
49463
- let error;
49464
- if (typeof err === "string") {
49465
- error = err.toUpperCase();
49466
- } else if (err instanceof Error) {
49467
- error = err.message;
49468
- }
49469
- console.log("ERROR", {
49470
- params: JSON.stringify(params),
49471
- method: governorMethod,
49472
- error
49468
+ handleCaughtError({
49469
+ engineName: "matchUpEngine",
49470
+ methodName,
49471
+ params,
49472
+ err
49473
49473
  });
49474
49474
  }
49475
49475
  }
@@ -49477,7 +49477,7 @@ function matchUpEngineAsync(test) {
49477
49477
  }
49478
49478
  }
49479
49479
  }
49480
- async function invoke({ params, governor, governorMethod }) {
49480
+ async function invoke({ params, governor, methodName }) {
49481
49481
  engine.success = false;
49482
49482
  engine.error = void 0;
49483
49483
  const matchUp = params?.matchUp || getMatchUp();
@@ -49489,7 +49489,7 @@ function matchUpEngineAsync(test) {
49489
49489
  matchUps,
49490
49490
  matchUp
49491
49491
  };
49492
- const result2 = governor[governorMethod](params);
49492
+ const result2 = governor[methodName](params);
49493
49493
  if (result2?.error) {
49494
49494
  if (snapshot)
49495
49495
  setState$2(snapshot);
@@ -54724,7 +54724,10 @@ function addEventEntryPairs({
54724
54724
  event
54725
54725
  });
54726
54726
  if (newParticipants.length) {
54727
- addNotice({ topic: ADD_PARTICIPANTS, participants: newParticipants });
54727
+ addNotice({
54728
+ payload: { participants: newParticipants },
54729
+ topic: ADD_PARTICIPANTS
54730
+ });
54728
54731
  }
54729
54732
  const newParticipantIds = newParticipants.map(getParticipantId);
54730
54733
  return { ...result, info, newParticipantIds };
@@ -54732,9 +54735,12 @@ function addEventEntryPairs({
54732
54735
 
54733
54736
  function checkValidEntries({
54734
54737
  enforceGender = true,
54738
+ consideredEntries,
54739
+ tournamentRecord,
54735
54740
  participants,
54736
54741
  event
54737
54742
  }) {
54743
+ participants = participants || tournamentRecord?.participants;
54738
54744
  if (!participants)
54739
54745
  return { error: MISSING_PARTICIPANTS };
54740
54746
  if (!Array.isArray(participants))
@@ -54745,7 +54751,7 @@ function checkValidEntries({
54745
54751
  const participantType = eventType === TEAM_EVENT && TEAM || eventType === DOUBLES_EVENT && PAIR || INDIVIDUAL;
54746
54752
  const entryStatusMap = Object.assign(
54747
54753
  {},
54748
- ...(event.entries || []).map((entry) => ({
54754
+ ...(consideredEntries || event.entries || []).map((entry) => ({
54749
54755
  [entry.participantId]: entry.entryStatus
54750
54756
  }))
54751
54757
  );
@@ -57338,7 +57344,6 @@ function prepareStage(params) {
57338
57344
  function generateDrawDefinition(params) {
57339
57345
  const stack = "generateDrawDefinition";
57340
57346
  const {
57341
- drawType = DrawTypeEnum.SingleElimination,
57342
57347
  considerEventEntries = true,
57343
57348
  // in the absence of drawSize and drawEntries, look to event.entries
57344
57349
  ignoreAllowedDrawTypes,
@@ -57354,18 +57359,17 @@ function generateDrawDefinition(params) {
57354
57359
  placeByes,
57355
57360
  event
57356
57361
  } = params;
57357
- const { tournamentParticipants: participants } = getTournamentParticipants({
57358
- tournamentRecord,
57359
- inContext: true
57360
- });
57361
57362
  const appliedPolicies = getAppliedPolicies({
57362
57363
  tournamentRecord,
57363
57364
  event
57364
57365
  }).appliedPolicies ?? {};
57366
+ const drawTypeCoercion = params.drawTypeCoercion ?? appliedPolicies?.[POLICY_TYPE_DRAWS]?.drawTypeCoercion ?? true;
57367
+ const drawType = drawTypeCoercion && params.drawSize === 2 && DrawTypeEnum.SingleElimination || params.drawType || DrawTypeEnum.SingleElimination;
57368
+ const { tournamentParticipants: participants } = getTournamentParticipants({
57369
+ tournamentRecord,
57370
+ inContext: true
57371
+ });
57365
57372
  const enforceGender = params.enforceGender ?? policyDefinitions?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender ?? appliedPolicies?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender;
57366
- const validEntriesResult = event && participants && checkValidEntries({ event, participants, enforceGender });
57367
- if (validEntriesResult?.error)
57368
- return decorateResult({ result: validEntriesResult, stack });
57369
57373
  const allowedDrawTypes = !ignoreAllowedDrawTypes && tournamentRecord && getAllowedDrawTypes({
57370
57374
  tournamentRecord,
57371
57375
  categoryType: event?.category?.categoryType,
@@ -57378,6 +57382,14 @@ function generateDrawDefinition(params) {
57378
57382
  (entry) => entry.entryStatus && [...STRUCTURE_ENTERED_TYPES, QUALIFIER].includes(entry.entryStatus)
57379
57383
  ) ?? [];
57380
57384
  const consideredEntries = (qualifyingOnly && [] || drawEntries || (considerEventEntries ? eventEntries : [])).filter(({ entryStage }) => !entryStage || entryStage === MAIN);
57385
+ const validEntriesResult = event && participants && checkValidEntries({
57386
+ consideredEntries,
57387
+ enforceGender,
57388
+ participants,
57389
+ event
57390
+ });
57391
+ if (validEntriesResult?.error)
57392
+ return decorateResult({ result: validEntriesResult, stack });
57381
57393
  const derivedDrawSize = !params.drawSize && consideredEntries.length && ![
57382
57394
  AD_HOC,
57383
57395
  DOUBLE_ELIMINATION,
@@ -58735,17 +58747,11 @@ const tournamentEngine = (() => {
58735
58747
  try {
58736
58748
  return engineInvoke(governor[methodName], params, methodName);
58737
58749
  } catch (err) {
58738
- let error;
58739
- if (typeof err === "string") {
58740
- error = err.toUpperCase();
58741
- } else if (err instanceof Error) {
58742
- error = err.message;
58743
- }
58744
- console.log("ERROR", {
58745
- tournamentId: getTournamentId(),
58746
- params: JSON.stringify(params),
58750
+ handleCaughtError({
58751
+ engineName: "tournamentEngine",
58747
58752
  methodName,
58748
- error
58753
+ params,
58754
+ err
58749
58755
  });
58750
58756
  }
58751
58757
  }
@@ -58906,26 +58912,19 @@ function tournamentEngineAsync(test) {
58906
58912
  function importGovernors(governors) {
58907
58913
  for (const governor of governors) {
58908
58914
  const governorMethods = Object.keys(governor);
58909
- for (const method of governorMethods) {
58910
- engine[method] = async (params) => {
58915
+ for (const methodName of governorMethods) {
58916
+ engine[methodName] = async (params) => {
58911
58917
  if (getDevContext()) {
58912
- return await engineInvoke(governor[method], params);
58918
+ return await engineInvoke(governor[methodName], params);
58913
58919
  } else {
58914
58920
  try {
58915
- return await engineInvoke(governor[method], params);
58921
+ return await engineInvoke(governor[methodName], params);
58916
58922
  } catch (err) {
58917
- const tournamentId = getTournamentId();
58918
- let error;
58919
- if (typeof err === "string") {
58920
- error = err.toUpperCase();
58921
- } else if (err instanceof Error) {
58922
- error = err.message;
58923
- }
58924
- console.log("ERROR", {
58925
- params: JSON.stringify(params),
58926
- tournamentId,
58927
- method,
58928
- error
58923
+ handleCaughtError({
58924
+ engineName: "tournamentEngine",
58925
+ methodName,
58926
+ params,
58927
+ err
58929
58928
  });
58930
58929
  }
58931
58930
  }
@@ -59624,24 +59623,19 @@ const scaleEngine = (() => {
59624
59623
  }
59625
59624
  function importGovernors(governors) {
59626
59625
  governors.forEach((governor) => {
59627
- Object.keys(governor).forEach((method) => {
59628
- engine[method] = (params) => {
59626
+ Object.keys(governor).forEach((methodName) => {
59627
+ engine[methodName] = (params) => {
59629
59628
  if (getDevContext()) {
59630
- return engineInvoke(governor[method], params);
59629
+ return engineInvoke(governor[methodName], params);
59631
59630
  } else {
59632
59631
  try {
59633
- return engineInvoke(governor[method], params);
59632
+ return engineInvoke(governor[methodName], params);
59634
59633
  } catch (err) {
59635
- let error;
59636
- if (typeof err === "string") {
59637
- error = err.toUpperCase();
59638
- } else if (err instanceof Error) {
59639
- error = err.message;
59640
- }
59641
- console.log("ERROR", {
59642
- error,
59643
- method,
59644
- params: JSON.stringify(params)
59634
+ handleCaughtError({
59635
+ engineName: "scaleEngine",
59636
+ methodName,
59637
+ params,
59638
+ err
59645
59639
  });
59646
59640
  }
59647
59641
  }
@@ -59713,9 +59707,22 @@ function scaleEngineAsync(test) {
59713
59707
  function importGovernors(governors) {
59714
59708
  for (const governor of governors) {
59715
59709
  const governorMethods = Object.keys(governor);
59716
- for (const governorMethod of governorMethods) {
59717
- engine[governorMethod] = async (params) => {
59718
- return await engineInvoke(governor[governorMethod], params);
59710
+ for (const methodName of governorMethods) {
59711
+ engine[methodName] = async (params) => {
59712
+ if (getDevContext()) {
59713
+ return await engineInvoke(governor[methodName], params);
59714
+ } else {
59715
+ try {
59716
+ return await engineInvoke(governor[methodName], params);
59717
+ } catch (err) {
59718
+ handleCaughtError({
59719
+ engineName: "scaleEngine",
59720
+ methodName,
59721
+ params,
59722
+ err
59723
+ });
59724
+ }
59725
+ }
59719
59726
  };
59720
59727
  }
59721
59728
  }