Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
default:
if (encodingByte !== EnumNodeIdEncoding.Guid) {
/*jslint bitwise: true */
// console.log(" encoding_byte = 0x" + encodingByte.toString(16),
// " bin=", ("0000000000000000" + encodingByte.toString(2)).substr(-16),
// encodingByte, encodingByte & 0x3f);
throw new Error(" encoding_byte = " + encodingByte.toString(16));
}
namespace = stream.readUInt16();
value = decodeGuid(stream);
nodeIdType = NodeIdType.GUID;
assert(isValidGuid(value));
break;
}
return new NodeId(nodeIdType, value, namespace);
}
value = decodeByteString(stream);
nodeIdType = NodeIdType.BYTESTRING;
break;
default:
if (encoding_byte !== EnumNodeIdEncoding.Guid.value) {
/*jslint bitwise: true */
console.log(" encoding_byte = 0x" + encoding_byte.toString(16)," bin=", ("0000000000000000"+encoding_byte.toString(2)).substr(-16), encoding_byte, encoding_byte & 0x3f);
throw new Error(" encoding_byte = " + encoding_byte.toString(16));
}
namespace = stream.readUInt16();
value = decodeGuid(stream);
nodeIdType = NodeIdType.GUID;
assert(isValidGuid(value));
break;
}
return new NodeId(nodeIdType, value, namespace);
};
function __combineNodeId(parentNodeId: NodeId, name: string) {
let nodeId = null;
if (parentNodeId.identifierType === NodeId.NodeIdType.STRING) {
const childName = parentNodeId.value + NamespaceOptions.nodeIdNameSeparator + name.toString();
nodeId = new NodeId(NodeId.NodeIdType.STRING, childName, parentNodeId.namespace);
}
return nodeId;
}
function _adjust_options(self, options) {
const ns = self.addressSpace.getNamespaceIndex(self.namespaceUri);
if (!options.nodeId) {
const id = self._getNextAvailableId();
options.nodeId = new NodeId(NodeId.NodeIdType.NUMERIC, id, ns);
}
options.nodeId = NodeId.coerce(options.nodeId);
if (typeof options.browseName === "string") {
options.browseName = new QualifiedName({
name: options.browseName,
namespaceIndex: ns
});
}
return options;
}