xstate 5.0.0-beta.23 → 5.0.0-beta.25

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.
Files changed (43) hide show
  1. package/actions/dist/xstate-actions.cjs.js +1 -1
  2. package/actions/dist/xstate-actions.development.cjs.js +1 -1
  3. package/actions/dist/xstate-actions.development.esm.js +1 -1
  4. package/actions/dist/xstate-actions.esm.js +1 -1
  5. package/actions/dist/xstate-actions.umd.min.js +1 -1
  6. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  7. package/actors/dist/xstate-actors.cjs.js +1 -1
  8. package/actors/dist/xstate-actors.development.cjs.js +1 -1
  9. package/actors/dist/xstate-actors.development.esm.js +1 -1
  10. package/actors/dist/xstate-actors.esm.js +1 -1
  11. package/actors/dist/xstate-actors.umd.min.js.map +1 -1
  12. package/dist/{actions-0fcd4d15.development.cjs.js → actions-0971b43d.development.cjs.js} +88 -133
  13. package/dist/{actions-e83129c5.cjs.js → actions-319cefe7.cjs.js} +84 -137
  14. package/dist/{actions-bf7f6679.esm.js → actions-5943a9db.esm.js} +85 -137
  15. package/dist/{actions-f6b5002d.development.esm.js → actions-cf69419d.development.esm.js} +89 -133
  16. package/dist/declarations/src/Machine.d.ts +2 -2
  17. package/dist/declarations/src/State.d.ts +7 -3
  18. package/dist/declarations/src/StateMachine.d.ts +23 -17
  19. package/dist/declarations/src/StateNode.d.ts +23 -7
  20. package/dist/declarations/src/actions/choose.d.ts +4 -2
  21. package/dist/declarations/src/actions/pure.d.ts +6 -3
  22. package/dist/declarations/src/actions/raise.d.ts +2 -1
  23. package/dist/declarations/src/actions/send.d.ts +11 -55
  24. package/dist/declarations/src/guards.d.ts +20 -8
  25. package/dist/declarations/src/stateUtils.d.ts +10 -9
  26. package/dist/declarations/src/typegenTypes.d.ts +14 -2
  27. package/dist/declarations/src/types.d.ts +117 -142
  28. package/dist/declarations/src/utils.d.ts +3 -3
  29. package/dist/xstate.cjs.js +7 -3
  30. package/dist/xstate.development.cjs.js +7 -3
  31. package/dist/xstate.development.esm.js +8 -4
  32. package/dist/xstate.esm.js +8 -4
  33. package/dist/xstate.umd.min.js +1 -1
  34. package/dist/xstate.umd.min.js.map +1 -1
  35. package/guards/dist/xstate-guards.cjs.js +1 -2
  36. package/guards/dist/xstate-guards.cjs.mjs +1 -2
  37. package/guards/dist/xstate-guards.development.cjs.js +1 -2
  38. package/guards/dist/xstate-guards.development.cjs.mjs +1 -2
  39. package/guards/dist/xstate-guards.development.esm.js +1 -1
  40. package/guards/dist/xstate-guards.esm.js +1 -1
  41. package/guards/dist/xstate-guards.umd.min.js +1 -1
  42. package/guards/dist/xstate-guards.umd.min.js.map +1 -1
  43. package/package.json +1 -1
@@ -1496,148 +1496,108 @@ function invoke({
1496
1496
  return invoke;
1497
1497
  }
1498
1498
 
1499
+ function checkStateIn(state, _, {
1500
+ stateValue
1501
+ }) {
1502
+ if (typeof stateValue === 'string' && isStateId(stateValue)) {
1503
+ return state.configuration.some(sn => sn.id === stateValue.slice(1));
1504
+ }
1505
+ return state.matches(stateValue);
1506
+ }
1499
1507
  function stateIn(stateValue) {
1500
- return {
1501
- type: 'xstate.guard:in',
1502
- params: {
1503
- stateValue
1504
- },
1505
- predicate: ({
1506
- state
1507
- }) => {
1508
- if (typeof stateValue === 'string' && isStateId(stateValue)) {
1509
- return state.configuration.some(sn => sn.id === stateValue.slice(1));
1510
- }
1511
- return state.matches(stateValue);
1508
+ function stateIn(_) {
1509
+ {
1510
+ throw new Error(`This isn't supposed to be called`);
1512
1511
  }
1513
- };
1512
+ }
1513
+ stateIn.check = checkStateIn;
1514
+ stateIn.stateValue = stateValue;
1515
+ return stateIn;
1516
+ }
1517
+ function checkNot(state, {
1518
+ context,
1519
+ event
1520
+ }, {
1521
+ guards
1522
+ }) {
1523
+ return !evaluateGuard(guards[0], context, event, state);
1514
1524
  }
1515
1525
  function not(guard) {
1516
- return {
1517
- type: 'xstate.boolean',
1518
- params: {
1519
- op: 'not'
1520
- },
1521
- children: [toGuardDefinition(guard)],
1522
- predicate: ({
1523
- evaluate,
1524
- guard,
1525
- context,
1526
- event,
1527
- state
1528
- }) => {
1529
- return !evaluate(guard.children[0], context, event, state);
1526
+ function not(_) {
1527
+ {
1528
+ throw new Error(`This isn't supposed to be called`);
1530
1529
  }
1531
- };
1530
+ }
1531
+ not.check = checkNot;
1532
+ not.guards = [guard];
1533
+ return not;
1534
+ }
1535
+ function checkAnd(state, {
1536
+ context,
1537
+ event
1538
+ }, {
1539
+ guards
1540
+ }) {
1541
+ return guards.every(guard => evaluateGuard(guard, context, event, state));
1532
1542
  }
1533
1543
  function and(guards) {
1534
- return {
1535
- type: 'xstate.boolean',
1536
- params: {
1537
- op: 'and'
1538
- },
1539
- children: guards.map(guard => toGuardDefinition(guard)),
1540
- predicate: ({
1541
- evaluate,
1542
- guard,
1543
- context,
1544
- event,
1545
- state
1546
- }) => {
1547
- return guard.children.every(childGuard => {
1548
- return evaluate(childGuard, context, event, state);
1549
- });
1544
+ function and(_) {
1545
+ {
1546
+ throw new Error(`This isn't supposed to be called`);
1550
1547
  }
1551
- };
1548
+ }
1549
+ and.check = checkAnd;
1550
+ and.guards = guards;
1551
+ return and;
1552
+ }
1553
+ function checkOr(state, {
1554
+ context,
1555
+ event
1556
+ }, {
1557
+ guards
1558
+ }) {
1559
+ return guards.some(guard => evaluateGuard(guard, context, event, state));
1552
1560
  }
1553
1561
  function or(guards) {
1554
- return {
1555
- type: 'xstate.boolean',
1556
- params: {
1557
- op: 'or'
1558
- },
1559
- children: guards.map(guard => toGuardDefinition(guard)),
1560
- predicate: ({
1561
- evaluate,
1562
- guard,
1563
- context,
1564
- event,
1565
- state
1566
- }) => {
1567
- return guard.children.some(childGuard => {
1568
- return evaluate(childGuard, context, event, state);
1569
- });
1562
+ function or(_) {
1563
+ {
1564
+ throw new Error(`This isn't supposed to be called`);
1570
1565
  }
1571
- };
1566
+ }
1567
+ or.check = checkOr;
1568
+ or.guards = guards;
1569
+ return or;
1572
1570
  }
1571
+
1572
+ // TODO: throw on cycles (depth check should be enough)
1573
1573
  function evaluateGuard(guard, context, event, state) {
1574
1574
  const {
1575
1575
  machine
1576
1576
  } = state;
1577
- const predicate = machine?.implementations?.guards?.[guard.type] ?? guard.predicate;
1578
- if (!predicate) {
1579
- throw new Error(`Guard '${guard.type}' is not implemented.'.`);
1577
+ const isInline = typeof guard === 'function';
1578
+ const resolved = isInline ? guard : machine.implementations.guards[typeof guard === 'string' ? guard : guard.type];
1579
+ if (!isInline && !resolved) {
1580
+ throw new Error(`Guard '${typeof guard === 'string' ? guard : guard.type}' is not implemented.'.`);
1581
+ }
1582
+ if (typeof resolved !== 'function') {
1583
+ return evaluateGuard(resolved, context, event, state);
1580
1584
  }
1581
- return predicate({
1585
+ const guardArgs = {
1582
1586
  context,
1583
1587
  event,
1584
- state,
1585
- guard,
1586
- evaluate: evaluateGuard
1587
- });
1588
- }
1589
- function toGuardDefinition(guardConfig, getPredicate) {
1590
- // TODO: check for cycles and consider a refactor to more lazily evaluated guards
1591
- // TODO: resolve this more recursively: https://github.com/statelyai/xstate/pull/4064#discussion_r1229915724
1592
- if (typeof guardConfig === 'string') {
1593
- const predicateOrDef = getPredicate?.(guardConfig);
1594
- if (typeof predicateOrDef === 'function') {
1595
- return {
1596
- type: guardConfig,
1597
- predicate: predicateOrDef,
1598
- params: {
1599
- type: guardConfig
1600
- }
1601
- };
1602
- } else if (predicateOrDef) {
1603
- return predicateOrDef;
1604
- } else {
1605
- return {
1606
- type: guardConfig,
1607
- params: {
1608
- type: guardConfig
1609
- }
1610
- };
1611
- }
1612
- }
1613
- if (typeof guardConfig === 'function') {
1614
- return {
1615
- type: guardConfig.name,
1616
- predicate: guardConfig,
1617
- params: {
1618
- type: guardConfig.name,
1619
- name: guardConfig.name
1620
- }
1621
- };
1622
- }
1623
- const predicateOrDef = getPredicate?.(guardConfig.type);
1624
- if (typeof predicateOrDef === 'function') {
1625
- return {
1626
- type: guardConfig.type,
1627
- params: guardConfig.params || guardConfig,
1628
- children: guardConfig.children?.map(childGuard => toGuardDefinition(childGuard, getPredicate)),
1629
- predicate: getPredicate?.(guardConfig.type) || guardConfig.predicate
1630
- };
1631
- } else if (predicateOrDef) {
1632
- return predicateOrDef;
1633
- } else {
1634
- return {
1635
- type: guardConfig.type,
1636
- params: guardConfig.params || guardConfig,
1637
- children: guardConfig.children?.map(childGuard => toGuardDefinition(childGuard, getPredicate)),
1638
- predicate: guardConfig.predicate
1639
- };
1588
+ guard: isInline ? undefined : typeof guard === 'string' ? {
1589
+ type: guard
1590
+ } : guard
1591
+ };
1592
+ if (!('check' in resolved)) {
1593
+ // the existing type of `.guards` assumes non-nullable `TExpressionGuard`
1594
+ // inline guards expect `TExpressionGuard` to be set to `undefined`
1595
+ // it's fine to cast this here, our logic makes sure that we call those 2 "variants" correctly
1596
+ return resolved(guardArgs);
1640
1597
  }
1598
+ const builtinGuard = resolved;
1599
+ return builtinGuard.check(state, guardArgs, resolved // this holds all params
1600
+ );
1641
1601
  }
1642
1602
 
1643
1603
  function getOutput(configuration, context, event, self) {
@@ -1833,9 +1793,6 @@ function getDelayedTransitions(stateNode) {
1833
1793
  function formatTransition(stateNode, descriptor, transitionConfig) {
1834
1794
  const normalizedTarget = normalizeTarget(transitionConfig.target);
1835
1795
  const reenter = transitionConfig.reenter ?? false;
1836
- const {
1837
- guards
1838
- } = stateNode.machine.implementations;
1839
1796
  const target = resolveTarget(stateNode, normalizedTarget);
1840
1797
 
1841
1798
  // TODO: should this be part of a lint rule instead?
@@ -1845,7 +1802,7 @@ function formatTransition(stateNode, descriptor, transitionConfig) {
1845
1802
  const transition = {
1846
1803
  ...transitionConfig,
1847
1804
  actions: toArray(transitionConfig.actions),
1848
- guard: transitionConfig.guard ? toGuardDefinition(transitionConfig.guard, guardType => guards[guardType]) : undefined,
1805
+ guard: transitionConfig.guard,
1849
1806
  target,
1850
1807
  source: stateNode,
1851
1808
  reenter,
@@ -2450,7 +2407,7 @@ function resolveActionsAndContext(actions, event, currentState, actorCtx) {
2450
2407
  if (!resolved) {
2451
2408
  continue;
2452
2409
  }
2453
- const args = {
2410
+ const actionArgs = {
2454
2411
  context: intermediateState.context,
2455
2412
  event,
2456
2413
  self: actorCtx?.self,
@@ -2461,14 +2418,14 @@ function resolveActionsAndContext(actions, event, currentState, actorCtx) {
2461
2418
  };
2462
2419
  if (!('resolve' in resolved)) {
2463
2420
  if (actorCtx?.self.status === ActorStatus.Running) {
2464
- resolved(args);
2421
+ resolved(actionArgs);
2465
2422
  } else {
2466
- actorCtx?.defer(() => resolved(args));
2423
+ actorCtx?.defer(() => resolved(actionArgs));
2467
2424
  }
2468
2425
  continue;
2469
2426
  }
2470
2427
  const builtinAction = resolved;
2471
- const [nextState, params, actions] = builtinAction.resolve(actorCtx, intermediateState, args, resolved // this holds all params
2428
+ const [nextState, params, actions] = builtinAction.resolve(actorCtx, intermediateState, actionArgs, resolved // this holds all params
2472
2429
  );
2473
2430
 
2474
2431
  intermediateState = nextState;
@@ -3034,8 +2991,7 @@ function resolve$1(_, state, actionArgs, {
3034
2991
  branches
3035
2992
  }) {
3036
2993
  const matchedActions = branches.find(condition => {
3037
- const guard = condition.guard && toGuardDefinition(condition.guard, guardType => state.machine.implementations.guards[guardType]);
3038
- return !guard || evaluateGuard(guard, state.context, actionArgs.event, state);
2994
+ return !condition.guard || evaluateGuard(condition.guard, state.context, actionArgs.event, state);
3039
2995
  })?.actions;
3040
2996
  return [state, undefined, toArray(matchedActions)];
3041
2997
  }
@@ -3206,7 +3162,6 @@ exports.stopSignal = stopSignal;
3206
3162
  exports.stopSignalType = stopSignalType;
3207
3163
  exports.toActorRef = toActorRef;
3208
3164
  exports.toArray = toArray;
3209
- exports.toGuardDefinition = toGuardDefinition;
3210
3165
  exports.toInvokeConfig = toInvokeConfig;
3211
3166
  exports.toObserver = toObserver;
3212
3167
  exports.toTransitionConfigArray = toTransitionConfigArray;
@@ -1466,148 +1466,100 @@ function invoke({
1466
1466
  return invoke;
1467
1467
  }
1468
1468
 
1469
+ function checkStateIn(state, _, {
1470
+ stateValue
1471
+ }) {
1472
+ if (typeof stateValue === 'string' && isStateId(stateValue)) {
1473
+ return state.configuration.some(sn => sn.id === stateValue.slice(1));
1474
+ }
1475
+ return state.matches(stateValue);
1476
+ }
1469
1477
  function stateIn(stateValue) {
1470
- return {
1471
- type: 'xstate.guard:in',
1472
- params: {
1473
- stateValue
1474
- },
1475
- predicate: ({
1476
- state
1477
- }) => {
1478
- if (typeof stateValue === 'string' && isStateId(stateValue)) {
1479
- return state.configuration.some(sn => sn.id === stateValue.slice(1));
1480
- }
1481
- return state.matches(stateValue);
1482
- }
1483
- };
1478
+ function stateIn(_) {
1479
+ return false;
1480
+ }
1481
+ stateIn.check = checkStateIn;
1482
+ stateIn.stateValue = stateValue;
1483
+ return stateIn;
1484
+ }
1485
+ function checkNot(state, {
1486
+ context,
1487
+ event
1488
+ }, {
1489
+ guards
1490
+ }) {
1491
+ return !evaluateGuard(guards[0], context, event, state);
1484
1492
  }
1485
1493
  function not(guard) {
1486
- return {
1487
- type: 'xstate.boolean',
1488
- params: {
1489
- op: 'not'
1490
- },
1491
- children: [toGuardDefinition(guard)],
1492
- predicate: ({
1493
- evaluate,
1494
- guard,
1495
- context,
1496
- event,
1497
- state
1498
- }) => {
1499
- return !evaluate(guard.children[0], context, event, state);
1500
- }
1501
- };
1494
+ function not(_) {
1495
+ return false;
1496
+ }
1497
+ not.check = checkNot;
1498
+ not.guards = [guard];
1499
+ return not;
1500
+ }
1501
+ function checkAnd(state, {
1502
+ context,
1503
+ event
1504
+ }, {
1505
+ guards
1506
+ }) {
1507
+ return guards.every(guard => evaluateGuard(guard, context, event, state));
1502
1508
  }
1503
1509
  function and(guards) {
1504
- return {
1505
- type: 'xstate.boolean',
1506
- params: {
1507
- op: 'and'
1508
- },
1509
- children: guards.map(guard => toGuardDefinition(guard)),
1510
- predicate: ({
1511
- evaluate,
1512
- guard,
1513
- context,
1514
- event,
1515
- state
1516
- }) => {
1517
- return guard.children.every(childGuard => {
1518
- return evaluate(childGuard, context, event, state);
1519
- });
1520
- }
1521
- };
1510
+ function and(_) {
1511
+ return false;
1512
+ }
1513
+ and.check = checkAnd;
1514
+ and.guards = guards;
1515
+ return and;
1516
+ }
1517
+ function checkOr(state, {
1518
+ context,
1519
+ event
1520
+ }, {
1521
+ guards
1522
+ }) {
1523
+ return guards.some(guard => evaluateGuard(guard, context, event, state));
1522
1524
  }
1523
1525
  function or(guards) {
1524
- return {
1525
- type: 'xstate.boolean',
1526
- params: {
1527
- op: 'or'
1528
- },
1529
- children: guards.map(guard => toGuardDefinition(guard)),
1530
- predicate: ({
1531
- evaluate,
1532
- guard,
1533
- context,
1534
- event,
1535
- state
1536
- }) => {
1537
- return guard.children.some(childGuard => {
1538
- return evaluate(childGuard, context, event, state);
1539
- });
1540
- }
1541
- };
1526
+ function or(_) {
1527
+ return false;
1528
+ }
1529
+ or.check = checkOr;
1530
+ or.guards = guards;
1531
+ return or;
1542
1532
  }
1533
+
1534
+ // TODO: throw on cycles (depth check should be enough)
1543
1535
  function evaluateGuard(guard, context, event, state) {
1544
1536
  const {
1545
1537
  machine
1546
1538
  } = state;
1547
- const predicate = machine?.implementations?.guards?.[guard.type] ?? guard.predicate;
1548
- if (!predicate) {
1549
- throw new Error(`Guard '${guard.type}' is not implemented.'.`);
1539
+ const isInline = typeof guard === 'function';
1540
+ const resolved = isInline ? guard : machine.implementations.guards[typeof guard === 'string' ? guard : guard.type];
1541
+ if (!isInline && !resolved) {
1542
+ throw new Error(`Guard '${typeof guard === 'string' ? guard : guard.type}' is not implemented.'.`);
1543
+ }
1544
+ if (typeof resolved !== 'function') {
1545
+ return evaluateGuard(resolved, context, event, state);
1550
1546
  }
1551
- return predicate({
1547
+ const guardArgs = {
1552
1548
  context,
1553
1549
  event,
1554
- state,
1555
- guard,
1556
- evaluate: evaluateGuard
1557
- });
1558
- }
1559
- function toGuardDefinition(guardConfig, getPredicate) {
1560
- // TODO: check for cycles and consider a refactor to more lazily evaluated guards
1561
- // TODO: resolve this more recursively: https://github.com/statelyai/xstate/pull/4064#discussion_r1229915724
1562
- if (typeof guardConfig === 'string') {
1563
- const predicateOrDef = getPredicate?.(guardConfig);
1564
- if (typeof predicateOrDef === 'function') {
1565
- return {
1566
- type: guardConfig,
1567
- predicate: predicateOrDef,
1568
- params: {
1569
- type: guardConfig
1570
- }
1571
- };
1572
- } else if (predicateOrDef) {
1573
- return predicateOrDef;
1574
- } else {
1575
- return {
1576
- type: guardConfig,
1577
- params: {
1578
- type: guardConfig
1579
- }
1580
- };
1581
- }
1582
- }
1583
- if (typeof guardConfig === 'function') {
1584
- return {
1585
- type: guardConfig.name,
1586
- predicate: guardConfig,
1587
- params: {
1588
- type: guardConfig.name,
1589
- name: guardConfig.name
1590
- }
1591
- };
1592
- }
1593
- const predicateOrDef = getPredicate?.(guardConfig.type);
1594
- if (typeof predicateOrDef === 'function') {
1595
- return {
1596
- type: guardConfig.type,
1597
- params: guardConfig.params || guardConfig,
1598
- children: guardConfig.children?.map(childGuard => toGuardDefinition(childGuard, getPredicate)),
1599
- predicate: getPredicate?.(guardConfig.type) || guardConfig.predicate
1600
- };
1601
- } else if (predicateOrDef) {
1602
- return predicateOrDef;
1603
- } else {
1604
- return {
1605
- type: guardConfig.type,
1606
- params: guardConfig.params || guardConfig,
1607
- children: guardConfig.children?.map(childGuard => toGuardDefinition(childGuard, getPredicate)),
1608
- predicate: guardConfig.predicate
1609
- };
1550
+ guard: isInline ? undefined : typeof guard === 'string' ? {
1551
+ type: guard
1552
+ } : guard
1553
+ };
1554
+ if (!('check' in resolved)) {
1555
+ // the existing type of `.guards` assumes non-nullable `TExpressionGuard`
1556
+ // inline guards expect `TExpressionGuard` to be set to `undefined`
1557
+ // it's fine to cast this here, our logic makes sure that we call those 2 "variants" correctly
1558
+ return resolved(guardArgs);
1610
1559
  }
1560
+ const builtinGuard = resolved;
1561
+ return builtinGuard.check(state, guardArgs, resolved // this holds all params
1562
+ );
1611
1563
  }
1612
1564
 
1613
1565
  function getOutput(configuration, context, event, self) {
@@ -1797,14 +1749,11 @@ function getDelayedTransitions(stateNode) {
1797
1749
  function formatTransition(stateNode, descriptor, transitionConfig) {
1798
1750
  const normalizedTarget = normalizeTarget(transitionConfig.target);
1799
1751
  const reenter = transitionConfig.reenter ?? false;
1800
- const {
1801
- guards
1802
- } = stateNode.machine.implementations;
1803
1752
  const target = resolveTarget(stateNode, normalizedTarget);
1804
1753
  const transition = {
1805
1754
  ...transitionConfig,
1806
1755
  actions: toArray(transitionConfig.actions),
1807
- guard: transitionConfig.guard ? toGuardDefinition(transitionConfig.guard, guardType => guards[guardType]) : undefined,
1756
+ guard: transitionConfig.guard,
1808
1757
  target,
1809
1758
  source: stateNode,
1810
1759
  reenter,
@@ -2409,7 +2358,7 @@ function resolveActionsAndContext(actions, event, currentState, actorCtx) {
2409
2358
  if (!resolved) {
2410
2359
  continue;
2411
2360
  }
2412
- const args = {
2361
+ const actionArgs = {
2413
2362
  context: intermediateState.context,
2414
2363
  event,
2415
2364
  self: actorCtx?.self,
@@ -2420,14 +2369,14 @@ function resolveActionsAndContext(actions, event, currentState, actorCtx) {
2420
2369
  };
2421
2370
  if (!('resolve' in resolved)) {
2422
2371
  if (actorCtx?.self.status === ActorStatus.Running) {
2423
- resolved(args);
2372
+ resolved(actionArgs);
2424
2373
  } else {
2425
- actorCtx?.defer(() => resolved(args));
2374
+ actorCtx?.defer(() => resolved(actionArgs));
2426
2375
  }
2427
2376
  continue;
2428
2377
  }
2429
2378
  const builtinAction = resolved;
2430
- const [nextState, params, actions] = builtinAction.resolve(actorCtx, intermediateState, args, resolved // this holds all params
2379
+ const [nextState, params, actions] = builtinAction.resolve(actorCtx, intermediateState, actionArgs, resolved // this holds all params
2431
2380
  );
2432
2381
 
2433
2382
  intermediateState = nextState;
@@ -2975,8 +2924,7 @@ function resolve$1(_, state, actionArgs, {
2975
2924
  branches
2976
2925
  }) {
2977
2926
  const matchedActions = branches.find(condition => {
2978
- const guard = condition.guard && toGuardDefinition(condition.guard, guardType => state.machine.implementations.guards[guardType]);
2979
- return !guard || evaluateGuard(guard, state.context, actionArgs.event, state);
2927
+ return !condition.guard || evaluateGuard(condition.guard, state.context, actionArgs.event, state);
2980
2928
  })?.actions;
2981
2929
  return [state, undefined, toArray(matchedActions)];
2982
2930
  }
@@ -3141,7 +3089,6 @@ exports.stopSignal = stopSignal;
3141
3089
  exports.stopSignalType = stopSignalType;
3142
3090
  exports.toActorRef = toActorRef;
3143
3091
  exports.toArray = toArray;
3144
- exports.toGuardDefinition = toGuardDefinition;
3145
3092
  exports.toInvokeConfig = toInvokeConfig;
3146
3093
  exports.toObserver = toObserver;
3147
3094
  exports.toTransitionConfigArray = toTransitionConfigArray;