Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const web = Web(e["odata.id"], "");
console.log(`Deleting: ${e["odata.id"]}`);
const children = await web.webs.select("Title")();
await Promise.all(children.map(async (value) => {
const web2 = Web(value["odata.id"], "");
console.log(`Deleting: ${value["odata.id"]}`);
return web2.delete();
}));
await web.delete();
console.log(`Deleted: ${e["odata.id"]}`);
});
}
await Promise.all(children.map((value) => {
const web2 = Web(value["odata.id"], "");
console.log(`Deleting: ${value["odata.id"]}`);
return web2.delete();
}));
await Promise.all(children.map(async (value) => {
const web2 = Web(value["odata.id"], "");
console.log(`Deleting: ${value["odata.id"]}`);
return web2.delete();
}));
w.forEach(async (e: any) => {
const web = Web(e["odata.id"], "");
console.log(`Deleting: ${e["odata.id"]}`);
const children = await web.webs.select("Title")();
await Promise.all(children.map(async (value) => {
const web2 = Web(value["odata.id"], "");
console.log(`Deleting: ${value["odata.id"]}`);
return web2.delete();
}));
await web.delete();
console.log(`Deleted: ${e["odata.id"]}`);
});
}
return Promise.all(sw.map((value) => {
const web2 = new Web(value["odata.id"], "");
return web2.delete();
}));
}).then(() => { web.delete(); });
w.forEach((element: any) => {
const web = new Web(element["odata.id"], "");
web.webs.select("Title").get().then((sw: any[]) => {
return Promise.all(sw.map((value) => {
const web2 = new Web(value["odata.id"], "");
return web2.delete();
}));
}).then(() => { web.delete(); });
});
});
export function extractOdataId(candidate: any): string {
if (candidate.hasOwnProperty("odata.id")) {
return candidate["odata.id"];
} else if (candidate.hasOwnProperty("__metadata") && candidate.__metadata.hasOwnProperty("id")) {
return candidate.__metadata.id;
} else {
Logger.log({
data: candidate,
level: LogLevel.Error,
message: "Could not extract odata id in object, you may be using nometadata. Object data logged to logger.",
});
throw new Error("Could not extract odata id in object, you may be using nometadata. Object data logged to logger.");
}
}
function extractOdataId(candidate) {
if (candidate.hasOwnProperty("odata.id")) {
return candidate["odata.id"];
}
else if (candidate.hasOwnProperty("__metadata") && candidate.__metadata.hasOwnProperty("id")) {
return candidate.__metadata.id;
}
else {
logging_1.Logger.log({
data: candidate,
level: logging_1.LogLevel.Error,
message: "Could not extract odata id in object, you may be using nometadata. Object data logged to logger.",
});
throw new Error("Could not extract odata id in object, you may be using nometadata. Object data logged to logger.");
}
}
exports.extractOdataId = extractOdataId;
return this.clone(Site, `openWebById('${webId}')`).postCore().then(d => ({
data: d,
web: Web.fromUrl(d["odata.id"] || d.__metadata.uri),
}));
}
return this.clone(Site, `openWebById('${webId}')`).postCore().then(d => ({
data: d,
web: Web.fromUrl(d["odata.id"] || d.__metadata.uri),
}));
}