Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!eventTypeNode || !(eventTypeNode.nodeClass === NodeClass.ObjectType)) {
// xx console.log("eventTypeNode = ",selectClause.typeDefinitionId.toString());
// xx console.log("eventTypeNode = ",eventTypeNode);
// istanbul ignore next
if (eventTypeNode) {
console.log(eventTypeNode.toString());
}
}
// istanbul ignore next
if (eventTypeNode.nodeClass !== NodeClass.ObjectType) {
throw new Error("Expecting a ObjectType");
}
// navigate to the innerNode specified by the browsePath [ QualifiedName]
const browsePath = constructBrowsePathFromQualifiedName(eventTypeNode, selectClause.browsePath);
const browsePathResult = addressSpace.browsePath(browsePath);
return browsePathResult.statusCode;
}
public resolveSelectClause(selectClause: SimpleAttributeOperand) {
const self = this;
assert(selectClause instanceof SimpleAttributeOperand);
const addressSpace = self.$eventDataSource.addressSpace;
if (selectClause.browsePath!.length === 0 && selectClause.attributeId === AttributeIds.NodeId) {
assert(!"Cannot use resolveSelectClause on this selectClause as it has no browsePath");
}
// navigate to the innerNode specified by the browsePath [ QualifiedName]
const browsePath = constructBrowsePathFromQualifiedName(self.$eventDataSource, selectClause.browsePath);
// xx console.log(self.$eventDataSource.browseName.toString());
// xx console.log("xx browse Path", browsePath.toString());
const browsePathResult = addressSpace.browsePath(browsePath);
// xx console.log(" br",
// self.$eventDataSource.nodeId.toString(),
// selectClause.browsePath.toString(),
// browsePathResult.targets[0] ? browsePathResult.targets[0].targetId.toString() : "!!!NOT FOUND!!!"é)
if (browsePathResult.statusCode !== StatusCodes.Good) {
return null;
}
if (!browsePathResult.targets) {
return null;
EventData.prototype.resolveSelectClause = function(selectClause) {
const self = this;
assert(selectClause instanceof SimpleAttributeOperand);
const addressSpace = self.$eventDataSource.addressSpace;
if (selectClause.browsePath.length === 0 && selectClause.attributeId === AttributeIds.NodeId) {
assert(!"Cannot use resolveSelectClause on this selectClause as it has no browsePath");
}
// navigate to the innerNode specified by the browsePath [ QualifiedName]
const browsePath = constructBrowsePathFromQualifiedName(self.$eventDataSource, selectClause.browsePath);
//xx console.log(self.$eventDataSource.browseName.toString());
//xx console.log("xxxxxxxxxxxxx browse Pathx", browsePath.toString());
const browsePathResult = addressSpace.browsePath(browsePath);
//xx console.log(" br",self.$eventDataSource.nodeId.toString(),selectClause.browsePath.toString(),browsePathResult.targets[0] ? browsePathResult.targets[0].targetId.toString() : "!!!NOT FOUNF!!!".cyan)
if (browsePathResult.statusCode !== StatusCodes.Good) {
return null;
}
// istanbul ignore next
if (browsePathResult.targets.length !== 1) {
//xx console.log("selectClause ",selectClause.toString());
//xx console.log("browsePathResult ",browsePathResult.toString());
//xx throw new Error("browsePathResult.targets.length !== 1" + browsePathResult.targets.length);