How to use the node-opcua-factory.hasBuiltInType function in node-opcua-factory

To help you get started, we’ve selected a few node-opcua-factory examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-schemas / source / tools.ts View on Github external
if (hasBuiltInType(fieldTypeName)) {
                                field.category = FieldCategory.basic;
                            } else {
                                field.category = FieldCategory.complex;
                            }
                        }
                    }
                    break;
                case "opc":
                    if ((fieldTypeName === "UAString" || fieldTypeName === "String") && field.name === "IndexRange") {
                        field.fieldType = "NumericRange";
                        // xx console.log(" NumericRange detected here !");
                    } else {
                        field.fieldType = fieldTypeName;
                    }
                    if (!hasBuiltInType(fieldTypeName)) {
                        throw new Error("Unknown basic type " + fieldTypeName);
                    }
                    field.category = FieldCategory.basic;
                    break;
            }
        }
    }

    structuredTypeSchema = buildStructuredType(structuredType as StructuredTypeOptions);
    typeDictionary.structuredTypes[name] = structuredTypeSchema;
    return structuredTypeSchema;

}
github node-opcua / node-opcua / packages / node-opcua-schemas / source / tools.ts View on Github external
field.category = FieldCategory.enumeration;
                        field.schema = enumeratedType;

                    } else {
                        // must be a structure then ....
                        field.category = FieldCategory.complex;
                        field.schema = getOrCreateStructuredTypeSchema(fieldTypeName, typeDictionary);
                        if (!field.schema) {
                            // tslint:disable-next-line:no-console
                            console.log("cannot find schema for ", fieldTypeName);
                        }
                    }
                    break;
                case "ua":
                    field.fieldType = fieldTypeName;
                    if (hasBuiltInType(fieldTypeName)) {
                        field.category = FieldCategory.basic;
                        field.schema = getBuildInType(fieldTypeName);
                    } else if (hasStructuredType(fieldTypeName)) {
                        field.category = FieldCategory.complex;
                        field.schema = getStructuredTypeSchema(fieldTypeName);

                    } else {
                        field.category = FieldCategory.basic;
                        // try in this
                        field.schema = getOrCreateStructuredTypeSchema(fieldTypeName, typeDictionary);
                        if (!field.schema) {
                            // tslint:disable-next-line:no-console
                            console.log("What should I do ??", fieldTypeName, " ", hasStructuredType(fieldTypeName));
                        } else {
                            if (hasBuiltInType(fieldTypeName)) {
                                field.category = FieldCategory.basic;
github node-opcua / node-opcua / packages / node-opcua-schemas / source / tools.ts View on Github external
if (hasBuiltInType(fieldTypeName)) {
                        field.category = FieldCategory.basic;
                        field.schema = getBuildInType(fieldTypeName);
                    } else if (hasStructuredType(fieldTypeName)) {
                        field.category = FieldCategory.complex;
                        field.schema = getStructuredTypeSchema(fieldTypeName);

                    } else {
                        field.category = FieldCategory.basic;
                        // try in this
                        field.schema = getOrCreateStructuredTypeSchema(fieldTypeName, typeDictionary);
                        if (!field.schema) {
                            // tslint:disable-next-line:no-console
                            console.log("What should I do ??", fieldTypeName, " ", hasStructuredType(fieldTypeName));
                        } else {
                            if (hasBuiltInType(fieldTypeName)) {
                                field.category = FieldCategory.basic;
                            } else {
                                field.category = FieldCategory.complex;
                            }
                        }
                    }
                    break;
                case "opc":
                    if ((fieldTypeName === "UAString" || fieldTypeName === "String") && field.name === "IndexRange") {
                        field.fieldType = "NumericRange";
                        // xx console.log(" NumericRange detected here !");
                    } else {
                        field.fieldType = fieldTypeName;
                    }
                    if (!hasBuiltInType(fieldTypeName)) {
                        throw new Error("Unknown basic type " + fieldTypeName);