Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log(" session.read(nodesToRead,function(err,nodesToRead,results) {}".cyan);
console.log(" with .... :".red);
console.log(" session.read(nodesToRead,function(err,dataValues) {}".cyan);
console.log("");
console.log("please make sure to refactor your code and check that he second argument of your callback function is named".yellow,("dataValue" + (isArray?"s":"")).cyan);
console.log("to make this exception disappear".yellow);
throw new Error("ERROR ClientSession#read API has changed !!, please fix the client code");
}
}
// coerce nodeIds
for (const node of nodesToRead) {
node.nodeId = resolveNodeId(node.nodeId);
}
const request = new read_service.ReadRequest({
nodesToRead: nodesToRead,
maxAge: maxAge,
timestampsToReturn: read_service.TimestampsToReturn.Both
});
self.performMessageTransaction(request, function (err, response) {
/* istanbul ignore next */
if (err) {
return callback(err, response);
}
assert(response instanceof read_service.ReadResponse);
const result =isArray? response.results : response.results[0];
return callback(null,result);
return new read_service.ReadValueId({
nodeId: resolveNodeId(node),
attributeId: read_service.AttributeIds.Value,
indexRange: null,
dataEncoding: {namespaceIndex: 0, name: null}
});
} else {
assert(node instanceof Object);
return new read_service.ReadValueId(node);
}
}
const nodesToRead = nodes.map(coerceReadValueId);
const request = new read_service.ReadRequest({
nodesToRead: nodesToRead,
timestampsToReturn: read_service.TimestampsToReturn.Neither
});
assert(nodes.length === request.nodesToRead.length);
self.performMessageTransaction(request, function (err, response) {
/* istanbul ignore next */
if (err) {
return callback(err, response);
}
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
return callback(new Error(response.responseHeader.serviceResult.toString()));
}
assert(response instanceof read_service.ReadResponse);