Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(value => {
let defer2 = q.defer();
let hitPromises = [];
let hits = JSON.parse(value.body).hits;
// console.log('\nhits\n')
// console.log(hits);
//console.log(hits); not here
for (let i in hits) {
let id = hits[i].id;
//console.log("Getting document " + id); not here
hitPromises.push(getDocument({indexName : 'es.db', documentID : id}));
}
q.allSettled(hitPromises).then(values => {
//console.log(values.map(val => val.value)); not here
return defer2.resolve((parseResults(values)));
})
return defer2.promise;
}).then(value => {
return defer.resolve(value);
var self = this;
var correctedPathPromises = self.brokenReferences.map(function(brokenReference) {
var correctedPath = gitParser.getCorrectedPathFromGit(brokenReference);
return utils.doesFileExist(correctedPath, self.existingFiles)
.then(function(isCorrectedPathExtant) {
if (isCorrectedPathExtant) {
brokenReference.correctPath = correctedPath;
} else {
brokenReference = self.determineCorrectPathForReference(brokenReference);
}
return true;
})
.handleError();
});
// Must be run after all references are corrected because it depends upon corrected references
return Q.allSettled(correctedPathPromises)
.then(function() {
self.brokenReferences.forEach(function(brokenReference) {
if (brokenReference.possibleCorrectPaths.length > 1) {
brokenReference.correctPath = self.getCorrectPathForDuplicateFilename(brokenReference);
}
});
return true;
})
.handleError();
},
.then(function () {
const successEntry = i18n.__(item.id ? successKey : "cli_pull_invalid_file_deleted", item);
logger.info(successEntry);
deletedItems.push(item);
})
.catch(function (err) {
const errorEntry = i18n.__(item.id ? errorKey : "cli_pull_invalid_file_delete_error", {path: item.path, message: err.message});
logger.error(errorEntry);
});
// Add each delete promise to the list.
promises.push(promise);
});
// Return a promise that is resolved when all delete promises have been settled.
return Q.allSettled(promises)
.then(function () {
// Resolve the promise with the list of deleted items.
return deletedItems;
});
} else {
// Prompt to delete each item that only exists locally.
const schemaInput = {};
items.forEach(function (item) {
// For each matching file, add a confirmation prompt (keyed by the artifact id).
schemaInput[item.id || item.path] =
{
description: i18n.__(item.id ? promptKey : "cli_pull_invalid_file_delete_confirm", item),
required: true
};
});
function validatePlatform() {
// run platform-specific validation rules
var platformTasks = platformModules.map(function (platform) {
return platform.getValidationRules(platforms).then(function (rules) {
return runValidationRules(w3cManifestInfo, rules).then(function (results) {
allResults.push.apply(allResults, results);
});
});
});
return Q.allSettled(platformTasks);
}
console.warn('Fetch failed for', component.displayName)
props.error = true
}
component.defaultProps = { ...component.defaultProps, ...props }
resolve(component)
} catch (error) {
if (debug) {
console.warn('Rejected in an array from fetchData. Component: ', component.displayName)
console.warn('Error: ', error)
}
reject(component)
}
} else {
Q.allSettled(keys.map(key => fetch[key]))
.then(responses => {
responses.forEach((data, index) => {
if (data.value) {
props[keys[index]] = data.value
} else {
props[keys[index]] = data.reason
debug && console.warn(`Fetch #${index + 1} in ${component.displayName} returned: ${data.reason}`)
}
})
component.defaultProps = { ...component.defaultProps, ...props }
resolve(component)
})
.catch(error => {
if (debug) {
console.warn('Rejected in an array from fetchData. Component: ', component.displayName)
updatedKeys.forEach(key => {
result[component.displayName][key] = response[key]
})
} catch (error) {
console.info(`fetchData failed for ${component.displayName}`, error)
props.error = true
}
} catch (error) {
console.info(`fetchData failed for ${component.displayName}`, error)
}
return result
}
try {
const responses = await Q.allSettled(keys.map(key => fetch[key]))
responses.forEach((data, index) => {
if (data.value) {
result[component.displayName][keys[index]] = data.value
} else {
result[component.displayName][keys[index]] = data.reason
console.info(`fetchData #${index + 1} in ${component.displayName} returned undefined.`)
}
})
} catch (error) {
console.info(`fetchData failed for ${component.displayName}`, error)
}
return result
}
.finally(function () {
logger.debug('Closing database connections...');
return Q.allSettled([storage.closeDatabase(), gmeAuth.unload(), Q.ninvoke(mongoConn, 'close')])
.finally(function () {
logger.debug('Closed.');
if (err) {
throw err;
}
});
});
}
//get a list of files.
var tree = res.tree;
var promises = tree.filter(Parser.isStyleFile).map(function (file) {
return getContent({user: user, repo: repo, path: file.path});
//return Q(undefined);
});
return Q.all(promises);
});
});
});
return Q.allSettled(promises);
},
}).then(response => {
let taskArray = [];
for (let i in response) {
taskArray.push(classify(currentPath, response[i]));
}
return q.allSettled(taskArray);
}).then(response => {
let responseStructure = {