Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function resolveDynamicExtensionObjectV(
opaque: OpaqueStructure,
extraDataType: ExtraDataTypeManager
): ExtensionObject {
try {
const namespaceUri = extraDataType.namespaceArray[opaque.nodeId.namespace];
const expandedNodeId = ExpandedNodeId.fromNodeId(opaque.nodeId, namespaceUri);
const typeDictionary = extraDataType.getTypeDictionaryForNamespace(opaque.nodeId.namespace);
const Constructor = extraDataType.getExtensionObjectConstructorFromBinaryEncoding(opaque.nodeId);
const object = new Constructor();
const stream = new BinaryStream(opaque.buffer);
object.decode(stream);
return object;
} catch (err) {
// tslint:disable-next-line:no-console
console.log("resolveDynamicExtensionObjectV err = ", err);
return opaque;
}
}
const binaryEncodingNodeIds = results2.map((br: BrowseResult) => {
const defaultBin = br.references!.filter((r: ReferenceDescription) => r.browseName.toString() === "Default Binary");
/* istanbul ignore next */
if (defaultBin.length < 1) {
return ExpandedNodeId;
}
return ExpandedNodeId.fromNodeId(defaultBin[0].nodeId, namespaces[defaultBin[0].nodeId.namespace]);
});
public get binaryEncodingNodeId() {
const _cache = BaseNode._getCache(this);
if (!_cache.binaryEncodingNodeId) {
const encoding = this.getEncodingNode("Default Binary");
if (encoding) {
const namespaceUri = this.addressSpace.getNamespaceUri(encoding.nodeId.namespace);
_cache.binaryEncodingNodeId = ExpandedNodeId.fromNodeId(encoding.nodeId, namespaceUri);
} else {
_cache.binaryEncodingNodeId = null;
}
}
return _cache.binaryEncodingNodeId;
}
public get xmlEncodingNodeId(): NodeId {
const _cache = BaseNode._getCache(this);
if (!_cache.xmlEncodingNodeId) {
const encoding = this.getEncodingNode("Default Xml");
if (encoding) {
const namespaceUri = this.addressSpace.getNamespaceUri(encoding.nodeId.namespace);
_cache.xmlEncodingNodeId = ExpandedNodeId.fromNodeId(encoding.nodeId, namespaceUri);
} else {
_cache.xmlEncodingNodeId = null;
}
}
return _cache.xmlEncodingNodeId;
}