Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(resourcesResponse => {
// Save resources to solution item
itemTemplate.resources = (resourcesResponse.resources as any[]).map(
(resourceDetail: any) => resourceDetail.resource
);
const resourceFilePaths: common.ISourceFileCopyPath[] = common.generateSourceFilePaths(
authentication.portal,
itemTemplate.itemId,
itemTemplate.item.thumbnail,
itemTemplate.resources,
true
);
common
.copyFilesToStorageItem(
authentication,
resourceFilePaths,
solutionItemId,
authentication
)
.then(savedResourceFilenames => {
itemTemplate.resources = (savedResourceFilenames as any[]).filter(
item => !!item
);
resolve(itemTemplate);
}, reject);
})
.catch(() => Promise.resolve([]));
.then(resourcesResponse => {
// Save resources to solution item
itemTemplate.resources = (resourcesResponse.resources as any[]).map(
(resourceDetail: any) => resourceDetail.resource
);
const resourceItemFilePaths: common.ISourceFileCopyPath[] = common.generateSourceFilePaths(
authentication.portal,
itemTemplate.itemId,
itemTemplate.item.thumbnail,
itemTemplate.resources
);
return common.copyFilesToStorageItem(
authentication,
resourceItemFilePaths,
solutionItemId,
authentication
);
})
.catch(() => Promise.resolve([]));
.then(resourcesResponse => {
// Save resources to solution item
itemTemplate.resources = (resourcesResponse.resources as any[]).map(
(resourceDetail: any) => resourceDetail.resource
);
const resourceItemFilePaths: common.ISourceFileCopyPath[] = common.generateSourceFilePaths(
authentication.portal,
itemTemplate.itemId,
itemTemplate.item.thumbnail,
itemTemplate.resources
);
return common.copyFilesToStorageItem(
authentication,
resourceItemFilePaths,
solutionItemId,
authentication
);
});