Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let dataPromise = Promise.resolve({});
let relatedPromise = Promise.resolve({} as common.IGetRelatedItemsResponse);
switch (itemInfo.type) {
case "Dashboard":
case "Feature Service":
case "Project Package":
case "Workforce Project":
case "Web Map":
case "Web Mapping Application":
dataPromise = common.getItemDataAsJson(
itemTemplate.itemId,
authentication
);
break;
case "Form":
dataPromise = common.getItemDataAsFile(
itemTemplate.itemId,
itemTemplate.item.name,
authentication
);
relatedPromise = common.getItemRelatedItems(
itemTemplate.itemId,
"Survey2Service",
"forward",
authentication
);
break;
}
// Errors are handled as resolved empty values; this means that there's no `reject` clause to handle, hence:
// tslint:disable-next-line:no-floating-promises
Promise.all([dataPromise, resourcePromise, relatedPromise]).then(
(itemBase: any) => {
common
.getItemDataAsFile(itemId, itemBase.name, authentication)
.then(resolve2, (error: any) => reject2(JSON.stringify(error)));
}
);
const dataPromise = new Promise(dataResolve => {
common
.getItemDataAsFile(
itemTemplate.itemId,
itemTemplate.item.name,
authentication
)
.then(
response => {
if (!response || response.size === 0) {
dataResolve();
} else {
dataResolve(response);
}
},
() => {
dataResolve();
}
(itemBase: any) => {
solutionCommon
.getItemDataAsFile(itemId, itemBase.name, authentication)
.then(resolve2, (error: any) => reject2(error));
}
);
(itemBase: any) => {
common
.getItemDataAsFile(itemId, itemBase.name, authentication)
.then(resolve2, (error: any) => reject2(JSON.stringify(error)));
}
);
(itemBase: any) => {
common
.getItemDataAsFile(itemId, itemBase.name, sourceAuthentication)
.then(resolve2, (error: any) => reject2(JSON.stringify(error)));
}
);