Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async handleWorkflow(response: Protocol.WorkflowResponse, workflowMap?: { [index: string]: any } ): Promise {
if (StatusSeverity.isError(response.status)
|| StatusSeverity.isCancel(response.status)) {
// error
return Promise.reject(response.status);
}
// not complete, not an error.
if (!workflowMap) {
workflowMap = {};
}
if (response.items) {
for (const item of response.items) {
const strategy: WorkflowResponseStrategy = new WorkflowResponseStrategyManager().getStrategy(item.itemType);
const canceled: boolean = await strategy.handler(item, workflowMap);
if (canceled) {
return;
}
}