node-opcua-address-space 2.82.0 → 2.83.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/apply_condition_refresh.d.ts +1 -1
- package/dist/src/apply_condition_refresh.js +5 -5
- package/dist/src/apply_condition_refresh.js.map +1 -1
- package/dist/src/base_node_impl.d.ts +1 -0
- package/dist/src/base_node_impl.js +83 -54
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.d.ts +23 -3
- package/dist/src/base_node_private.js +3 -2
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/ua_data_type_impl.js +9 -15
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_reference_type_impl.d.ts +1 -1
- package/dist/src/ua_reference_type_impl.js +1 -1
- package/dist/src/ua_reference_type_impl.js.map +1 -1
- package/package.json +37 -37
- package/src/apply_condition_refresh.ts +5 -5
- package/src/base_node_impl.ts +86 -59
- package/src/base_node_private.ts +26 -10
- package/src/ua_data_type_impl.ts +9 -15
- package/src/ua_reference_type_impl.ts +2 -2
package/src/base_node_private.ts
CHANGED
|
@@ -49,17 +49,35 @@ const g_weakMap = new WeakMap();
|
|
|
49
49
|
|
|
50
50
|
const warningLog = make_warningLog(__filename);
|
|
51
51
|
|
|
52
|
+
interface BaseNodeCacheInner {
|
|
53
|
+
typeDefinition?: NodeId;
|
|
54
|
+
_childByNameMap?: Record<string, BaseNode>;
|
|
55
|
+
typeDefinitionObj?: UAVariableType | UAObjectType | null;
|
|
56
|
+
_aggregates?: BaseNode[];
|
|
57
|
+
_components?: BaseNode[];
|
|
58
|
+
_properties?: BaseNode[];
|
|
59
|
+
_notifiers?: BaseNode[];
|
|
60
|
+
_eventSources?: BaseNode[];
|
|
61
|
+
_methods?: UAMethod[];
|
|
62
|
+
_ref?: Record<string, UAReference[]>;
|
|
63
|
+
_encoding?: Record<string, UAObject | null>;
|
|
64
|
+
_subtype_id?: Record<string, UAReferenceType[]> | null;
|
|
65
|
+
_subtype_idx?: Record<string, UAReferenceType> | null;
|
|
66
|
+
_subtype_idxVersion?: number;
|
|
67
|
+
_allSubTypes?: UAReferenceType[] | null;
|
|
68
|
+
_allSubTypesVersion?: number;
|
|
69
|
+
_subtypeOfObj?: BaseNode | null;
|
|
70
|
+
}
|
|
71
|
+
|
|
52
72
|
interface BaseNodeCache {
|
|
53
73
|
__address_space: IAddressSpace | null;
|
|
54
74
|
_browseFilter?: (this: BaseNode, context?: ISessionContext) => boolean;
|
|
55
|
-
_cache:
|
|
75
|
+
_cache: BaseNodeCacheInner;
|
|
56
76
|
_description?: LocalizedText;
|
|
57
77
|
_displayName: LocalizedText[];
|
|
58
78
|
_parent?: BaseNode | null;
|
|
59
|
-
|
|
60
79
|
_back_referenceIdx: { [key: string]: UAReference };
|
|
61
80
|
_referenceIdx: { [key: string]: UAReference };
|
|
62
|
-
|
|
63
81
|
_subtype_idxVersion: number;
|
|
64
82
|
_subtype_idx: any;
|
|
65
83
|
}
|
|
@@ -100,7 +118,7 @@ export function BaseNode_getPrivate(self: BaseNode): BaseNodeCache {
|
|
|
100
118
|
return g_weakMap.get(self);
|
|
101
119
|
}
|
|
102
120
|
|
|
103
|
-
export function BaseNode_getCache(node: BaseNode):
|
|
121
|
+
export function BaseNode_getCache(node: BaseNode): BaseNodeCacheInner {
|
|
104
122
|
return BaseNode_getPrivate(node)._cache;
|
|
105
123
|
}
|
|
106
124
|
export function BaseNode_clearCache(node: BaseNode): void {
|
|
@@ -484,7 +502,8 @@ function _clone_collection_new(
|
|
|
484
502
|
}
|
|
485
503
|
|
|
486
504
|
if (optionalFilter && node && !optionalFilter.shouldKeep(node)) {
|
|
487
|
-
doTrace &&
|
|
505
|
+
doTrace &&
|
|
506
|
+
traceLog(extraInfo.pad(), "skipping optional ", node.browseName.toString(), "that doesn't appear in the filter");
|
|
488
507
|
continue; // skip this node
|
|
489
508
|
}
|
|
490
509
|
const key = node.browseName.toString();
|
|
@@ -541,7 +560,7 @@ function _extractInterfaces2(typeDefinitionNode: UAObjectType | UAVariableType,
|
|
|
541
560
|
|
|
542
561
|
const hasInterfaceReference = addressSpace.findReferenceType("HasInterface");
|
|
543
562
|
if (!hasInterfaceReference) {
|
|
544
|
-
// this version of the standard UA namespace doesn't support Interface yet
|
|
563
|
+
// this version of the standard UA namespace doesn't support Interface yet
|
|
545
564
|
return [];
|
|
546
565
|
}
|
|
547
566
|
// example:
|
|
@@ -669,10 +688,7 @@ function _cloneInterface(
|
|
|
669
688
|
const interfaces = _extractInterfaces2(typeDefinitionNode, extraInfo);
|
|
670
689
|
if (interfaces.length === 0) {
|
|
671
690
|
if (doTrace) {
|
|
672
|
-
traceLog(
|
|
673
|
-
extraInfo.pad(),
|
|
674
|
-
chalk.yellow("No interface for ", node.browseName.toString(), node.nodeId.toString())
|
|
675
|
-
);
|
|
691
|
+
traceLog(extraInfo.pad(), chalk.yellow("No interface for ", node.browseName.toString(), node.nodeId.toString()));
|
|
676
692
|
}
|
|
677
693
|
return;
|
|
678
694
|
}
|
package/src/ua_data_type_impl.ts
CHANGED
|
@@ -31,7 +31,6 @@ import { get_subtypeOf } from "./tool_isSupertypeOf";
|
|
|
31
31
|
import { get_subtypeOfObj } from "./tool_isSupertypeOf";
|
|
32
32
|
import { BaseNode_getCache } from "./base_node_private";
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
export interface UADataTypeImpl {
|
|
36
35
|
_extensionObjectConstructor: ExtensionObjectConstructorFuncWithSchema;
|
|
37
36
|
}
|
|
@@ -149,8 +148,9 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
|
|
|
149
148
|
|
|
150
149
|
public getEncodingNode(encoding_name: string): UAObject | null {
|
|
151
150
|
const _cache = BaseNode_getCache(this);
|
|
151
|
+
_cache._encoding = _cache._encoding || {};
|
|
152
152
|
const key = encoding_name + "Node";
|
|
153
|
-
if (_cache[key] === undefined) {
|
|
153
|
+
if (_cache._encoding[key] === undefined) {
|
|
154
154
|
assert(encoding_name === "Default Binary" || encoding_name === "Default XML" || encoding_name === "Default JSON");
|
|
155
155
|
// could be binary or xml
|
|
156
156
|
const refs = this.findReferences("HasEncoding", true);
|
|
@@ -160,24 +160,18 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
|
|
|
160
160
|
.filter((obj: any) => obj !== null)
|
|
161
161
|
.filter((obj: any) => obj.browseName.toString() === encoding_name);
|
|
162
162
|
const node = encoding.length === 0 ? null : (encoding[0] as UAObject);
|
|
163
|
-
_cache[key] = node;
|
|
163
|
+
_cache._encoding[key] = node;
|
|
164
164
|
}
|
|
165
|
-
return _cache[key];
|
|
165
|
+
return _cache._encoding[key];
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
public getEncodingNodeId(encoding_name: string): ExpandedNodeId | null {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const encoding = this.getEncodingNode(encoding_name);
|
|
173
|
-
if (encoding) {
|
|
174
|
-
const namespaceUri = this.addressSpace.getNamespaceUri(encoding.nodeId.namespace);
|
|
175
|
-
_cache[key] = ExpandedNodeId.fromNodeId(encoding.nodeId, namespaceUri);
|
|
176
|
-
} else {
|
|
177
|
-
_cache[key] = null;
|
|
178
|
-
}
|
|
169
|
+
const encoding = this.getEncodingNode(encoding_name);
|
|
170
|
+
if (!encoding) {
|
|
171
|
+
return null;
|
|
179
172
|
}
|
|
180
|
-
|
|
173
|
+
const namespaceUri = this.addressSpace.getNamespaceUri(encoding.nodeId.namespace);
|
|
174
|
+
return ExpandedNodeId.fromNodeId(encoding.nodeId, namespaceUri);
|
|
181
175
|
}
|
|
182
176
|
/**
|
|
183
177
|
* returns the encoding of this node's
|
|
@@ -56,7 +56,7 @@ function _getAllSubtypes(ref: UAReferenceType) {
|
|
|
56
56
|
function _internal_getSubtypeIndex(referenceType: UAReferenceType): { [key: string]: UAReferenceTypePublic } {
|
|
57
57
|
const possibleReferenceTypes = _getAllSubtypes(referenceType);
|
|
58
58
|
// create a index of reference type with browseName as key for faster search
|
|
59
|
-
const keys:
|
|
59
|
+
const keys: Record<string, UAReferenceType> = {};
|
|
60
60
|
for (const refType of possibleReferenceTypes) {
|
|
61
61
|
keys[refType.nodeId.toString()] = refType;
|
|
62
62
|
}
|
|
@@ -65,7 +65,7 @@ function _internal_getSubtypeIndex(referenceType: UAReferenceType): { [key: stri
|
|
|
65
65
|
|
|
66
66
|
function _getSubtypeIndex(referenceType: UAReferenceType): { [key: string]: UAReferenceTypePublic } {
|
|
67
67
|
const _cache = BaseNode_getCache(referenceType);
|
|
68
|
-
if (!_cache._subtype_idx || _cache._subtype_idxVersion < ReferenceTypeCounter.count) {
|
|
68
|
+
if (!_cache._subtype_idx || (_cache._subtype_idxVersion && _cache._subtype_idxVersion < ReferenceTypeCounter.count)) {
|
|
69
69
|
// the cache need to be invalidated
|
|
70
70
|
_cache._subtype_idx = null;
|
|
71
71
|
}
|