node-opcua-address-space-base 2.105.0 → 2.107.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.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from "events";
3
3
  export type Duration = number;
4
- import { AccessRestrictionsFlag, AttributeIds, BrowseDirection, LocalizedText, NodeClass, QualifiedName, QualifiedNameLike, QualifiedNameOptions } from "node-opcua-data-model";
4
+ import { AccessRestrictionsFlag, AttributeIds, BrowseDirection, LocalizedText, LocalizedTextLike, NodeClass, QualifiedName, QualifiedNameLike, QualifiedNameOptions } from "node-opcua-data-model";
5
5
  import { DataType } from "node-opcua-variant";
6
6
  import { DataValue } from "node-opcua-data-value";
7
7
  import { NodeId, NodeIdLike } from "node-opcua-nodeid";
@@ -184,4 +184,5 @@ export declare class BaseNode extends EventEmitter {
184
184
  *
185
185
  */
186
186
  getAggregates(): BaseNode[];
187
+ setDescription(description: LocalizedTextLike): void;
187
188
  }
@@ -10,7 +10,7 @@ export type VariableSetterVariation1 = (this: UAVariable, value: Variant) => Sta
10
10
  export type VariableSetterVariation2 = (this: UAVariable, value: Variant, callback: CallbackT<StatusCode>) => void;
11
11
  export type VariableSetter = VariableSetterVariation1 | VariableSetterVariation2;
12
12
  export type HistoryReadFunc = (context: ISessionContext, historyReadDetails: ReadRawModifiedDetails | ReadEventDetails | ReadProcessedDetails | ReadAtTimeDetails, indexRange: NumericRange | null, dataEncoding: QualifiedNameLike | null, continuationData: ContinuationData, callback: CallbackT<HistoryReadResult>) => void;
13
- export type GetFunc = (this: UAVariable) => Variant;
13
+ export type GetFunc = (this: UAVariable) => Variant | StatusCode;
14
14
  export type SetFunc = VariableSetter | null;
15
15
  export type VariableDataValueGetterSync = (this: UAVariable) => DataValue;
16
16
  export type VariableDataValueGetterPromise = (this: UAVariable) => Promise<DataValue>;
@@ -3,12 +3,38 @@ import { UAVariable } from "./ua_variable";
3
3
  import { UAMethod } from "./ua_method";
4
4
  import { UAObjectType } from "./ua_object_type";
5
5
  import { UAVariableType } from "./ua_variable_type";
6
+ import { BaseNode } from "./base_node";
7
+ /** @private */
8
+ export declare function fullPath(node: BaseNode): string;
9
+ /** @private */
10
+ export declare function fullPath2(node: BaseNode): string;
11
+ /** @private */
12
+ export declare function exploreNode(node: BaseNode): void;
13
+ interface CloneInfo {
14
+ cloned: UAObject | UAVariable | UAMethod;
15
+ original: UAObject | UAVariable | UAMethod | UAVariableType | UAObjectType;
16
+ }
6
17
  export declare class CloneHelper {
7
18
  level: number;
8
- private readonly mapOrgToClone;
19
+ private _context;
20
+ private _contextStack;
21
+ private readonly mapTypeInstanceChildren;
9
22
  pad(): string;
10
- registerClonedObject<TO extends UAObject | UAVariable | UAMethod | UAObjectType | UAVariableType, TC extends UAObject | UAVariable | UAMethod>(clonedNode: TC, originalNode: TO): void;
11
- getCloned(originalNode: UAVariableType | UAObjectType): UAObject | UAVariable | UAMethod | null;
23
+ getClonedArray(): CloneInfo[];
24
+ pushContext<TO extends UAObject | UAVariable | UAMethod | UAObjectType | UAVariableType, TC extends UAObject | UAVariable | UAMethod>({ clonedParent, originalParent }: {
25
+ clonedParent: TC;
26
+ originalParent: TO;
27
+ }): void;
28
+ popContext(): void;
29
+ registerClonedObject<TO extends UAObject | UAVariable | UAMethod | UAObjectType | UAVariableType, TC extends UAObject | UAVariable | UAMethod>({ clonedNode, originalNode }: {
30
+ clonedNode: TC;
31
+ originalNode: TO;
32
+ }): void;
33
+ getCloned({ originalParent, clonedParent, originalNode }: {
34
+ originalParent: BaseNode;
35
+ clonedParent: BaseNode;
36
+ originalNode: UAVariable | UAObject;
37
+ }): UAObject | UAVariable | UAMethod | null;
12
38
  }
13
39
  export declare function reconstructNonHierarchicalReferences(extraInfo: CloneHelper): void;
14
40
  /**
@@ -18,3 +44,4 @@ export declare function reconstructNonHierarchicalReferences(extraInfo: CloneHel
18
44
  * @param baseType
19
45
  */
20
46
  export declare function reconstructFunctionalGroupType(extraInfo: CloneHelper): void;
47
+ export {};
@@ -1,14 +1,70 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reconstructFunctionalGroupType = exports.reconstructNonHierarchicalReferences = exports.CloneHelper = void 0;
6
+ exports.reconstructFunctionalGroupType = exports.reconstructNonHierarchicalReferences = exports.CloneHelper = exports.exploreNode = exports.fullPath2 = exports.fullPath = void 0;
4
7
  const node_opcua_assert_1 = require("node-opcua-assert");
5
8
  const node_opcua_debug_1 = require("node-opcua-debug");
6
9
  const node_opcua_data_model_1 = require("node-opcua-data-model");
7
10
  const node_opcua_nodeid_1 = require("node-opcua-nodeid");
8
11
  const node_opcua_constants_1 = require("node-opcua-constants");
9
- const debugLog = (0, node_opcua_debug_1.make_debugLog)("CLONE");
10
- const doDebug = (0, node_opcua_debug_1.checkDebugFlag)("CLONE");
12
+ const chalk_1 = __importDefault(require("chalk"));
11
13
  const warningLog = (0, node_opcua_debug_1.make_warningLog)("CLONE");
14
+ const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
15
+ const doTrace = (0, node_opcua_debug_1.checkDebugFlag)("INSTANTIATE");
16
+ const traceLog = errorLog;
17
+ // istanbul ignore next
18
+ /** @private */
19
+ function fullPath(node) {
20
+ const browseName = node.browseName.toString();
21
+ const parent = node.findReferencesExAsObject("Aggregates", node_opcua_data_model_1.BrowseDirection.Inverse)[0];
22
+ if (parent) {
23
+ return fullPath(parent) + "/" + browseName;
24
+ }
25
+ const containingFolder = node.findReferencesExAsObject("Organizes", node_opcua_data_model_1.BrowseDirection.Inverse)[0];
26
+ if (containingFolder) {
27
+ return fullPath(containingFolder) + "@" + browseName;
28
+ }
29
+ return browseName;
30
+ }
31
+ exports.fullPath = fullPath;
32
+ // istanbul ignore next
33
+ /** @private */
34
+ function fullPath2(node) {
35
+ return fullPath(node) + " (" + node.nodeId.toString() + ")";
36
+ }
37
+ exports.fullPath2 = fullPath2;
38
+ // istanbul ignore next
39
+ /** @private */
40
+ function exploreNode(node) {
41
+ const f = (n) => {
42
+ return `${n.browseName.toString()} (${n.nodeId.toString()})${n.modellingRule ? " - " + n.modellingRule : ""}`;
43
+ };
44
+ const r = (r) => {
45
+ const ref = node.addressSpace.findNode(r);
46
+ if (!ref)
47
+ return `${r.nodeId.toString()} (unknown)`;
48
+ return (ref === null || ref === void 0 ? void 0 : ref.browseName.toString()) + " " + ref.nodeId.toString();
49
+ };
50
+ const map = new Set();
51
+ const _explore = (node, pad) => {
52
+ const a = node.findReferencesEx("Aggregates", node_opcua_data_model_1.BrowseDirection.Forward);
53
+ const b = node.findReferencesEx("Organizes", node_opcua_data_model_1.BrowseDirection.Forward);
54
+ for (const ref of [...a, ...b]) {
55
+ const alreadyVisited = map.has(ref.nodeId.toString());
56
+ traceLog(pad, " +-- ", r(ref.referenceType).padEnd(20), "-->", f(ref.node).padEnd(10), alreadyVisited ? " (already visited)" : "");
57
+ if (alreadyVisited) {
58
+ continue;
59
+ }
60
+ map.add(ref.nodeId.toString());
61
+ _explore(ref.node, pad + " ");
62
+ }
63
+ };
64
+ traceLog("exploring ", f(node));
65
+ _explore(node, " ");
66
+ }
67
+ exports.exploreNode = exploreNode;
12
68
  //
13
69
  // case 1:
14
70
  // /-----------------------------\
@@ -32,7 +88,7 @@ const warningLog = (0, node_opcua_debug_1.make_warningLog)("CLONE");
32
88
  // \-----------------------------/
33
89
  // ^ |
34
90
  // | | +----------+
35
- // | +-------| Folder1  |
91
+ // | +-------| Folder1 |
36
92
  // | +----------+
37
93
  // | |
38
94
  // | +--------------|- (EnabledState) (shadow element)
@@ -42,7 +98,7 @@ const warningLog = (0, node_opcua_debug_1.make_warningLog)("CLONE");
42
98
  // \-----------------------------/
43
99
  // |
44
100
  // | | +----------+
45
- // | +-------| Folder1  |
101
+ // | +-------| Folder1 |
46
102
  // | +----------+
47
103
  // | |
48
104
  // | +--------------|- (EnabledState)
@@ -92,37 +148,94 @@ function followPath(node, path) {
92
148
  class CloneHelper {
93
149
  constructor() {
94
150
  this.level = 0;
95
- this.mapOrgToClone = new Map();
151
+ this._context = null;
152
+ this._contextStack = [];
153
+ this.mapTypeInstanceChildren = new Map();
96
154
  }
97
155
  pad() {
98
156
  return " ".padEnd(this.level * 2, " ");
99
157
  }
100
- registerClonedObject(clonedNode, originalNode) {
101
- this.mapOrgToClone.set(originalNode.nodeId.toString(), {
102
- cloned: clonedNode,
103
- original: originalNode
104
- });
105
- //
106
- const { parentType, path } = _get_parent_type_and_path(originalNode);
107
- if (parentType) {
108
- let base = parentType.subtypeOfObj;
109
- while (base) {
110
- const shadowChild = followPath(base, path);
111
- if (shadowChild) {
112
- this.mapOrgToClone.set(shadowChild.nodeId.toString(), {
113
- cloned: clonedNode,
114
- original: shadowChild
115
- });
116
- }
117
- base = base.subtypeOfObj;
158
+ getClonedArray() {
159
+ const result = [];
160
+ for (const map of this.mapTypeInstanceChildren.values()) {
161
+ for (const cloneInfo of map.values()) {
162
+ result.push(cloneInfo);
118
163
  }
119
164
  }
120
- else {
165
+ return result;
166
+ }
167
+ pushContext({ clonedParent, originalParent }) {
168
+ // istanbul ignore next
169
+ doTrace &&
170
+ traceLog(chalk_1.default.yellow("push context: "), "original parent = ", fullPath2(originalParent), "cloned parent =", fullPath2(clonedParent));
171
+ const typeInstance = originalParent.nodeId.toString() + clonedParent.nodeId.toString();
172
+ // istanbul ignore next
173
+ doTrace && traceLog("typeInstance (1) = ", typeInstance, fullPath2(originalParent), fullPath2(clonedParent));
174
+ let a = this.mapTypeInstanceChildren.get(typeInstance);
175
+ if (a) {
176
+ throw new Error("Internal Error");
177
+ }
178
+ a = new Map();
179
+ this.mapTypeInstanceChildren.set(typeInstance, a);
180
+ if (this._context) {
181
+ this._contextStack.push(this._context);
182
+ }
183
+ this._context = a;
184
+ }
185
+ popContext() {
186
+ (0, node_opcua_assert_1.assert)(this._contextStack.length > 0);
187
+ this._context = this._contextStack.pop();
188
+ }
189
+ registerClonedObject({ clonedNode, originalNode }) {
190
+ if (!this._context) {
191
+ this.pushContext({ clonedParent: clonedNode, originalParent: originalNode });
121
192
  }
193
+ // istanbul ignore next
194
+ doTrace &&
195
+ traceLog(chalk_1.default.yellow("registerClonedObject"), "originalNode = ", fullPath2(originalNode), "clonedNode =", fullPath2(clonedNode));
196
+ const insertShadow = (map) => {
197
+ const { parentType, path } = _get_parent_type_and_path(originalNode);
198
+ if (parentType) {
199
+ let base = parentType.subtypeOfObj;
200
+ while (base) {
201
+ const shadowChild = followPath(base, path);
202
+ if (shadowChild) {
203
+ // istanbul ignore next
204
+ doTrace && traceLog("shadowChild = ", fullPath2(shadowChild));
205
+ map.set(shadowChild.nodeId.toString(), {
206
+ cloned: clonedNode,
207
+ original: shadowChild
208
+ });
209
+ }
210
+ base = base.subtypeOfObj;
211
+ }
212
+ }
213
+ };
122
214
  // find subTypeOf
215
+ if (!this._context) {
216
+ throw new Error("internal error: Cannot find context");
217
+ }
218
+ // also create [Type+Instance] map
219
+ // to do so we need to find the TypeDefinition of the originalNode
220
+ this._context.set(originalNode.nodeId.toString(), {
221
+ cloned: clonedNode,
222
+ original: originalNode
223
+ });
224
+ insertShadow(this._context);
123
225
  }
124
- getCloned(originalNode) {
125
- const info = this.mapOrgToClone.get(originalNode.nodeId.toString());
226
+ getCloned({ originalParent, clonedParent, originalNode }) {
227
+ //
228
+ // Type Instance
229
+ // +-> Folder (A) +-> Folder (A')
230
+ // | | | |
231
+ // | +- Component (B) | +- Component (B')
232
+ // °-> Folder (C) [parentNode] +-> Folder (C') <= [clonedParent]
233
+ // | |
234
+ // +- Component (B again !) [originalNode] +- Component (B again !)
235
+ // istanbul ignore next
236
+ doTrace &&
237
+ traceLog("typeInstance (3) = originalParent", fullPath2(originalParent), "originalNode=", fullPath2(originalNode), "clonedParent", fullPath2(clonedParent));
238
+ const info = this._context.get(originalNode.nodeId.toString());
126
239
  if (info) {
127
240
  return info.cloned;
128
241
  }
@@ -166,13 +279,21 @@ function findNonHierarchicalReferences(originalObject) {
166
279
  references = _remove_unwanted_ref(references);
167
280
  return references;
168
281
  }
282
+ const findImplementedObject = (cloneInfoArray, ref) => {
283
+ const a = cloneInfoArray.filter((x) => x.original.nodeId.toString() === ref.nodeId.toString());
284
+ if (a.length === 0)
285
+ return null;
286
+ const info = a[0];
287
+ return info;
288
+ };
169
289
  function reconstructNonHierarchicalReferences(extraInfo) {
170
- const extraInfo_ = extraInfo;
171
- const findImplementedObject = (ref) => extraInfo_.mapOrgToClone.get(ref.nodeId.toString()) || null;
290
+ const cloneInfoArray = extraInfo.getClonedArray();
172
291
  // navigate through original objects to find those that are being references by node that
173
292
  // have been cloned .
174
293
  // this could be node organized by some FunctionalGroup
175
- for (const { original, cloned } of extraInfo_.mapOrgToClone.values()) {
294
+ // istanbul ignore next
295
+ doTrace && traceLog(chalk_1.default.yellow("reconstructNonHierarchicalReferences"));
296
+ for (const { original, cloned } of cloneInfoArray) {
176
297
  apply(original, cloned);
177
298
  }
178
299
  function apply(original, cloned) {
@@ -183,34 +304,23 @@ function reconstructNonHierarchicalReferences(extraInfo) {
183
304
  return;
184
305
  }
185
306
  // istanbul ignore next
186
- if (doDebug) {
187
- debugLog(" investigation ", original.browseName.toString(), cloned.nodeClass.toString(), original.nodeClass.toString(), original.nodeId.toString(), cloned.nodeId.toString());
188
- }
307
+ doTrace && traceLog(" investigation ", "original", fullPath2(original), node_opcua_data_model_1.NodeClass[cloned.nodeClass], fullPath2(cloned));
189
308
  for (const ref of originalNonHierarchical) {
190
- const info = findImplementedObject(ref);
309
+ const info = findImplementedObject(cloneInfoArray, ref);
310
+ if (!info)
311
+ continue;
191
312
  // if the object pointed by this reference is also cloned ...
192
- if (info) {
193
- const originalDest = info.original;
194
- const cloneDest = info.cloned;
195
- // istanbul ignore next
196
- if (doDebug) {
197
- debugLog(" adding reference ", ref.referenceType, addressSpace.findNode(ref.referenceType).browseName.toString(), " from cloned ", cloned.nodeId.toString(), cloned.browseName.toString(), " to cloned ", cloneDest.nodeId.toString(), cloneDest.browseName.toString());
198
- }
199
- // restore reference
200
- cloned.addReference({
201
- isForward: false,
202
- nodeId: cloneDest.nodeId,
203
- referenceType: ref.referenceType
204
- });
205
- }
206
- else {
207
- // // restore reference
208
- // cloned.addReference({
209
- // isForward: false,
210
- // nodeId: ref.nodeId,
211
- // referenceType: ref.referenceType
212
- // });
213
- }
313
+ const originalDest = info.original;
314
+ const cloneDest = info.cloned;
315
+ // istanbul ignore next
316
+ doTrace &&
317
+ traceLog(" adding reference ", fullPath2(addressSpace.findNode(ref.referenceType)), " from cloned ", fullPath2(cloned), " to cloned ", fullPath2(cloneDest));
318
+ // restore reference
319
+ cloned.addReference({
320
+ isForward: false,
321
+ nodeId: cloneDest.nodeId,
322
+ referenceType: ref.referenceType
323
+ });
214
324
  }
215
325
  }
216
326
  }
@@ -234,12 +344,12 @@ exports.reconstructNonHierarchicalReferences = reconstructNonHierarchicalReferen
234
344
  * +-------- Organizes---+
235
345
  */
236
346
  function reconstructFunctionalGroupType(extraInfo) {
237
- const extraInfo_ = extraInfo;
347
+ const cloneInfoArray = extraInfo.getClonedArray();
238
348
  // navigate through original objects to find those that are being organized by some FunctionalGroup
239
- for (const { original, cloned } of extraInfo_.mapOrgToClone.values()) {
349
+ for (const { original, cloned } of cloneInfoArray) {
240
350
  const organizedByArray = original.findReferencesEx("Organizes", node_opcua_data_model_1.BrowseDirection.Inverse);
241
351
  for (const ref of organizedByArray) {
242
- const info = extraInfo_.mapOrgToClone.get(ref.nodeId.toString());
352
+ const info = findImplementedObject(cloneInfoArray, ref);
243
353
  if (!info)
244
354
  continue;
245
355
  const folder = info.original;
@@ -1 +1 @@
1
- {"version":3,"file":"clone_helper.js","sourceRoot":"","sources":["../source/clone_helper.ts"],"names":[],"mappings":";;;AAAA,yDAA2C;AAC3C,uDAAkF;AAClF,iEAAkF;AAOlF,yDAA2D;AAC3D,+DAAwD;AAIxD,MAA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C,QAAQ,EAAE,KAAK,qBAAqB,CAAC,CAAC;YAEvF,qEAAqE;YACrE,MAAM,UAAU,GAAG,IAAI,CAAC,MAAkB,CAAC;YAE3C,IAAA,0BAAM,EAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAE1B,0EAA0E;YAC1E,MAAM,YAAY,GAAG,UAAU;iBAC1B,cAAc,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;iBACjD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC;YAC7C,IAAI,YAAY,EAAE;gBACd,SAAS;aACZ;YAED,UAAU,CAAC,YAAY,CAAC;gBACpB,SAAS,EAAE,CAAC,GAAG,CAAC,SAAS;gBACzB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,aAAa,EAAE,GAAG,CAAC,aAAa;aACnC,CAAC,CAAC;SACN;KACJ;AACL,CAAC;AArCD,wEAqCC"}
@@ -16,10 +16,22 @@ export declare const defaultCloneFilter: CloneFilter;
16
16
  export interface CloneExtraInfo {
17
17
  level: number;
18
18
  pad(): string;
19
- registerClonedObject(clonedNode: BaseNode, originalNode: BaseNode): void;
20
- getCloned(originalObject: BaseNode): BaseNode | null;
19
+ pushContext(params: {
20
+ clonedParent: BaseNode;
21
+ originalParent: BaseNode;
22
+ }): void;
23
+ popContext(): void;
24
+ registerClonedObject(params: {
25
+ clonedNode: BaseNode;
26
+ originalNode: BaseNode;
27
+ }): void;
28
+ getCloned(params: {
29
+ originalParent: BaseNode;
30
+ clonedParent: BaseNode;
31
+ originalNode: UAVariable | UAObject | UAMethod;
32
+ }): BaseNode | null;
21
33
  }
22
- export declare const makeDefaultCloneExtraInfo: () => CloneExtraInfo;
34
+ export declare const makeDefaultCloneExtraInfo: (node: UAVariable | UAMethod | UAObject) => CloneExtraInfo;
23
35
  export interface CloneOptions {
24
36
  namespace: INamespace;
25
37
  references?: UAReference[];
@@ -3,11 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeDefaultCloneExtraInfo = exports.defaultCloneFilter = void 0;
4
4
  const clone_helper_1 = require("./clone_helper");
5
5
  exports.defaultCloneFilter = {
6
- shouldKeep: () => true,
6
+ shouldKeep: (node) => {
7
+ if (node.modellingRule === "OptionalPlaceholder" || node.modellingRule === "MandatoryPlaceholder") {
8
+ return false;
9
+ }
10
+ return true;
11
+ },
7
12
  filterFor(node) {
8
13
  return this;
9
14
  }
10
15
  };
11
- const makeDefaultCloneExtraInfo = () => new clone_helper_1.CloneHelper();
16
+ const makeDefaultCloneExtraInfo = (node) => {
17
+ const extraInfo = new clone_helper_1.CloneHelper();
18
+ extraInfo.pushContext({ originalParent: node, clonedParent: node });
19
+ return extraInfo;
20
+ };
12
21
  exports.makeDefaultCloneExtraInfo = makeDefaultCloneExtraInfo;
13
22
  //# sourceMappingURL=clone_options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clone_options.js","sourceRoot":"","sources":["../source/clone_options.ts"],"names":[],"mappings":";;;AAWA,iDAA6C;AAMhC,QAAA,kBAAkB,GAAgB;IAC3C,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;IACtB,SAAS,CAAC,IAAc;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAC;AAUK,MAAM,yBAAyB,GAAG,GAAmB,EAAE,CAAG,IAAI,0BAAW,EAAE,CAAC;AAAtE,QAAA,yBAAyB,6BAA6C"}
1
+ {"version":3,"file":"clone_options.js","sourceRoot":"","sources":["../source/clone_options.ts"],"names":[],"mappings":";;;AAWA,iDAA6C;AAMhC,QAAA,kBAAkB,GAAgB;IAC3C,UAAU,EAAE,CAAC,IAAc,EAAE,EAAE;QAC3B,IAAI,IAAI,CAAC,aAAa,KAAK,qBAAqB,IAAI,IAAI,CAAC,aAAa,KAAK,sBAAsB,EAAE;YAC/F,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,SAAS,CAAC,IAAc;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAC;AAkBK,MAAM,yBAAyB,GAAG,CAAC,IAAsC,EAAkB,EAAE;IAChG,MAAM,SAAS,GAAG,IAAI,0BAAW,EAAE,CAAC;IACpC,SAAS,CAAC,WAAW,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IACpE,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAJW,QAAA,yBAAyB,6BAIpC"}
@@ -24,7 +24,7 @@ export interface IContinuationPointInfo<T> {
24
24
  statusCode: StatusCode;
25
25
  }
26
26
  export interface ContinuationData {
27
- continuationPoint: ContinuationPoint | null;
27
+ continuationPoint?: ContinuationPoint | null;
28
28
  releaseContinuationPoints?: boolean;
29
29
  index?: number;
30
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-address-space-base",
3
- "version": "2.105.0",
3
+ "version": "2.107.0",
4
4
  "description": "pure nodejs OPCUA SDK - module address-space-base",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -27,9 +27,9 @@
27
27
  "node-opcua-extension-object": "2.105.0",
28
28
  "node-opcua-nodeid": "2.105.0",
29
29
  "node-opcua-numeric-range": "2.105.0",
30
- "node-opcua-schemas": "2.105.0",
30
+ "node-opcua-schemas": "2.107.0",
31
31
  "node-opcua-status-code": "2.105.0",
32
- "node-opcua-types": "2.105.0",
32
+ "node-opcua-types": "2.107.0",
33
33
  "node-opcua-variant": "2.105.0"
34
34
  },
35
35
  "author": "Etienne Rossignon",
@@ -47,7 +47,7 @@
47
47
  "internet of things"
48
48
  ],
49
49
  "homepage": "http://node-opcua.github.io/",
50
- "gitHead": "41c30f321debfe92128905d97a52426b9d7f9b9e",
50
+ "gitHead": "df5c9168eea0d1a521603d181fa66ace7649e79e",
51
51
  "files": [
52
52
  "dist",
53
53
  "source"
@@ -7,6 +7,7 @@ import {
7
7
  AttributeIds,
8
8
  BrowseDirection,
9
9
  LocalizedText,
10
+ LocalizedTextLike,
10
11
  NodeClass,
11
12
  QualifiedName,
12
13
  QualifiedNameLike,
@@ -254,4 +255,6 @@ export declare class BaseNode extends EventEmitter {
254
255
  *
255
256
  */
256
257
  getAggregates(): BaseNode[];
258
+
259
+ setDescription(description: LocalizedTextLike): void;
257
260
  }
@@ -29,7 +29,7 @@ export type HistoryReadFunc = (
29
29
  callback: CallbackT<HistoryReadResult>
30
30
  ) => void;
31
31
 
32
- export type GetFunc = (this: UAVariable) => Variant;
32
+ export type GetFunc = (this: UAVariable) => Variant | StatusCode;
33
33
  export type SetFunc = VariableSetter | null;
34
34
 
35
35
  export type VariableDataValueGetterSync = (this: UAVariable) => DataValue;
@@ -1,23 +1,85 @@
1
1
  import { assert } from "node-opcua-assert";
2
- import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
2
+ import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
3
3
  import { BrowseDirection, NodeClass, QualifiedName } from "node-opcua-data-model";
4
+ import { makeNodeId, sameNodeId } from "node-opcua-nodeid";
5
+ import { ReferenceTypeIds } from "node-opcua-constants";
6
+
7
+ import chalk from "chalk";
8
+
4
9
  import { UAObject } from "./ua_object";
5
10
  import { UAVariable } from "./ua_variable";
6
11
  import { UAMethod } from "./ua_method";
7
12
  import { UAObjectType } from "./ua_object_type";
8
13
  import { UAVariableType } from "./ua_variable_type";
9
14
  import { BaseNode } from "./base_node";
10
- import { makeNodeId, sameNodeId } from "node-opcua-nodeid";
11
- import { ReferenceTypeIds } from "node-opcua-constants";
12
15
  import { UAReference } from "./ua_reference";
13
16
  import { IAddressSpace } from "./address_space";
14
17
 
15
- const debugLog = make_debugLog("CLONE");
16
- const doDebug = checkDebugFlag("CLONE");
17
18
  const warningLog = make_warningLog("CLONE");
18
19
 
20
+ const errorLog = make_errorLog(__filename);
21
+ const doTrace = checkDebugFlag("INSTANTIATE");
22
+ const traceLog = errorLog;
23
+
19
24
  type UAConcrete = UAVariable | UAObject | UAMethod;
20
25
 
26
+ // istanbul ignore next
27
+ /** @private */
28
+ export function fullPath(node: BaseNode): string {
29
+ const browseName = node.browseName.toString();
30
+
31
+ const parent = node.findReferencesExAsObject("Aggregates", BrowseDirection.Inverse)[0];
32
+ if (parent) {
33
+ return fullPath(parent) + "/" + browseName;
34
+ }
35
+ const containingFolder = node.findReferencesExAsObject("Organizes", BrowseDirection.Inverse)[0];
36
+ if (containingFolder) {
37
+ return fullPath(containingFolder) + "@" + browseName;
38
+ }
39
+ return browseName;
40
+ }
41
+ // istanbul ignore next
42
+ /** @private */
43
+ export function fullPath2(node: BaseNode): string {
44
+ return fullPath(node) + " (" + node.nodeId.toString() + ")";
45
+ }
46
+
47
+ // istanbul ignore next
48
+ /** @private */
49
+ export function exploreNode(node: BaseNode) {
50
+ const f = (n: BaseNode) => {
51
+ return `${n.browseName.toString()} (${n.nodeId.toString()})${n.modellingRule ? " - " + n.modellingRule : ""}`;
52
+ };
53
+ const r = (r: any) => {
54
+ const ref = node.addressSpace.findNode(r);
55
+ if (!ref) return `${r.nodeId.toString()} (unknown)`;
56
+ return ref?.browseName.toString() + " " + ref!.nodeId.toString();
57
+ };
58
+ const map = new Set();
59
+ const _explore = (node: BaseNode, pad: string) => {
60
+ const a = node.findReferencesEx("Aggregates", BrowseDirection.Forward);
61
+ const b = node.findReferencesEx("Organizes", BrowseDirection.Forward);
62
+
63
+ for (const ref of [...a, ...b]) {
64
+ const alreadyVisited = map.has(ref.nodeId.toString());
65
+ traceLog(
66
+ pad,
67
+ " +-- ",
68
+ r(ref.referenceType).padEnd(20),
69
+ "-->",
70
+ f(ref.node!).padEnd(10),
71
+ alreadyVisited ? " (already visited)" : ""
72
+ );
73
+ if (alreadyVisited) {
74
+ continue;
75
+ }
76
+ map.add(ref.nodeId.toString());
77
+ _explore(ref.node!, pad + " ");
78
+ }
79
+ };
80
+ traceLog("exploring ", f(node));
81
+ _explore(node, " ");
82
+ }
21
83
  //
22
84
  // case 1:
23
85
  // /-----------------------------\
@@ -42,7 +104,7 @@ type UAConcrete = UAVariable | UAObject | UAMethod;
42
104
  // \-----------------------------/
43
105
  // ^ |
44
106
  // | | +----------+
45
- // | +-------| Folder1  |
107
+ // | +-------| Folder1 |
46
108
  // | +----------+
47
109
  // | |
48
110
  // | +--------------|- (EnabledState) (shadow element)
@@ -52,7 +114,7 @@ type UAConcrete = UAVariable | UAObject | UAMethod;
52
114
  // \-----------------------------/
53
115
  // |
54
116
  // | | +----------+
55
- // | +-------| Folder1  |
117
+ // | +-------| Folder1 |
56
118
  // | +----------+
57
119
  // | |
58
120
  // | +--------------|- (EnabledState)
@@ -113,43 +175,141 @@ function followPath(node: BaseNode, path: QualifiedName[]): UAConcrete | null {
113
175
  return current as UAConcrete;
114
176
  }
115
177
 
178
+ type Context = Map<string, CloneInfo>;
179
+
116
180
  export class CloneHelper {
117
181
  public level = 0;
118
- private readonly mapOrgToClone: Map<string, CloneInfo> = new Map();
119
-
182
+ private _context: Context | null = null;
183
+ private _contextStack: Context[] = [];
184
+ private readonly mapTypeInstanceChildren: Map<string, Map<string, CloneInfo>> = new Map();
120
185
  public pad(): string {
121
186
  return " ".padEnd(this.level * 2, " ");
122
187
  }
188
+
189
+ public getClonedArray() {
190
+ const result: CloneInfo[] = [];
191
+ for (const map of this.mapTypeInstanceChildren.values()) {
192
+ for (const cloneInfo of map.values()) {
193
+ result.push(cloneInfo);
194
+ }
195
+ }
196
+ return result;
197
+ }
198
+
199
+ public pushContext<
200
+ TO extends UAObject | UAVariable | UAMethod | UAObjectType | UAVariableType,
201
+ TC extends UAObject | UAVariable | UAMethod
202
+ >({ clonedParent, originalParent }: { clonedParent: TC; originalParent: TO }): void {
203
+ // istanbul ignore next
204
+ doTrace &&
205
+ traceLog(
206
+ chalk.yellow("push context: "),
207
+ "original parent = ",
208
+ fullPath2(originalParent),
209
+ "cloned parent =",
210
+ fullPath2(clonedParent)
211
+ );
212
+
213
+ const typeInstance = originalParent.nodeId.toString() + clonedParent.nodeId.toString();
214
+
215
+ // istanbul ignore next
216
+ doTrace && traceLog("typeInstance (1) = ", typeInstance, fullPath2(originalParent), fullPath2(clonedParent));
217
+
218
+ let a = this.mapTypeInstanceChildren.get(typeInstance);
219
+ if (a) {
220
+ throw new Error("Internal Error");
221
+ }
222
+ a = new Map<string, CloneInfo>();
223
+ this.mapTypeInstanceChildren.set(typeInstance, a);
224
+
225
+ if (this._context) {
226
+ this._contextStack.push(this._context);
227
+ }
228
+ this._context = a;
229
+ }
230
+ public popContext() {
231
+ assert(this._contextStack.length > 0);
232
+ this._context = this._contextStack.pop()!;
233
+ }
123
234
  public registerClonedObject<
124
235
  TO extends UAObject | UAVariable | UAMethod | UAObjectType | UAVariableType,
125
236
  TC extends UAObject | UAVariable | UAMethod
126
- >(clonedNode: TC, originalNode: TO) {
127
- this.mapOrgToClone.set(originalNode.nodeId.toString(), {
128
- cloned: clonedNode,
129
- original: originalNode
130
- });
237
+ >({ clonedNode, originalNode }: { clonedNode: TC; originalNode: TO }): void {
238
+ if (!this._context) {
239
+ this.pushContext({ clonedParent: clonedNode, originalParent: originalNode });
240
+ }
241
+ // istanbul ignore next
242
+ doTrace &&
243
+ traceLog(
244
+ chalk.yellow("registerClonedObject"),
245
+ "originalNode = ",
246
+ fullPath2(originalNode),
247
+ "clonedNode =",
248
+ fullPath2(clonedNode)
249
+ );
131
250
 
132
- //
133
- const { parentType, path } = _get_parent_type_and_path(originalNode);
134
-
135
- if (parentType) {
136
- let base = parentType.subtypeOfObj;
137
- while (base) {
138
- const shadowChild = followPath(base, path);
139
- if (shadowChild) {
140
- this.mapOrgToClone.set(shadowChild.nodeId.toString(), {
141
- cloned: clonedNode,
142
- original: shadowChild
143
- });
251
+ const insertShadow = (map: Map<string, CloneInfo>) => {
252
+ const { parentType, path } = _get_parent_type_and_path(originalNode);
253
+
254
+ if (parentType) {
255
+ let base = parentType.subtypeOfObj;
256
+ while (base) {
257
+ const shadowChild = followPath(base, path);
258
+ if (shadowChild) {
259
+ // istanbul ignore next
260
+ doTrace && traceLog("shadowChild = ", fullPath2(shadowChild));
261
+ map.set(shadowChild.nodeId.toString(), {
262
+ cloned: clonedNode,
263
+ original: shadowChild
264
+ });
265
+ }
266
+ base = base.subtypeOfObj;
144
267
  }
145
- base = base.subtypeOfObj;
146
268
  }
147
- } else {
148
- }
269
+ };
149
270
  // find subTypeOf
271
+
272
+ if (!this._context) {
273
+ throw new Error("internal error: Cannot find context");
274
+ }
275
+ // also create [Type+Instance] map
276
+ // to do so we need to find the TypeDefinition of the originalNode
277
+ this._context.set(originalNode.nodeId.toString(), {
278
+ cloned: clonedNode,
279
+ original: originalNode
280
+ });
281
+ insertShadow(this._context);
150
282
  }
151
- public getCloned(originalNode: UAVariableType | UAObjectType): UAObject | UAVariable | UAMethod | null {
152
- const info = this.mapOrgToClone.get(originalNode.nodeId.toString());
283
+ public getCloned({
284
+ originalParent,
285
+ clonedParent,
286
+ originalNode
287
+ }: {
288
+ originalParent: BaseNode;
289
+ clonedParent: BaseNode;
290
+ originalNode: UAVariable | UAObject;
291
+ }): UAObject | UAVariable | UAMethod | null {
292
+ //
293
+ // Type Instance
294
+ // +-> Folder (A) +-> Folder (A')
295
+ // | | | |
296
+ // | +- Component (B) | +- Component (B')
297
+ // °-> Folder (C) [parentNode] +-> Folder (C') <= [clonedParent]
298
+ // | |
299
+ // +- Component (B again !) [originalNode] +- Component (B again !)
300
+
301
+ // istanbul ignore next
302
+ doTrace &&
303
+ traceLog(
304
+ "typeInstance (3) = originalParent",
305
+ fullPath2(originalParent),
306
+ "originalNode=",
307
+ fullPath2(originalNode),
308
+ "clonedParent",
309
+ fullPath2(clonedParent)
310
+ );
311
+
312
+ const info = this._context!.get(originalNode.nodeId.toString());
153
313
  if (info) {
154
314
  return info.cloned;
155
315
  }
@@ -208,19 +368,27 @@ function findNonHierarchicalReferences(originalObject: BaseNode): UAReference[]
208
368
  return references;
209
369
  }
210
370
 
211
- export function reconstructNonHierarchicalReferences(extraInfo: CloneHelper): void {
212
- const extraInfo_ = extraInfo as unknown as { mapOrgToClone: Map<string, CloneInfo> };
371
+ const findImplementedObject = (cloneInfoArray: CloneInfo[], ref: UAReference): CloneInfo | null => {
372
+ const a = cloneInfoArray.filter((x) => x.original.nodeId.toString() === ref.nodeId.toString());
373
+ if (a.length === 0) return null;
374
+ const info = a[0];
375
+ return info;
376
+ };
213
377
 
214
- const findImplementedObject = (ref: UAReference): CloneInfo | null =>
215
- extraInfo_.mapOrgToClone.get(ref.nodeId.toString()) || null;
378
+ export function reconstructNonHierarchicalReferences(extraInfo: CloneHelper): void {
379
+ const cloneInfoArray: CloneInfo[] = extraInfo.getClonedArray();
216
380
 
217
381
  // navigate through original objects to find those that are being references by node that
218
382
  // have been cloned .
219
383
  // this could be node organized by some FunctionalGroup
220
384
 
221
- for (const { original, cloned } of extraInfo_.mapOrgToClone.values()) {
385
+ // istanbul ignore next
386
+ doTrace && traceLog(chalk.yellow("reconstructNonHierarchicalReferences"));
387
+
388
+ for (const { original, cloned } of cloneInfoArray) {
222
389
  apply(original, cloned);
223
390
  }
391
+
224
392
  function apply(original: BaseNode, cloned: BaseNode) {
225
393
  const addressSpace = original.addressSpace;
226
394
  // find NonHierarchical References on original object
@@ -231,54 +399,34 @@ export function reconstructNonHierarchicalReferences(extraInfo: CloneHelper): vo
231
399
  }
232
400
 
233
401
  // istanbul ignore next
234
- if (doDebug) {
235
- debugLog(
236
- " investigation ",
237
- original.browseName.toString(),
238
- cloned.nodeClass.toString(),
239
- original.nodeClass.toString(),
240
- original.nodeId.toString(),
241
- cloned.nodeId.toString()
242
- );
243
- }
402
+ doTrace && traceLog(" investigation ", "original", fullPath2(original), NodeClass[cloned.nodeClass], fullPath2(cloned));
244
403
 
245
404
  for (const ref of originalNonHierarchical) {
246
- const info = findImplementedObject(ref);
405
+ const info = findImplementedObject(cloneInfoArray, ref);
406
+ if (!info) continue;
247
407
 
248
408
  // if the object pointed by this reference is also cloned ...
249
- if (info) {
250
- const originalDest = info.original;
251
- const cloneDest = info.cloned;
252
-
253
- // istanbul ignore next
254
- if (doDebug) {
255
- debugLog(
256
- " adding reference ",
257
- ref.referenceType,
258
- addressSpace.findNode(ref.referenceType)!.browseName.toString(),
259
- " from cloned ",
260
- cloned.nodeId.toString(),
261
- cloned.browseName.toString(),
262
- " to cloned ",
263
- cloneDest.nodeId.toString(),
264
- cloneDest.browseName.toString()
265
- );
266
- }
267
409
 
268
- // restore reference
269
- cloned.addReference({
270
- isForward: false,
271
- nodeId: cloneDest.nodeId,
272
- referenceType: ref.referenceType
273
- });
274
- } else {
275
- // // restore reference
276
- // cloned.addReference({
277
- // isForward: false,
278
- // nodeId: ref.nodeId,
279
- // referenceType: ref.referenceType
280
- // });
281
- }
410
+ const originalDest = info.original;
411
+ const cloneDest = info.cloned;
412
+
413
+ // istanbul ignore next
414
+ doTrace &&
415
+ traceLog(
416
+ " adding reference ",
417
+ fullPath2(addressSpace.findNode(ref.referenceType)!),
418
+ " from cloned ",
419
+ fullPath2(cloned),
420
+ " to cloned ",
421
+ fullPath2(cloneDest)
422
+ );
423
+
424
+ // restore reference
425
+ cloned.addReference({
426
+ isForward: false,
427
+ nodeId: cloneDest.nodeId,
428
+ referenceType: ref.referenceType
429
+ });
282
430
  }
283
431
  }
284
432
  }
@@ -303,14 +451,13 @@ export function reconstructNonHierarchicalReferences(extraInfo: CloneHelper): vo
303
451
  * +-------- Organizes---+
304
452
  */
305
453
  export function reconstructFunctionalGroupType(extraInfo: CloneHelper) {
306
- const extraInfo_ = extraInfo as unknown as { mapOrgToClone: Map<string, CloneInfo> };
454
+ const cloneInfoArray: CloneInfo[] = extraInfo.getClonedArray();
307
455
 
308
456
  // navigate through original objects to find those that are being organized by some FunctionalGroup
309
- for (const { original, cloned } of extraInfo_.mapOrgToClone.values()) {
457
+ for (const { original, cloned } of cloneInfoArray) {
310
458
  const organizedByArray = original.findReferencesEx("Organizes", BrowseDirection.Inverse);
311
-
312
459
  for (const ref of organizedByArray) {
313
- const info = extraInfo_.mapOrgToClone.get(ref.nodeId.toString());
460
+ const info = findImplementedObject(cloneInfoArray, ref);
314
461
  if (!info) continue;
315
462
 
316
463
  const folder = info.original;
@@ -16,7 +16,12 @@ export interface CloneFilter {
16
16
  filterFor(childInstance: UAVariable | UAObject | UAMethod): CloneFilter;
17
17
  }
18
18
  export const defaultCloneFilter: CloneFilter = {
19
- shouldKeep: () => true,
19
+ shouldKeep: (node: BaseNode) => {
20
+ if (node.modellingRule === "OptionalPlaceholder" || node.modellingRule === "MandatoryPlaceholder") {
21
+ return false;
22
+ }
23
+ return true;
24
+ },
20
25
  filterFor(node: BaseNode) {
21
26
  return this;
22
27
  }
@@ -26,11 +31,23 @@ export interface CloneExtraInfo {
26
31
  /* */
27
32
  level: number;
28
33
  pad(): string;
29
- registerClonedObject(clonedNode: BaseNode, originalNode: BaseNode): void;
30
- getCloned(originalObject: BaseNode): BaseNode | null;
34
+
35
+ pushContext(params: { clonedParent: BaseNode; originalParent: BaseNode }): void;
36
+ popContext(): void;
37
+
38
+ registerClonedObject(params: { clonedNode: BaseNode; originalNode: BaseNode }): void;
39
+ getCloned(params: {
40
+ originalParent: BaseNode;
41
+ clonedParent: BaseNode;
42
+ originalNode: UAVariable | UAObject | UAMethod;
43
+ }): BaseNode | null;
31
44
  }
32
45
 
33
- export const makeDefaultCloneExtraInfo = (): CloneExtraInfo => new CloneHelper();
46
+ export const makeDefaultCloneExtraInfo = (node: UAVariable | UAMethod | UAObject): CloneExtraInfo => {
47
+ const extraInfo = new CloneHelper();
48
+ extraInfo.pushContext({ originalParent: node, clonedParent: node });
49
+ return extraInfo;
50
+ };
34
51
 
35
52
  export interface CloneOptions /* extends ConstructNodeIdOptions */ {
36
53
  namespace: INamespace;
@@ -33,7 +33,7 @@ export interface IContinuationPointInfo<T> {
33
33
  statusCode: StatusCode;
34
34
  }
35
35
  export interface ContinuationData {
36
- continuationPoint: ContinuationPoint | null;
36
+ continuationPoint?: ContinuationPoint | null;
37
37
  releaseContinuationPoints?: boolean;
38
38
  index?: number;
39
39
  }