Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const namespaceUri = addressSpace.getNamespaceUri(dataType.nodeId.namespace);
// istanbul ignore next
if (!dataType.binaryEncodingNodeId) {
throw new Error(
"DataType with name " +
dataType.browseName.toString() +
" has no binaryEncoding node\nplease check your nodeset file"
);
}
// if binaryEncodingNodeId is in the standard factory => no need to overwrite
if (!bForce && (hasConstructor(dataType.binaryEncodingNodeId) || dataType.binaryEncodingNodeId.namespace === 0)) {
//xx console.log(chalk.bgYellow("Skipping standard constructor") ," for dataType" ,dataType.browseName.toString());
return getConstructor(dataType.binaryEncodingNodeId);
}
const schema = constructSchema(addressSpace, dataType);
generateFileCode(namespaceUri, schema, schema_folder);
generateStructureCode(namespaceUri, schema);
const filename = getSchemaSourceFile(namespaceUri, schema.name, "");
const relative_filename = normalize_require_file(__dirname, filename);
const constructor = require(relative_filename)[schema.name];
assert(_.isFunction(constructor), "expecting a constructor here");
return constructor;
assert(dataType instanceof UADataType);
const addressSpace = dataType.addressSpace;
assert(addressSpace.constructor.name === "AddressSpace");
assert(addressSpace instanceof AddressSpace);
// istanbul ignore next
if (!dataType.binaryEncodingNodeId) {
throw new Error("DataType with name " + dataType.browseName.toString() + " has no binaryEncoding node\nplease check your nodeset file");
}
// if binaryEncodingNodeId is in the standard factory => no need to overwrite
if (!bForce && (hasConstructor(dataType.binaryEncodingNodeId) || dataType.binaryEncodingNodeId.namespace === 0)) {
//xx console.log("Skipping standard constructor".bgYellow ," for dataType" ,dataType.browseName.toString());
return getConstructor(dataType.binaryEncodingNodeId);
}
// etc ..... please fix me
const namespaceUri = addressSpace.getNamespaceUri(dataType.nodeId.namespace);
return buildConstructorFromDefinition(addressSpace,dataType);
}