node-opcua-address-space 2.130.0 → 2.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/base_node_impl.js +3 -5
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/ua_reference_type_impl.d.ts +1 -1
- package/dist/src/ua_variable_impl.d.ts +2 -1
- package/dist/src/ua_variable_impl.js +32 -0
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/tsconfig_common.tsbuildinfo +1 -1
- package/package.json +26 -26
- package/src/base_node_impl.ts +3 -5
- package/src/ua_variable_impl.ts +38 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-address-space",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.131.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module address-space",
|
|
5
5
|
"main": "./dist/src/index_current.js",
|
|
6
6
|
"types": "./dist/source/index.d.ts",
|
|
@@ -18,41 +18,41 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@types/lodash": "4.17.7",
|
|
20
20
|
"@types/semver": "^7.5.8",
|
|
21
|
-
"async": "^3.2.
|
|
21
|
+
"async": "^3.2.6",
|
|
22
22
|
"chalk": "4.1.2",
|
|
23
23
|
"dequeue": "^1.0.5",
|
|
24
24
|
"lodash": "4.17.21",
|
|
25
|
-
"node-opcua-address-space-base": "2.
|
|
25
|
+
"node-opcua-address-space-base": "2.131.0",
|
|
26
26
|
"node-opcua-assert": "2.120.0",
|
|
27
|
-
"node-opcua-basic-types": "2.
|
|
27
|
+
"node-opcua-basic-types": "2.131.0",
|
|
28
28
|
"node-opcua-binary-stream": "2.128.0",
|
|
29
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
29
|
+
"node-opcua-client-dynamic-extension-object": "2.131.0",
|
|
30
30
|
"node-opcua-constants": "2.125.0",
|
|
31
|
-
"node-opcua-crypto": "4.9.
|
|
32
|
-
"node-opcua-data-access": "2.
|
|
33
|
-
"node-opcua-data-model": "2.
|
|
34
|
-
"node-opcua-data-value": "2.
|
|
31
|
+
"node-opcua-crypto": "4.9.4",
|
|
32
|
+
"node-opcua-data-access": "2.131.0",
|
|
33
|
+
"node-opcua-data-model": "2.131.0",
|
|
34
|
+
"node-opcua-data-value": "2.131.0",
|
|
35
35
|
"node-opcua-date-time": "2.128.0",
|
|
36
36
|
"node-opcua-debug": "2.128.0",
|
|
37
37
|
"node-opcua-enum": "2.128.0",
|
|
38
|
-
"node-opcua-extension-object": "2.
|
|
39
|
-
"node-opcua-factory": "2.
|
|
38
|
+
"node-opcua-extension-object": "2.131.0",
|
|
39
|
+
"node-opcua-factory": "2.131.0",
|
|
40
40
|
"node-opcua-nodeid": "2.128.0",
|
|
41
|
-
"node-opcua-nodeset-ua": "2.
|
|
42
|
-
"node-opcua-numeric-range": "2.
|
|
41
|
+
"node-opcua-nodeset-ua": "2.131.0",
|
|
42
|
+
"node-opcua-numeric-range": "2.131.0",
|
|
43
43
|
"node-opcua-object-registry": "2.128.0",
|
|
44
|
-
"node-opcua-pseudo-session": "2.
|
|
45
|
-
"node-opcua-service-browse": "2.
|
|
46
|
-
"node-opcua-service-call": "2.
|
|
47
|
-
"node-opcua-service-history": "2.
|
|
48
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
49
|
-
"node-opcua-service-write": "2.
|
|
44
|
+
"node-opcua-pseudo-session": "2.131.0",
|
|
45
|
+
"node-opcua-service-browse": "2.131.0",
|
|
46
|
+
"node-opcua-service-call": "2.131.0",
|
|
47
|
+
"node-opcua-service-history": "2.131.0",
|
|
48
|
+
"node-opcua-service-translate-browse-path": "2.131.0",
|
|
49
|
+
"node-opcua-service-write": "2.131.0",
|
|
50
50
|
"node-opcua-status-code": "2.128.0",
|
|
51
|
-
"node-opcua-types": "2.
|
|
51
|
+
"node-opcua-types": "2.131.0",
|
|
52
52
|
"node-opcua-utils": "2.128.0",
|
|
53
|
-
"node-opcua-variant": "2.
|
|
53
|
+
"node-opcua-variant": "2.131.0",
|
|
54
54
|
"node-opcua-xml2json": "2.128.0",
|
|
55
|
-
"semver": "^7.6.
|
|
55
|
+
"semver": "^7.6.3",
|
|
56
56
|
"set-prototype-of": "^1.0.0",
|
|
57
57
|
"thenify": "^3.3.1",
|
|
58
58
|
"xml-writer": "^1.7.0"
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"node-opcua-benchmarker": "2.128.0",
|
|
62
62
|
"node-opcua-leak-detector": "2.128.0",
|
|
63
63
|
"node-opcua-nodesets": "2.121.0",
|
|
64
|
-
"node-opcua-packet-analyzer": "2.
|
|
65
|
-
"node-opcua-service-filter": "2.
|
|
66
|
-
"node-opcua-test-fixtures": "2.
|
|
64
|
+
"node-opcua-packet-analyzer": "2.131.0",
|
|
65
|
+
"node-opcua-service-filter": "2.131.0",
|
|
66
|
+
"node-opcua-test-fixtures": "2.131.0",
|
|
67
67
|
"source-map-support": "^0.5.21"
|
|
68
68
|
},
|
|
69
69
|
"author": "Etienne Rossignon",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"internet of things"
|
|
82
82
|
],
|
|
83
83
|
"homepage": "http://node-opcua.github.io/",
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "80f430dd3044826c904f803af40297839dd809be",
|
|
85
85
|
"files": [
|
|
86
86
|
"dist",
|
|
87
87
|
"distHelpers",
|
package/src/base_node_impl.ts
CHANGED
|
@@ -1791,12 +1791,10 @@ function install_components_as_object_properties(parentObj: BaseNode) {
|
|
|
1791
1791
|
}
|
|
1792
1792
|
|
|
1793
1793
|
// ignore reserved names
|
|
1794
|
-
|
|
1795
|
-
debugLog("Installing property " + name, " on ", parentObj.browseName.toString());
|
|
1796
|
-
}
|
|
1794
|
+
doDebug && debugLog("Installing property " + name, " on ", parentObj.browseName.toString());
|
|
1797
1795
|
|
|
1798
|
-
|
|
1799
|
-
if (
|
|
1796
|
+
const hasProperty = Object.prototype.hasOwnProperty.call(parentObj, name);
|
|
1797
|
+
if (hasProperty && ((parentObj as any)[name] !== null && (parentObj as any)[name] !== undefined)) {
|
|
1800
1798
|
continue;
|
|
1801
1799
|
}
|
|
1802
1800
|
|
package/src/ua_variable_impl.ts
CHANGED
|
@@ -32,7 +32,7 @@ import { extractRange, sameDataValue, DataValue, DataValueLike, DataValueT } fro
|
|
|
32
32
|
import { coerceClock, getCurrentClock, PreciseClock } from "node-opcua-date-time";
|
|
33
33
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
34
34
|
import { ExtensionObject } from "node-opcua-extension-object";
|
|
35
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
35
|
+
import { NodeId, NodeIdLike } from "node-opcua-nodeid";
|
|
36
36
|
import { NumericRange } from "node-opcua-numeric-range";
|
|
37
37
|
import { WriteValue } from "node-opcua-service-write";
|
|
38
38
|
import { StatusCode, StatusCodes, CallbackT } from "node-opcua-status-code";
|
|
@@ -421,7 +421,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
421
421
|
this.$dataValue = dataValueOrPromise as DataValue;
|
|
422
422
|
if (this.$dataValue.statusCode.isGoodish()) {
|
|
423
423
|
this.verifyVariantCompatibility(this.$dataValue.value);
|
|
424
|
-
}
|
|
424
|
+
}
|
|
425
425
|
}
|
|
426
426
|
} else {
|
|
427
427
|
errorLog(
|
|
@@ -1407,6 +1407,10 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
1409
|
|
|
1410
|
+
public changeDataType(newDataType: NodeIdLike, newValue?: VariantLike): void {
|
|
1411
|
+
changeUAVariableDataType(this, newDataType, newValue);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1410
1414
|
/**
|
|
1411
1415
|
* @private
|
|
1412
1416
|
* install UAVariable to exposed th
|
|
@@ -2287,3 +2291,35 @@ export interface UAVariableImplT<T, DT extends DataType> extends UAVariableImpl,
|
|
|
2287
2291
|
writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, indexRange?: NumericRange | null): Promise<StatusCode>;
|
|
2288
2292
|
}
|
|
2289
2293
|
export class UAVariableImplT<T, DT extends DataType> extends UAVariableImpl {}
|
|
2294
|
+
|
|
2295
|
+
function changeUAVariableDataType(uaVariable: UAVariableImpl, newDataType: NodeIdLike, valueLike?: VariantLike) {
|
|
2296
|
+
let value: Variant | null = valueLike ? (valueLike instanceof Variant ? valueLike : new Variant(valueLike)) : null;
|
|
2297
|
+
|
|
2298
|
+
const addressSpace = uaVariable.addressSpace;
|
|
2299
|
+
const newDataTypeNode = addressSpace.findNode(newDataType) as UADataType;
|
|
2300
|
+
// istanbul ignore next
|
|
2301
|
+
if (!newDataTypeNode || !(newDataTypeNode instanceof UADataTypeImpl)) {
|
|
2302
|
+
throw new Error("Cannot find newDataTypeNode " + newDataType.toString());
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
const newBaseDataType: DataType = newDataTypeNode.basicDataType;
|
|
2306
|
+
// istanbul ignore next
|
|
2307
|
+
if (newBaseDataType === DataType.Null) {
|
|
2308
|
+
throw new Error("newDataTypeNode must be a DataType");
|
|
2309
|
+
}
|
|
2310
|
+
if (!value) {
|
|
2311
|
+
value = uaVariable.readValue().value;
|
|
2312
|
+
value.dataType = newBaseDataType;
|
|
2313
|
+
}
|
|
2314
|
+
if (newBaseDataType !== value.dataType) {
|
|
2315
|
+
throw new Error("newDataTypeNode must be of the same base dataType as the value");
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
// change uaVariable.dataType
|
|
2319
|
+
uaVariable.dataType = newDataTypeNode.nodeId;
|
|
2320
|
+
(uaVariable as any)._basicDataType = null;
|
|
2321
|
+
(uaVariable as any).$dataValue.value.dataType = newDataType;
|
|
2322
|
+
(uaVariable as any).$dataValue.value.value = value;
|
|
2323
|
+
// also change the value to ensure that we have a default value with the correct dataType
|
|
2324
|
+
uaVariable._internal_set_value(value);
|
|
2325
|
+
}
|