Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function dumpReferenceDescription(addressSpace, referenceDescription) {
assert(addressSpace.constructor.name === "AddressSpace");
// assert(addressSpace instanceof AddressSpace);
assert(referenceDescription.referenceTypeId); // must be known;
console.log("referenceDescription".red);
console.log(" referenceTypeId : ", referenceTypeToString(addressSpace, referenceDescription.referenceTypeId));
console.log(" isForward : ", referenceDescription.isForward ? "true" : "false");
console.log(" nodeId : ", nodeIdInfo(addressSpace, referenceDescription.nodeId));
console.log(" browseName : ", referenceDescription.browseName.toString());
console.log(" nodeClass : ", referenceDescription.nodeClass.toString());
console.log(" typeDefinition : ", nodeIdInfo(addressSpace, referenceDescription.typeDefinition));
}
function dumpReferenceDescriptions(addressSpace, referenceDescriptions) {
function hasChildWithBrowseName(parent,childBrowseName) {
assert(parent instanceof BaseNode);
// extract children
const children = parent.findReferencesAsObject("HasChild", true);
return children.filter(child => child.browseName.name.toString() === childBrowseName).length > 0;
}
function _install_TwoStateVariable_machinery(node,options) {
assert(node.dataTypeObj.browseName.toString() === "LocalizedText");
assert(node.minimumSamplingInterval === 0);
assert(node.typeDefinitionObj.browseName.toString() === "TwoStateVariableType");
assert(node.dataTypeObj.browseName.toString() === "LocalizedText");
assert(node.hasOwnProperty("valueRank") && (node.valueRank === -1 || node.valueRank === 0));
assert(node.hasOwnProperty("id"));
options = options || {};
// promote node into a UATwoStateVariable
Object.setPrototypeOf(node, UATwoStateVariable.prototype);
node.initialize(options);
}
function _install_condition_variable_type(node) {
// from spec 1.03 : 5.3 condition variables
// However, a change in their value is considered important and supposed to trigger
// an Event Notification. These information elements are called ConditionVariables.
node.sourceTimestamp.accessLevel = makeAccessLevel("CurrentRead");
node.accessLevel = makeAccessLevel("CurrentRead");
// from spec 1.03 : 5.3 condition variables
// a condition VariableType has a sourceTimeStamp exposed property
// SourceTimestamp indicates the time of the last change of the Value of this ConditionVariable.
// It shall be the same time that would be returned from the Read Service inside the DataValue
// structure for the ConditionVariable Value Attribute.
assert(node.typeDefinitionObj.browseName.toString() === "ConditionVariableType");
assert(node.sourceTimestamp.browseName.toString() == "SourceTimestamp");
node.on("value_changed", _update_sourceTimestamp);
}
it("Counter test, not nested Obj", () => {
let action = { type: "sub", status: "success", count: 1 };
let newCounter = reducers(counter, action);
assert(newCounter.count === 0, "Problem in status test of success");
action = { type: "sub", status: "error", count: 1 };
newCounter = reducers(counter, action);
assert(newCounter.count === 0.5, "Problem in status test of error");
});
});
getFolderElementByName(browseName) {
assert(typeof browseName === "string");
const elements = this.getFolderElements();
const select = elements.filter(c => c.browseName.toString() === browseName);
return select.length === 1 ? select[0] : null;
}
function dumpReferenceDescriptions(addressSpace, referenceDescriptions) {
assert(addressSpace);
assert(addressSpace.constructor.name === "AddressSpace");
assert(_.isArray(referenceDescriptions));
referenceDescriptions.forEach((r) => {
dumpReferenceDescription(addressSpace, r);
});
}
export { dumpReferenceDescription };
const encodeStatusCode = (statusCode, stream) => {
assert(statusCode instanceof StatusCode || statusCode instanceof ConstantStatusCode);
stream.writeUInt32(statusCode.value);
};
function install(AddressSpace) {
assert(_.isUndefined(AddressSpace._install_TwoStateVariable_machinery));
AddressSpace._install_TwoStateVariable_machinery = _install_TwoStateVariable_machinery;
/**
*
* @method addTwoStateVariable
*
* @param options
* @param options.browseName {String}
* @param [options.description {String}]
* @param [options.modellingRule {String}]
* @param [options.minimumSamplingInterval {Number} =0]
* @param options.componentOf {Node|NodeId}
* @param options.propertyOf {Node|NodeId}
* @param options.trueState {String}
* @param options.falseState {String}
* @param [options.isTrueSubStateOf {NodeId}]
function dumpReferenceDescriptions(addressSpace, referenceDescriptions) {
assert(addressSpace);
assert(addressSpace.constructor.name === "AddressSpace");
assert(_.isArray(referenceDescriptions));
referenceDescriptions.forEach((r) => {
dumpReferenceDescription(addressSpace, r);
});
}
export { dumpReferenceDescription };