node-opcua-variant
Advanced tools
Comparing version 2.0.0-alpha.13 to 2.0.0-alpha.18
@@ -12,2 +12,3 @@ "use strict"; | ||
const utils = require("node-opcua-utils"); | ||
const node_opcua_extension_object_1 = require("node-opcua-extension-object"); | ||
const DataType_enum_1 = require("./DataType_enum"); | ||
@@ -68,3 +69,2 @@ const VariantArrayType_enum_1 = require("./VariantArrayType_enum"); | ||
* @property value | ||
* @type {Any} | ||
* @default null | ||
@@ -80,2 +80,16 @@ */ | ||
this.dimensions = node_opcua_factory_1.initialize_field_array(schema.fields[3], options.dimensions); | ||
if (options.dataType === DataType_enum_1.DataType.ExtensionObject) { | ||
if (this.arrayType === VariantArrayType_enum_1.VariantArrayType.Scalar) { | ||
if (this.value && !(this.value instanceof node_opcua_extension_object_1.ExtensionObject)) { | ||
throw new Error("A variant with DataType.ExtensionObject must have a ExtensionObject value"); | ||
} | ||
} | ||
else { | ||
for (const e of this.value) { | ||
if (e && !(e instanceof node_opcua_extension_object_1.ExtensionObject)) { | ||
throw new Error("A variant with DataType.ExtensionObject must have a ExtensionObject value"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
@@ -82,0 +96,0 @@ // Define Enumeration setters |
{ | ||
"name": "node-opcua-variant", | ||
"version": "2.0.0-alpha.13", | ||
"version": "2.0.0-alpha.18", | ||
"description": "pure nodejs OPCUA SDK - module -variant", | ||
@@ -14,20 +14,21 @@ "main": "./dist/index.js", | ||
"node-opcua-assert": "^2.0.0-alpha.10", | ||
"node-opcua-basic-types": "^2.0.0-alpha.13", | ||
"node-opcua-data-model": "^2.0.0-alpha.13", | ||
"node-opcua-enum": "^2.0.0-alpha.10", | ||
"node-opcua-factory": "^2.0.0-alpha.13", | ||
"node-opcua-nodeid": "^2.0.0-alpha.13", | ||
"node-opcua-utils": "^2.0.0-alpha.13", | ||
"node-opcua-basic-types": "^2.0.0-alpha.18", | ||
"node-opcua-data-model": "^2.0.0-alpha.18", | ||
"node-opcua-enum": "^2.0.0-alpha.18", | ||
"node-opcua-extension-object": "^2.0.0-alpha.18", | ||
"node-opcua-factory": "^2.0.0-alpha.18", | ||
"node-opcua-nodeid": "^2.0.0-alpha.18", | ||
"node-opcua-utils": "^2.0.0-alpha.18", | ||
"underscore": "^1.9.1" | ||
}, | ||
"devDependencies": { | ||
"node-opcua-benchmarker": "^2.0.0-alpha.10", | ||
"node-opcua-binary-stream": "^2.0.0-alpha.13", | ||
"node-opcua-debug": "^2.0.0-alpha.10", | ||
"node-opcua-generator": "^2.0.0-alpha.13", | ||
"node-opcua-numeric-range": "^2.0.0-alpha.13", | ||
"node-opcua-packet-analyzer": "^2.0.0-alpha.13", | ||
"node-opcua-status-code": "^2.0.0-alpha.13", | ||
"node-opcua-benchmarker": "^2.0.0-alpha.18", | ||
"node-opcua-binary-stream": "^2.0.0-alpha.18", | ||
"node-opcua-debug": "^2.0.0-alpha.18", | ||
"node-opcua-generator": "^2.0.0-alpha.18", | ||
"node-opcua-numeric-range": "^2.0.0-alpha.18", | ||
"node-opcua-packet-analyzer": "^2.0.0-alpha.18", | ||
"node-opcua-status-code": "^2.0.0-alpha.18", | ||
"should": "13.2.3", | ||
"source-map-support": "^0.5.10" | ||
"source-map-support": "^0.5.11" | ||
}, | ||
@@ -49,3 +50,3 @@ "author": "Etienne Rossignon", | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "6a0c56afb819a44d5abd453d39ce684df6fb3505" | ||
"gitHead": "a92d7f1be990cfaadd5f52560e2454e252b0b081" | ||
} |
@@ -9,4 +9,6 @@ /** | ||
import { | ||
coerceInt64, coerceUInt64, | ||
decodeUInt32, decodeUInt8, | ||
coerceInt64, | ||
coerceUInt64, | ||
decodeUInt32, | ||
decodeUInt8, | ||
encodeUInt32, | ||
@@ -24,9 +26,13 @@ encodeUInt8, | ||
isValidUInt64, | ||
isValidUInt8, | ||
isValidUInt8 | ||
} from "node-opcua-basic-types"; | ||
import { LocalizedText, QualifiedName } from "node-opcua-data-model"; | ||
import { | ||
BaseUAObject, buildStructuredType, | ||
findBuiltInType, initialize_field, | ||
initialize_field_array, registerSpecialVariantEncoder, StructuredTypeSchema, | ||
BaseUAObject, | ||
buildStructuredType, | ||
findBuiltInType, | ||
initialize_field, | ||
initialize_field_array, | ||
registerSpecialVariantEncoder, | ||
StructuredTypeSchema | ||
} from "node-opcua-factory"; | ||
@@ -37,2 +43,3 @@ | ||
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; | ||
import { ExtensionObject } from "node-opcua-extension-object"; | ||
import { _enumerationDataType, DataType } from "./DataType_enum"; | ||
@@ -116,3 +123,2 @@ import { _enumerationVariantArrayType, VariantArrayType } from "./VariantArrayType_enum"; | ||
* @property value | ||
* @type {Any} | ||
* @default null | ||
@@ -132,2 +138,16 @@ */ | ||
); | ||
if ( options.dataType === DataType.ExtensionObject) { | ||
if (this.arrayType === VariantArrayType.Scalar) { | ||
if (this.value && !(this.value instanceof ExtensionObject)) { | ||
throw new Error("A variant with DataType.ExtensionObject must have a ExtensionObject value"); | ||
} | ||
} else { | ||
for (const e of this.value) { | ||
if (e && !(e instanceof ExtensionObject)) { | ||
throw new Error("A variant with DataType.ExtensionObject must have a ExtensionObject value"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
@@ -134,0 +154,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1994
109913
9
19
+ Addednode-opcua-extension-object@2.137.0(transitive)