function extractResult()

in src/orchestrations/TaskOrchestrationExecutor.ts [246:269]


        function extractResult(completionEvent: HistoryEvent): unknown {
            let taskResult: unknown;

            switch (completionEvent.EventType) {
                case HistoryEventType.SubOrchestrationInstanceCompleted:
                    taskResult = JSON.parse(
                        (completionEvent as SubOrchestrationInstanceCompletedEvent).Result
                    );
                    break;
                case HistoryEventType.TaskCompleted:
                    taskResult = JSON.parse((completionEvent as TaskCompletedEvent).Result);
                    break;
                case HistoryEventType.EventRaised:
                    const eventRaised = completionEvent as EventRaisedEvent;
                    taskResult =
                        eventRaised && eventRaised.Input
                            ? JSON.parse(eventRaised.Input)
                            : undefined;
                    break;
                default:
                    break;
            }
            return taskResult;
        }