How to use the node-opcua-factory.check_options_correctness_against_schema 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-data-model / source / diagnostic_info.ts View on Github external
constructor(options?: any) {
        options = options || {};
        super();
        const schema = schemaDiagnosticInfo;
        /* istanbul ignore next */
        if (parameters.debugSchemaHelper) {
            check_options_correctness_against_schema(this, schema, options);
        }
        this.symbolicId = initialize_field(schema.fields[0], options.symbolicId);
        this.namespaceURI = initialize_field(schema.fields[1], options.namespaceURI);
        this.locale = initialize_field(schema.fields[2], options.locale);
        this.localizedText = initialize_field(schema.fields[3], options.localizedText);
        this.additionalInfo = initialize_field(schema.fields[4], options.additionalInfo);
        this.innerStatusCode = initialize_field(schema.fields[5], options.innerStatusCode);
        this.innerDiagnosticInfo = initialize_field(schema.fields[6], options.innerDiagnosticInfo);
    }
github node-opcua / node-opcua / packages / node-opcua-transport / source / AcknowledgeMessage.ts View on Github external
constructor(options?: AcknowledgeMessageOptions) {

        options = options || {};

        super();
        const schema = schemaAcknowledgeMessage;
        /* istanbul ignore next */
        if (parameters.debugSchemaHelper) {
            check_options_correctness_against_schema(this, schema, options);
        }

        this.protocolVersion = initialize_field(schema.fields[0], options.protocolVersion);
        this.receiveBufferSize = initialize_field(schema.fields[1], options.receiveBufferSize);
        this.sendBufferSize = initialize_field(schema.fields[2], options.sendBufferSize);
        this.maxMessageSize = initialize_field(schema.fields[3], options.maxMessageSize);
        this.maxChunkCount = initialize_field(schema.fields[4], options.maxChunkCount);
    }
github node-opcua / node-opcua / packages / node-opcua-schemas / source / dynamic_extension_object.ts View on Github external
constructor(options: any, schema: StructuredTypeSchema, typeDictionary: TypeDictionary) {
        super();

        assert(schema, "expecting a schema here ");
        assert(typeDictionary, "expecting a typeDic");
        options = options || {};
        this.__schema = schema;

        check_options_correctness_against_schema(this, this.schema, options);

        let uniqueFieldHasBeenFound = false;
        let switchFieldName = "";
        // finding fields that are in options but not in schema!
        for (const field of this.schema.fields) {

            const name = field.name;
            if (field.switchValue === undefined) {
                // this is the switch value field
                switchFieldName = field.name;
                continue;
            }
            assert(switchFieldName.length > 0, "It seems that there is no switch field in union schema");
            assert(field.switchValue !== undefined, "union schema must only have one switched value field");

            // dealing with optional fields
github node-opcua / node-opcua / packages / node-opcua-data-value / source / datavalue.ts View on Github external
constructor(options?: DataValueOptions) {

    super();

    const schema = schemaDataValue;

    options = options || {};
    /* istanbul ignore next */
    if (parameters.debugSchemaHelper) {
      check_options_correctness_against_schema(this, schema, options);
    }
    if (options === null) {
      this.value = new Variant({ dataType: DataType.Null });
    }

    /**
     * @property value
     * @type {Variant}
     * @default  null
     */
    if (options.value === undefined || options.value === null) {
      this.value = new Variant({ dataType: DataType.Null });
    } else {
      this.value = (options.value) ? new Variant(options.value) : new Variant({ dataType: DataType.Null });
    }
github node-opcua / node-opcua / packages / node-opcua-data-model / source / localized_text.ts View on Github external
constructor(options?: LocalizedTextOptions) {

        super();

        const schema = schemaLocalizedText;
        options = options || {};
        /* istanbul ignore next */
        if (parameters.debugSchemaHelper) {
            check_options_correctness_against_schema(this, schema, options);
        }

        /**
         * @property locale
         * @type {UAString}
         */
        this.locale = initialize_field(schema.fields[0], options.locale);

        /**
         * @property text
         * @type {UAString}
         */
        this.text = initialize_field(schema.fields[1], options.text);
    }
github node-opcua / node-opcua / packages / node-opcua-data-model / source / qualified_name.ts View on Github external
constructor(options?: QualifiedNameOptions) {

        super();

        const schema = QualifiedName.schema;
        options = options || {};
        /* istanbul ignore next */
        if (parameters.debugSchemaHelper) {
            check_options_correctness_against_schema(this, schema, options);
        }

        /**
         * @property namespaceIndex
         * @type {Int32}
         */
        this.namespaceIndex = initialize_field(schema.fields[0], options.namespaceIndex);

        /**
         * @property name
         * @type {UAString}
         */
        this.name = initialize_field(schema.fields[1], options.name);
    }
github node-opcua / node-opcua / packages / node-opcua-transport / source / TCPErrorMessage.ts View on Github external
constructor(options?: { statusCode?: StatusCode, reason?: string}) {
        options = options || {};
        const schema = schemaTCPErrorMessage;

        super();
        /* istanbul ignore next */
        if (parameters.debugSchemaHelper) {
            check_options_correctness_against_schema(this, schema, options);
        }
        this.statusCode = initialize_field(schema.fields[0], options.statusCode);
        this.reason = initialize_field(schema.fields[1], options.reason);
    }
github node-opcua / node-opcua / packages / node-opcua-transport / source / HelloMessage.ts View on Github external
constructor(options?: HelloMessageOptions) {
        options = options || {};
        super();
        const schema = schemaHelloMessage;
        /* istanbul ignore next */
        if (parameters.debugSchemaHelper) {
            check_options_correctness_against_schema(this, schema, options);
        }

        this.protocolVersion = initialize_field(schema.fields[0], options.protocolVersion);
        this.receiveBufferSize = initialize_field(schema.fields[1], options.receiveBufferSize);
        this.sendBufferSize = initialize_field(schema.fields[2], options.sendBufferSize);
        this.maxMessageSize = initialize_field(schema.fields[3], options.maxMessageSize);
        this.maxChunkCount = initialize_field(schema.fields[4], options.maxChunkCount);
        this.endpointUrl = initialize_field(schema.fields[5], options.endpointUrl);
    }
github node-opcua / node-opcua / packages / node-opcua-service-secure-channel / source / AsymmetricAlgorithmSecurityHeader.ts View on Github external
constructor(options?: any) {
        options = options || {};
        super();
        const schema = schemaAsymmetricAlgorithmSecurityHeader;
        /* istanbul ignore next */
        if (parameters.debugSchemaHelper) {
            check_options_correctness_against_schema(this, schema, options);
        }
        this.securityPolicyUri = initialize_field(schema.fields[0], options.securityPolicyUri);
        this.senderCertificate = initialize_field(schema.fields[1], options.senderCertificate);
        this.receiverCertificateThumbprint = initialize_field(schema.fields[2], options.receiverCertificateThumbprint);
    }
github node-opcua / node-opcua / packages / node-opcua-schemas / source / dynamic_extension_object.ts View on Github external
constructor(options: any, schema: StructuredTypeSchema, typeDictionary: TypeDictionary) {
        assert(schema, "expecting a schema here ");
        assert(typeDictionary, "expecting a typeDic");

        super(options);
        options = options || {};
        this.__schema = schema;

        this._typeDictionary = typeDictionary;

        check_options_correctness_against_schema(this, this.schema, options);

        initializeFields(this as any, options, this.schema, typeDictionary);
    }