Skip to content

Commit bbc3bc2

Browse files
committed
update
1 parent 69c9b34 commit bbc3bc2

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

src/configuration/apiConfiguration.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff 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

src/configuration/parsedApiConfigurationTypes.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff 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-
237
export interface ApiCommunication {
248
attributes: {
259
componentCode: string;

0 commit comments

Comments
 (0)