File tree Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -78,10 +78,17 @@ export class DefaultApiConfiguration implements ApiConfiguration {
78
78
}
79
79
80
80
private findStateByCode ( stateMachine : StateMachine , stateCode : number ) : State {
81
- const result = stateMachine . states [ 0 ] . State . find ( state => Number ( state . attributes . id ) === stateCode ) ;
81
+ const statesArray = stateMachine . states [ 0 ] ?. State ;
82
+
83
+ if ( ! statesArray ) {
84
+ throw new Error ( `State '${ stateCode } ' not found` ) ;
85
+ }
86
+
87
+ const result = statesArray . find ( state => Number ( state . attributes . id ) === stateCode ) ;
82
88
if ( ! result ) {
83
89
throw new Error ( `State '${ stateCode } ' not found` ) ;
84
90
}
91
+
85
92
return result ;
86
93
}
87
94
Original file line number Diff line number Diff line change @@ -4,22 +4,6 @@ export interface ParsedApiConfiguration {
4
4
deployment : Deployment ;
5
5
}
6
6
7
- export type RawCommunication = {
8
- componentCode ?: string ;
9
- stateMachineCode ?: string ;
10
- eventType ?: string ;
11
- event ?: string ;
12
- eventCode ?: string ;
13
- topic ?: { value ?: string } | { value ?: string } [ ] ;
14
- attributes ?: {
15
- componentCode ?: string ;
16
- stateMachineCode ?: string ;
17
- eventType ?: string ;
18
- event ?: string ;
19
- eventCode ?: string ;
20
- } ;
21
- } ;
22
-
23
7
export interface ApiCommunication {
24
8
attributes : {
25
9
componentCode : string ;
You can’t perform that action at this time.
0 commit comments