Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (schema.baseType !== "ExtensionObject") {
BaseClass = getOrCreateConstructor(schema.baseType, typeDictionary);
if (!BaseClass) {
throw new Error("Cannot find base class : " + schema.baseType);
}
if ((BaseClass as any).possibleFields) {
possibleFields = (BaseClass as any).possibleFields.concat(possibleFields);
}
schema._baseSchema = BaseClass.schema;
}
// tslint:disable-next-line:max-classes-per-file
class EXTENSION extends BaseClass {
public static encodingDefaultXml = new ExpandedNodeId(NodeIdType.NUMERIC, 0, 0);
public static encodingDefaultBinary = new ExpandedNodeId(NodeIdType.NUMERIC, 0, 0);
public static possibleFields = possibleFields;
public static schema = schema;
constructor(options?: any, schema2?: StructuredTypeSchema, typeDictionary2?: TypeDictionary) {
super(options, schema2 ? schema2 : schema, typeDictionary2 ? typeDictionary2 : typeDictionary);
}
public toString(): string {
return super.toString();
}
}
// to do : may be remove DataType suffix here ?
Object.defineProperty(EXTENSION, "name", { value: schema.name });
let BaseClass: AnyConstructorFunc = DynamicExtensionObject as AnyConstructorFunc;
if (schema.baseType !== "ExtensionObject") {
BaseClass = getOrCreateConstructor(schema.baseType, typeDictionary);
if (!BaseClass) {
throw new Error("Cannot find base class : " + schema.baseType);
}
if ((BaseClass as any).possibleFields) {
possibleFields = (BaseClass as any).possibleFields.concat(possibleFields);
}
schema._baseSchema = BaseClass.schema;
}
// tslint:disable-next-line:max-classes-per-file
class EXTENSION extends BaseClass {
public static encodingDefaultXml = new ExpandedNodeId(NodeIdType.NUMERIC, 0, 0);
public static encodingDefaultBinary = new ExpandedNodeId(NodeIdType.NUMERIC, 0, 0);
public static possibleFields = possibleFields;
public static schema = schema;
constructor(options?: any, schema2?: StructuredTypeSchema, typeDictionary2?: TypeDictionary) {
super(options, schema2 ? schema2 : schema, typeDictionary2 ? typeDictionary2 : typeDictionary);
}
public toString(): string {
return super.toString();
}
}
// to do : may be remove DataType suffix here ?
Object.defineProperty(EXTENSION, "name", { value: schema.name });
export function decodeExpandedNodeId(stream: BinaryStream): ExpandedNodeId {
const encodingByte = stream.readUInt8();
const expandedNodeId = _decodeNodeId(encodingByte, stream) as ExpandedNodeId;
expandedNodeId.namespaceUri = null;
expandedNodeId.serverIndex = 0;
if (encodingByte & EnumNodeIdEncoding.NamespaceUriFlag) {
expandedNodeId.namespaceUri = decodeString(stream);
}
if (encodingByte & EnumNodeIdEncoding.ServerIndexFlag) {
expandedNodeId.serverIndex = decodeUInt32(stream);
}
const e: ExpandedNodeId = expandedNodeId;
return new ExpandedNodeId(e.identifierType, e.value, e.namespace, e.namespaceUri, e.serverIndex);
}