Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof nodeId === "string") {
const node = addressSpace.findNode(addressSpace.resolveNodeId(nodeId));
if (node) {
nodeId = node.nodeId;
}
}
const browseResult = {
statusCode: StatusCodes.Good,
continuationPoint: null,
references: null
};
if (browseDescription.browseDirection === BrowseDirection.Invalid) {
browseResult.statusCode = StatusCodes.BadBrowseDirectionInvalid;
return new BrowseResult(browseResult);
}
// check if referenceTypeId is correct
if (browseDescription.referenceTypeId instanceof NodeId) {
if (browseDescription.referenceTypeId.value === 0) {
browseDescription.referenceTypeId = null;
} else {
const rf = addressSpace.findNode(browseDescription.referenceTypeId);
if (!rf || !(rf instanceof ReferenceType)) {
browseResult.statusCode = StatusCodes.BadReferenceTypeIdInvalid;
return new BrowseResult(browseResult);
}
}
}
const obj = addressSpace.findNode(nodeId);
public browseSingleNode(
nodeId: NodeIdLike,
browseDescription: BrowseDescription,
context?: SessionContext
): BrowseResult {
const browseResult: BrowseResultOptions = {
continuationPoint: undefined,
references: null,
statusCode: StatusCodes.Good
};
if (!browseDescription || browseDescription.browseDirection === BrowseDirection.Invalid) {
browseResult.statusCode = StatusCodes.BadBrowseDirectionInvalid;
return new BrowseResult(browseResult);
}
browseDescription.browseDirection =
adjustBrowseDirection(browseDescription.browseDirection, BrowseDirection.Forward);
/* istanbul ignore next */
if (typeof nodeId === "number") {
throw new Error("Not Implemented");
}
if (typeof nodeId === "string") {
const node = this.findNode(this.resolveNodeId(nodeId));
if (node) {
nodeId = node.nodeId;
}
}