Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
// Create item
const createOptions: portal.ICreateItemOptions = {
item: {
...itemInfo
},
folderId,
authentication: authentication
};
if (itemThumbnailUrl) {
createOptions.item.thumbnailurl = itemThumbnailUrl;
}
portal.createItemInFolder(createOptions).then(
createResponse => {
if (createResponse.success) {
let accessDef: Promise;
// Set access if it is not AGOL default
// Set the access manually since the access value in createItem appears to be ignored
// Need to run serially; will not work reliably if done in parallel with adding the data section
if (access !== "private") {
const accessOptions: portal.ISetAccessOptions = {
id: createResponse.id,
access: access === "public" ? "public" : "org", // need to use constants rather than string
authentication: authentication
};
accessDef = portal.setItemAccess(accessOptions);
} else {
accessDef = Promise.resolve({