Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
itemInfo => {
const placeholder = common.findTemplateInList(
existingTemplates,
itemId
);
let itemType = placeholder!.type;
if (!itemType) {
// Groups have this defined when fetched above
itemType = itemInfo.type;
placeholder!.type = itemType;
}
itemInfo.type = itemType; // Groups don't have this property
const itemHandler = moduleMap[itemType];
if (!itemHandler) {
placeholder!.properties["partial"] = true;
_replaceTemplate(existingTemplates, itemId, placeholder!);
console.log(
itemTemplate.dependencies.forEach(dependentId => {
if (
!common.findTemplateInList(
existingTemplates,
dependentId
)
) {
dependentDfds.push(
createItemTemplate(
solutionItemId,
dependentId,
templateDictionary,
authentication,
existingTemplates
)
);
}
});
// tslint:disable-next-line: no-floating-promises
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")
cloneOrderChecklist.forEach(id => {
// Get the item's template out of the list of templates
const template = common.findTemplateInList(templates, id);
if (!template) {
reject(common.fail());
}
awaitAllItems.push(
_createItemFromTemplateWhenReady(
template!,
common.generateStorageFilePaths(
portalSharingUrl,
storageItemId,
template!.resources || []
),
storageAuthentication,
templateDictionary,
destinationAuthentication,
progressTickCallback