node-opcua-address-space 2.123.0 → 2.125.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/address_space.js +2 -4
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/address_space_change_event_tools.js +2 -2
- package/dist/src/address_space_change_event_tools.js.map +1 -1
- package/dist/src/namespace_impl.js +12 -5
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.js +17 -4
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/tsconfig_common.tsbuildinfo +1 -1
- package/package.json +39 -39
- package/src/address_space.ts +17 -18
- package/src/address_space_change_event_tools.ts +3 -4
- package/src/namespace_impl.ts +17 -6
- package/src/ua_variable_impl.ts +20 -4
- package/src/ua_variable_impl_ext_obj.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-address-space",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.125.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",
|
|
@@ -16,57 +16,57 @@
|
|
|
16
16
|
"c": "mocha --version"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@types/lodash": "4.
|
|
19
|
+
"@types/lodash": "4.17.4",
|
|
20
20
|
"@types/semver": "^7.5.8",
|
|
21
21
|
"async": "^3.2.5",
|
|
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.125.0",
|
|
26
26
|
"node-opcua-assert": "2.120.0",
|
|
27
|
-
"node-opcua-basic-types": "2.
|
|
28
|
-
"node-opcua-binary-stream": "2.
|
|
29
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
30
|
-
"node-opcua-constants": "2.
|
|
27
|
+
"node-opcua-basic-types": "2.125.0",
|
|
28
|
+
"node-opcua-binary-stream": "2.125.0",
|
|
29
|
+
"node-opcua-client-dynamic-extension-object": "2.125.0",
|
|
30
|
+
"node-opcua-constants": "2.125.0",
|
|
31
31
|
"node-opcua-crypto": "4.8.0",
|
|
32
|
-
"node-opcua-data-access": "2.
|
|
33
|
-
"node-opcua-data-model": "2.
|
|
34
|
-
"node-opcua-data-value": "2.
|
|
35
|
-
"node-opcua-date-time": "2.
|
|
36
|
-
"node-opcua-debug": "2.
|
|
37
|
-
"node-opcua-enum": "2.
|
|
38
|
-
"node-opcua-extension-object": "2.
|
|
39
|
-
"node-opcua-factory": "2.
|
|
40
|
-
"node-opcua-nodeid": "2.
|
|
41
|
-
"node-opcua-nodeset-ua": "2.
|
|
42
|
-
"node-opcua-numeric-range": "2.
|
|
43
|
-
"node-opcua-object-registry": "2.
|
|
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.
|
|
50
|
-
"node-opcua-status-code": "2.
|
|
51
|
-
"node-opcua-types": "2.
|
|
52
|
-
"node-opcua-utils": "2.
|
|
53
|
-
"node-opcua-variant": "2.
|
|
54
|
-
"node-opcua-xml2json": "2.
|
|
55
|
-
"semver": "^7.6.
|
|
32
|
+
"node-opcua-data-access": "2.125.0",
|
|
33
|
+
"node-opcua-data-model": "2.125.0",
|
|
34
|
+
"node-opcua-data-value": "2.125.0",
|
|
35
|
+
"node-opcua-date-time": "2.125.0",
|
|
36
|
+
"node-opcua-debug": "2.125.0",
|
|
37
|
+
"node-opcua-enum": "2.125.0",
|
|
38
|
+
"node-opcua-extension-object": "2.125.0",
|
|
39
|
+
"node-opcua-factory": "2.125.0",
|
|
40
|
+
"node-opcua-nodeid": "2.125.0",
|
|
41
|
+
"node-opcua-nodeset-ua": "2.125.0",
|
|
42
|
+
"node-opcua-numeric-range": "2.125.0",
|
|
43
|
+
"node-opcua-object-registry": "2.125.0",
|
|
44
|
+
"node-opcua-pseudo-session": "2.125.0",
|
|
45
|
+
"node-opcua-service-browse": "2.125.0",
|
|
46
|
+
"node-opcua-service-call": "2.125.0",
|
|
47
|
+
"node-opcua-service-history": "2.125.0",
|
|
48
|
+
"node-opcua-service-translate-browse-path": "2.125.0",
|
|
49
|
+
"node-opcua-service-write": "2.125.0",
|
|
50
|
+
"node-opcua-status-code": "2.125.0",
|
|
51
|
+
"node-opcua-types": "2.125.0",
|
|
52
|
+
"node-opcua-utils": "2.125.0",
|
|
53
|
+
"node-opcua-variant": "2.125.0",
|
|
54
|
+
"node-opcua-xml2json": "2.125.0",
|
|
55
|
+
"semver": "^7.6.2",
|
|
56
56
|
"set-prototype-of": "^1.0.0",
|
|
57
57
|
"thenify": "^3.3.1",
|
|
58
58
|
"xml-writer": "^1.7.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"mocha": "^10.
|
|
62
|
-
"node-opcua-benchmarker": "2.
|
|
63
|
-
"node-opcua-leak-detector": "2.
|
|
61
|
+
"mocha": "^10.4.0",
|
|
62
|
+
"node-opcua-benchmarker": "2.125.0",
|
|
63
|
+
"node-opcua-leak-detector": "2.125.0",
|
|
64
64
|
"node-opcua-nodesets": "2.121.0",
|
|
65
|
-
"node-opcua-packet-analyzer": "2.
|
|
66
|
-
"node-opcua-service-filter": "2.
|
|
67
|
-
"node-opcua-test-fixtures": "2.
|
|
65
|
+
"node-opcua-packet-analyzer": "2.125.0",
|
|
66
|
+
"node-opcua-service-filter": "2.125.0",
|
|
67
|
+
"node-opcua-test-fixtures": "2.125.0",
|
|
68
68
|
"should": "^13.2.3",
|
|
69
|
-
"sinon": "^
|
|
69
|
+
"sinon": "^18.0.0",
|
|
70
70
|
"source-map-support": "^0.5.21"
|
|
71
71
|
},
|
|
72
72
|
"author": "Etienne Rossignon",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"internet of things"
|
|
85
85
|
],
|
|
86
86
|
"homepage": "http://node-opcua.github.io/",
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "a0e0a2f1045e6e402dd4619c625c90008f0617ed",
|
|
88
88
|
"files": [
|
|
89
89
|
"dist",
|
|
90
90
|
"distHelpers",
|
package/src/address_space.ts
CHANGED
|
@@ -344,7 +344,9 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
|
|
347
|
+
const namespaceArray: string[] = this.getNamespaceArray().map((a)=>a.namespaceUri);
|
|
348
|
+
|
|
349
|
+
return resolveNodeId(nodeId, { namespaceArray });
|
|
348
350
|
}
|
|
349
351
|
|
|
350
352
|
/**
|
|
@@ -488,9 +490,9 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
488
490
|
if (!(dataTypeNode instanceof UADataTypeImpl)) {
|
|
489
491
|
throw new Error(
|
|
490
492
|
"we are expecting an UADataType here : " +
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
493
|
+
_orig_dataTypeNode.toString() +
|
|
494
|
+
" should not refer to a " +
|
|
495
|
+
(dataTypeNode as BaseNode).browseName.name
|
|
494
496
|
);
|
|
495
497
|
}
|
|
496
498
|
|
|
@@ -783,18 +785,18 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
783
785
|
// tslint:disable:no-console
|
|
784
786
|
errorLog(
|
|
785
787
|
chalk.red("ERROR : AddressSpace#constructEventData(eventType,options) " + "cannot find property ") +
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
788
|
+
self.browseName.toString() +
|
|
789
|
+
" => " +
|
|
790
|
+
chalk.cyan(lowerName)
|
|
789
791
|
);
|
|
790
792
|
} else {
|
|
791
793
|
errorLog(
|
|
792
794
|
chalk.yellow(
|
|
793
795
|
"Warning : AddressSpace#constructEventData(eventType,options)" + " cannot find property "
|
|
794
796
|
) +
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
797
|
+
self.browseName.toString() +
|
|
798
|
+
" => " +
|
|
799
|
+
chalk.cyan(lowerName)
|
|
798
800
|
);
|
|
799
801
|
}
|
|
800
802
|
}
|
|
@@ -811,11 +813,11 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
811
813
|
if (!alreadyVisited(k)) {
|
|
812
814
|
warningLog(
|
|
813
815
|
"constructEventData: cannot find property '" +
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
816
|
+
k +
|
|
817
|
+
"' in [ " +
|
|
818
|
+
Object.keys(visitedProperties).join(", ") +
|
|
819
|
+
"] when filling " +
|
|
820
|
+
eventTypeNode.browseName.toString()
|
|
819
821
|
);
|
|
820
822
|
}
|
|
821
823
|
});
|
|
@@ -1237,15 +1239,12 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1237
1239
|
this._modelChangeTransactionCounter = this._modelChangeTransactionCounter || 0;
|
|
1238
1240
|
|
|
1239
1241
|
function beginModelChange(this: AddressSpace) {
|
|
1240
|
-
/* jshint validthis:true */
|
|
1241
|
-
assert(this);
|
|
1242
1242
|
this._modelChanges = this._modelChanges || [];
|
|
1243
1243
|
assert(this._modelChangeTransactionCounter >= 0);
|
|
1244
1244
|
this._modelChangeTransactionCounter += 1;
|
|
1245
1245
|
}
|
|
1246
1246
|
|
|
1247
1247
|
function endModelChange(this: AddressSpace) {
|
|
1248
|
-
/* jshint validthis:true */
|
|
1249
1248
|
this._modelChangeTransactionCounter -= 1;
|
|
1250
1249
|
|
|
1251
1250
|
if (this._modelChangeTransactionCounter === 0) {
|
|
@@ -21,10 +21,9 @@ const verbFlags = new Enum({
|
|
|
21
21
|
NodeDeleted: 0x02,
|
|
22
22
|
|
|
23
23
|
// ReferenceAdded 2 Indicates a Reference has been added. The affected Node may
|
|
24
|
-
ReferenceAdded: 0x04,
|
|
25
|
-
|
|
26
24
|
// be either a SourceNode or TargetNode. Note that an added
|
|
27
25
|
// bidirectional Reference is reflected by two ChangeStructures.
|
|
26
|
+
ReferenceAdded: 0x04,
|
|
28
27
|
// ReferenceDeleted 3 Indicates a Reference has been deleted. The affected Node may
|
|
29
28
|
// be either a SourceNode or TargetNode. Note that a deleted
|
|
30
29
|
// bidirectional Reference is reflected by two ChangeStructures.
|
|
@@ -105,7 +104,7 @@ export function _handle_model_change_event(node: BaseNodeImpl): void {
|
|
|
105
104
|
|
|
106
105
|
const containingFolders = node.findReferencesExAsObject("Organizes", BrowseDirection.Inverse);
|
|
107
106
|
|
|
108
|
-
let typeDefinitionNodeId: NodeId
|
|
107
|
+
let typeDefinitionNodeId: NodeId | null = null;
|
|
109
108
|
if (node.nodeClass === NodeClass.Object || node.nodeClass === NodeClass.Variable) {
|
|
110
109
|
typeDefinitionNodeId = node.typeDefinitionObj.nodeId;
|
|
111
110
|
}
|
|
@@ -150,7 +149,7 @@ export function _handle_delete_node_model_change_event(node: BaseNode): void {
|
|
|
150
149
|
return addressSpace.findNode(r.nodeId)! as BaseNode;
|
|
151
150
|
});
|
|
152
151
|
|
|
153
|
-
const versionableNodes = parentNodes.filter((n: BaseNode) => !!n?.
|
|
152
|
+
const versionableNodes = parentNodes.filter((n: BaseNode) => !!n?.getChildByName("NodeVersion", 0));
|
|
154
153
|
|
|
155
154
|
if (versionableNodes.length >= 1 || !!node.nodeVersion) {
|
|
156
155
|
addressSpace.modelChangeTransaction(() => {
|
package/src/namespace_impl.ts
CHANGED
|
@@ -7,7 +7,7 @@ import chalk from "chalk";
|
|
|
7
7
|
import { assert } from "node-opcua-assert";
|
|
8
8
|
import { coerceInt64 } from "node-opcua-basic-types";
|
|
9
9
|
import { AxisScaleEnumeration } from "node-opcua-data-access";
|
|
10
|
-
import { AccessRestrictionsFlag, coerceLocalizedText, QualifiedNameLike } from "node-opcua-data-model";
|
|
10
|
+
import { AccessRestrictionsFlag, coerceLocalizedText, coerceQualifiedName, QualifiedNameLike } from "node-opcua-data-model";
|
|
11
11
|
import { QualifiedName } from "node-opcua-data-model";
|
|
12
12
|
import { BrowseDirection } from "node-opcua-data-model";
|
|
13
13
|
import { NodeClass } from "node-opcua-data-model";
|
|
@@ -1655,7 +1655,15 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1655
1655
|
assert(node.nodeId instanceof NodeId, "Expecting a NodeId");
|
|
1656
1656
|
// istanbul ignore next
|
|
1657
1657
|
if (node.nodeId.namespace !== this.index) {
|
|
1658
|
-
throw new Error(
|
|
1658
|
+
throw new Error(
|
|
1659
|
+
"node must belong to this namespace : " +
|
|
1660
|
+
node.nodeId.toString() +
|
|
1661
|
+
" " +
|
|
1662
|
+
" node.browseName = " +
|
|
1663
|
+
node.browseName.toString() +
|
|
1664
|
+
" this.index = " +
|
|
1665
|
+
this.index
|
|
1666
|
+
);
|
|
1659
1667
|
}
|
|
1660
1668
|
assert(node.nodeId.namespace === this.index, "node must belongs to this namespace");
|
|
1661
1669
|
assert(Object.prototype.hasOwnProperty.call(node, "browseName"), "Node must have a browseName");
|
|
@@ -2000,7 +2008,8 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
2000
2008
|
// a getter has been specified and no options.minimumSamplingInterval has been specified
|
|
2001
2009
|
warningLog(
|
|
2002
2010
|
"[NODE-OPCUA-W30",
|
|
2003
|
-
"namespace#addVariable a getter has been specified and minimumSamplingInterval is missing.\nMinimumSamplingInterval has been adjusted to 1000 ms\nvariable = "+
|
|
2011
|
+
"namespace#addVariable a getter has been specified and minimumSamplingInterval is missing.\nMinimumSamplingInterval has been adjusted to 1000 ms\nvariable = " +
|
|
2012
|
+
options?.browseName?.toString()
|
|
2004
2013
|
);
|
|
2005
2014
|
options.minimumSamplingInterval = 1000;
|
|
2006
2015
|
}
|
|
@@ -2225,12 +2234,14 @@ function _create_node_version_if_needed(node: BaseNode, options: { nodeVersion:
|
|
|
2225
2234
|
if (node.getChildByName("NodeVersion")) {
|
|
2226
2235
|
return; // already exists
|
|
2227
2236
|
}
|
|
2228
|
-
|
|
2237
|
+
|
|
2238
|
+
const namespace = node.namespace;
|
|
2229
2239
|
const nodeVersion = namespace.addVariable({
|
|
2230
|
-
browseName: "NodeVersion",
|
|
2231
|
-
dataType:
|
|
2240
|
+
browseName: coerceQualifiedName({ name: "NodeVersion", namespaceIndex: 0 }),
|
|
2241
|
+
dataType: DataType.String,
|
|
2232
2242
|
propertyOf: node
|
|
2233
2243
|
});
|
|
2244
|
+
|
|
2234
2245
|
const initialValue = typeof options.nodeVersion === "string" ? options.nodeVersion : "0";
|
|
2235
2246
|
nodeVersion.setValueFromSource({ dataType: "String", value: initialValue });
|
|
2236
2247
|
}
|
package/src/ua_variable_impl.ts
CHANGED
|
@@ -403,14 +403,30 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
403
403
|
if (this._timestamped_get_func) {
|
|
404
404
|
if (this._timestamped_get_func.length === 0) {
|
|
405
405
|
const dataValueOrPromise = (this._timestamped_get_func as VariableDataValueGetterSync)();
|
|
406
|
-
if (!Object.prototype.hasOwnProperty.call(dataValueOrPromise, "then")) {
|
|
406
|
+
if (!Object.prototype.hasOwnProperty.call(dataValueOrPromise.constructor.prototype, "then")) {
|
|
407
407
|
if (dataValueOrPromise !== this.$dataValue) {
|
|
408
|
+
// we may have a problem here if we use a getter that returns a dataValue that is a ExtensionObject
|
|
409
|
+
if (dataValueOrPromise.value?.dataType === DataType.ExtensionObject) {
|
|
410
|
+
// eslint-disable-next-line max-depth
|
|
411
|
+
if (this.$extensionObject || this.$$extensionObjectArray) {
|
|
412
|
+
// we have an extension object already bound to this node
|
|
413
|
+
// the client is asking us to replace the object entirely by a new one
|
|
414
|
+
// const ext = dataValue.value.value;
|
|
415
|
+
this._internal_set_dataValue(dataValueOrPromise);
|
|
416
|
+
return dataValueOrPromise;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
408
420
|
// TO DO : is this necessary ? this may interfere with current use of $dataValue
|
|
409
421
|
this.$dataValue = dataValueOrPromise as DataValue;
|
|
410
|
-
|
|
422
|
+
if (this.$dataValue.statusCode.isGoodish()) {
|
|
423
|
+
this.verifyVariantCompatibility(this.$dataValue.value);
|
|
424
|
+
}
|
|
411
425
|
}
|
|
412
426
|
} else {
|
|
413
|
-
errorLog(
|
|
427
|
+
errorLog(
|
|
428
|
+
"[NODE-OPCUA-E28] Unsupported: _timestamped_get_func returns a Promise ! , when the uaVariable has an async getter. Fix your application code."
|
|
429
|
+
);
|
|
414
430
|
}
|
|
415
431
|
}
|
|
416
432
|
}
|
|
@@ -2099,7 +2115,7 @@ function _Variable_bind_with_simple_get(this: UAVariableImpl, options: GetterOpt
|
|
|
2099
2115
|
!this.$dataValue.statusCode.isGoodish() ||
|
|
2100
2116
|
!sameVariant(this.$dataValue.value, value as Variant)
|
|
2101
2117
|
) {
|
|
2102
|
-
// rebuilding artificially timestamps with current clock as they are not provided
|
|
2118
|
+
// rebuilding artificially timestamps with current clock as they are not provided
|
|
2103
2119
|
// by the underlying getter function
|
|
2104
2120
|
const { timestamp: sourceTimestamp, picoseconds: sourcePicoseconds } = getCurrentClock();
|
|
2105
2121
|
const serverTimestamp = sourceTimestamp;
|
|
@@ -108,7 +108,7 @@ export function _touchValue(property: UAVariableImpl, now: PreciseClock): void {
|
|
|
108
108
|
property.$dataValue.sourcePicoseconds = now.picoseconds;
|
|
109
109
|
property.$dataValue.serverTimestamp = now.timestamp;
|
|
110
110
|
property.$dataValue.serverPicoseconds = now.picoseconds;
|
|
111
|
-
property.$dataValue.statusCode = StatusCodes.Good;
|
|
111
|
+
// don't change statusCode ! property.$dataValue.statusCode = StatusCodes.Good;
|
|
112
112
|
if (property.listenerCount("value_changed") > 0) {
|
|
113
113
|
property.emit("value_changed", property.$dataValue.clone());
|
|
114
114
|
}
|