private flattenCompoundActions()

in src/orchestrations/OrchestratorState.ts [37:52]


    private flattenCompoundActions(actions: IAction[]): IAction[] {
        const flatActions: IAction[] = [];
        for (const action of actions) {
            // Given any compound action
            if (action instanceof WhenAllAction || action instanceof WhenAnyAction) {
                // We obtain its inner actions as a flat array
                const innerActionArr = this.flattenCompoundActions(action.compoundActions);
                // we concatenate the inner actions to the flat array we're building
                flatActions.push(...innerActionArr);
            } else {
                // The action wasn't compound, so it's left intact
                flatActions.push(action);
            }
        }
        return flatActions;
    }