Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
() => {
_replaceTemplate(
existingTemplates,
itemId,
common.createPlaceholderTemplate(itemId, "unknown")
);
console.log(
"!----- " +
itemId +
" ----- FAILED Id not found or item is not accessible -----"
); // ???
resolve(true);
}
);
.catch(() => {
// If item query fails, try fetching item as a group
// Change its placeholder from an empty type to the Group type so that we can later distinguish
// between items and groups (the base info for a group doesn't include a type property)
_replaceTemplate(
existingTemplates,
itemId,
common.createPlaceholderTemplate(itemId, "Group")
);
return common.getGroup(itemId, authentication);
})
.then(
return new Promise(resolve => {
// Check if item and its dependents are already in list or are queued
if (common.findTemplateInList(existingTemplates, itemId)) {
resolve(true);
} else {
// Add the id as a placeholder to show that it is being fetched
existingTemplates.push(common.createPlaceholderTemplate(itemId));
// Fetch the item
common
.getItem(itemId, authentication)
.catch(() => {
// If item query fails, try fetching item as a group
// Change its placeholder from an empty type to the Group type so that we can later distinguish
// between items and groups (the base info for a group doesn't include a type property)
_replaceTemplate(
existingTemplates,
itemId,
common.createPlaceholderTemplate(itemId, "Group")
);
return common.getGroup(itemId, authentication);
})
.then(