Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lambda: (interval: Interval, aggregateConfiguration: AggregateConfigurationOptionsEx) => DataValue,
callback: (err: Error | null, dataValues?: DataValue[]) => void
) {
/* istanbul ignore next */
if (!(node.constructor.name === "UAVariable")) {
throw new Error("node must be UAVariable");
}
/* istanbul ignore next */
if (processingInterval <= 0) {
throw new Error("Invalid processing interval, shall be greater than 0");
}
const context = new SessionContext();
const historyReadDetails = new ReadRawModifiedDetails({
endTime: endDate,
startTime: startDate,
});
const indexRange = null;
const dataEncoding = null;
const continuationPoint = null;
node.historyRead(context, historyReadDetails, indexRange, dataEncoding, continuationPoint,
(err: Error | null, result?: HistoryReadResult) => {
/* istanbul ignore next */
if (err) {
return callback(err);
}
const historyData = result!.historyData as HistoryData;
const dataValues = historyData.dataValues || [];
if (!isArray) {
nodes = [nodes];
}
const nodesToRead = [];
const historyReadDetails = [];
for( const node of nodes) {
nodesToRead.push({
nodeId: resolveNodeId(node),
indexRange: null,
dataEncoding: {namespaceIndex: 0, name: null},
continuationPoint: null
});
}
const ReadRawModifiedDetails = new historizing_service.ReadRawModifiedDetails({
isReadModified: false,
startTime: start,
endTime: end,
numValuesPerNode: 0,
returnBounds: true
});
const request = new historizing_service.HistoryReadRequest({
nodesToRead: nodesToRead,
historyReadDetails: ReadRawModifiedDetails,
timestampsToReturn: read_service.TimestampsToReturn.Both,
releaseContinuationPoints: false
});
assert(nodes.length === request.nodesToRead.length);
self.performMessageTransaction(request, function (err, response) {