Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async getChildren(
client: ADTClient
): Promise {
if (this.isLeaf()) throw FileSystemError.FileNotADirectory(this.vsName)
if (!this.structure) await this.loadMetadata(client)
if (!this.structure) throw FileSystemError.FileNotFound(this.vsName)
const ns: NodeStructureMapped = {
categories: new Map(),
objectTypes: new Map(),
nodes: []
}
const main = this.selfLeafNode()
main.OBJECT_URI = ADTClient.mainInclude(this.structure)
const sources = ADTClient.classIncludes(this.structure)
this.structure.includes.forEach(i => {
const node = {
EXPANDABLE: "",
OBJECT_NAME: this.name + "." + i["class:includeType"],
OBJECT_TYPE: i["adtcore:type"],
OBJECT_URI: sources.get(i["class:includeType"] as classIncludes) || "",
OBJECT_VIT_URI: "",
TECH_NAME: i["class:includeType"] // bit of a hack, used to match include metadata
}
if (node.OBJECT_URI) {
if (i["abapsource:sourceUri"] === "source/main") ns.nodes.unshift(node)
else ns.nodes.push(node)
}
})
const aggregated = aggregateNodes(ns, this.type)
public getContentsUri(): string {
if (!this.structure || !this.techName)
throw FileSystemError.FileNotFound(this.path)
const include = ADTClient.classIncludes(this.structure).get(this
.techName as classIncludes)
if (!include) throw FileSystemError.FileNotFound(this.path)
return include
}