• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Duit-Foundation / duit_kernel / 20880754755

10 Jan 2026 03:55PM UTC coverage: 76.395% (-0.3%) from 76.681%
20880754755

Pull #52

github

web-flow
Merge c825a6d9e into b1348d3d1
Pull Request #52: feat: New capabilities

2 of 11 new or added lines in 3 files covered. (18.18%)

81 existing lines in 5 files now uncovered.

1780 of 2330 relevant lines covered (76.39%)

4.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/src/action_api/action_executor.dart
1
import "package:duit_kernel/duit_kernel.dart";
2

3
/// The [ActionExecutor] is an abstract class responsible for executing actions.
4
///
5
/// It relies on a [UIDriver] to perform actions and an [DebugLogger] to log messages.
6
/// This class serves as a base for concrete implementations that define how actions
7
/// should be executed.
8
///
9
/// Subclasses must implement the [executeAction] method to handle different types
10
/// of [ServerAction]s.
11
abstract class ActionExecutor {
12
  final UIDriver driver;
13
  final DebugLogger? logger;
14

UNCOV
15
  ActionExecutor({
×
16
    required this.driver,
17
    this.logger,
18
  });
19

20
  Future<ServerEvent?> executeAction(
21
    ServerAction action,
22
  );
23
}
24

25
/// Executes a given [ServerAction].
26
///
27
/// The [executeAction] method takes a [ServerAction] as a parameter and
28
/// performs the necessary operations to execute it. This is an abstract
29
/// method that must be implemented by subclasses. It relies on the [UIDriver]
30
/// to resolve the event associated with the action and perform the execution.
31
///
32
/// Implementations should handle different types of actions, such as
33
/// [TransportAction], by using switch cases or other control flow mechanisms.
34
///
35
/// This method is asynchronous and returns a [Future] that completes when
36
/// the action execution is finished.
37
final class DefaultActionExecutor extends ActionExecutor {
UNCOV
38
  DefaultActionExecutor({
×
39
    required super.driver,
40
    super.logger,
41
  });
42

UNCOV
43
  @override
×
44
  Future<ServerEvent?> executeAction(
45
    ServerAction action,
46
  ) async {
47
    switch (action) {
48
      //transport
UNCOV
49
      case TransportAction():
×
50
        try {
UNCOV
51
          final payload = driver.preparePayload(action.dependsOn);
×
52

UNCOV
53
          final res = await driver.transport?.execute(action, payload);
×
54

55
          if (res != null) {
UNCOV
56
            return ServerEvent.parseEvent(res);
×
57
          }
58

59
          return null;
60
        } catch (e, s) {
UNCOV
61
          logger?.error(
×
62
            "[Error while executing transport action]",
63
            error: e,
64
            stackTrace: s,
65
          );
66
        }
67

68
        break;
69
      //local execution
UNCOV
70
      case LocalAction():
×
71
        try {
UNCOV
72
          return action.event;
×
73
        } catch (e, s) {
UNCOV
74
          logger?.error(
×
75
            "[Error while executing local action]",
76
            error: e,
77
            stackTrace: s,
78
          );
79
        }
80
        break;
81
      //script
UNCOV
82
      case ScriptAction():
×
83
        try {
UNCOV
84
          final body = driver.preparePayload(action.dependsOn);
×
85
          final script = action.script;
×
86

UNCOV
87
          final scriptInvocationResult = await driver.scriptRunner?.runScript(
×
88
            script.functionName,
×
89
            url: action.eventName,
×
90
            meta: action.script.meta,
×
91
            body: body,
92
          );
93

94
          if (scriptInvocationResult != null) {
UNCOV
95
            return ServerEvent.parseEvent(scriptInvocationResult);
×
96
          }
97

98
          return null;
99
        } catch (e, s) {
UNCOV
100
          logger?.error(
×
101
            "[Error while executing script action]",
102
            error: e,
103
            stackTrace: s,
104
          );
105
        }
106
        break;
107
    }
108

109
    return null;
110
  }
111
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc