File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,10 +78,17 @@ export class DefaultApiConfiguration implements ApiConfiguration {
7878 }
7979
8080 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 ) ;
8288 if ( ! result ) {
8389 throw new Error ( `State '${ stateCode } ' not found` ) ;
8490 }
91+
8592 return result ;
8693 }
8794
Original file line number Diff line number Diff line change @@ -4,22 +4,6 @@ export interface ParsedApiConfiguration {
44 deployment : Deployment ;
55}
66
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-
237export interface ApiCommunication {
248 attributes : {
259 componentCode : string ;
You can’t perform that action at this time.
0 commit comments