node-opcua-address-space 2.167.0 → 2.169.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.
Files changed (40) hide show
  1. package/dist/source/loader/namespace_post_step.js +25 -17
  2. package/dist/source/loader/namespace_post_step.js.map +1 -1
  3. package/dist/source/session_context.d.ts +3 -1
  4. package/dist/source/session_context.js +26 -1
  5. package/dist/source/session_context.js.map +1 -1
  6. package/dist/src/address_space.d.ts +14 -11
  7. package/dist/src/address_space.js +55 -54
  8. package/dist/src/address_space.js.map +1 -1
  9. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.d.ts +8 -8
  10. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +19 -19
  11. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
  12. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +11 -13
  13. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +21 -13
  14. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
  15. package/dist/src/alarms_and_conditions/ua_condition_impl.js +1 -1
  16. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
  17. package/dist/src/base_node_impl.d.ts +1 -0
  18. package/dist/src/base_node_impl.js +26 -15
  19. package/dist/src/base_node_impl.js.map +1 -1
  20. package/dist/src/namespace_impl.d.ts +40 -31
  21. package/dist/src/namespace_impl.js +174 -161
  22. package/dist/src/namespace_impl.js.map +1 -1
  23. package/dist/src/namespace_private.d.ts +12 -4
  24. package/dist/src/namespace_private.js +1 -4
  25. package/dist/src/namespace_private.js.map +1 -1
  26. package/dist/src/ua_method_impl.d.ts +11 -9
  27. package/dist/src/ua_method_impl.js +24 -27
  28. package/dist/src/ua_method_impl.js.map +1 -1
  29. package/dist/tsconfig_base.tsbuildinfo +1 -1
  30. package/package.json +35 -37
  31. package/source/loader/namespace_post_step.ts +28 -19
  32. package/source/session_context.ts +30 -1
  33. package/src/address_space.ts +113 -109
  34. package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +26 -28
  35. package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +33 -27
  36. package/src/alarms_and_conditions/ua_condition_impl.ts +1 -1
  37. package/src/base_node_impl.ts +27 -14
  38. package/src/namespace_impl.ts +232 -201
  39. package/src/namespace_private.ts +15 -9
  40. package/src/ua_method_impl.ts +43 -50
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-address-space",
3
- "version": "2.167.0",
3
+ "version": "2.169.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,53 +18,51 @@
18
18
  "fix:tsconfig": "node ../../code_gen/extract-modules.js tsconfig_base.json"
19
19
  },
20
20
  "dependencies": {
21
- "@types/lodash": "4.17.24",
22
21
  "@types/semver": "7.7.1",
23
22
  "chalk": "4.1.2",
24
23
  "dequeue": "^1.0.5",
25
- "lodash": "4.17.23",
26
- "node-opcua-address-space-base": "2.167.0",
24
+ "node-opcua-address-space-base": "2.169.0",
27
25
  "node-opcua-assert": "2.164.0",
28
- "node-opcua-basic-types": "2.167.0",
29
- "node-opcua-binary-stream": "2.167.0",
30
- "node-opcua-client-dynamic-extension-object": "2.167.0",
26
+ "node-opcua-basic-types": "2.169.0",
27
+ "node-opcua-binary-stream": "2.169.0",
28
+ "node-opcua-client-dynamic-extension-object": "2.169.0",
31
29
  "node-opcua-constants": "2.157.0",
32
- "node-opcua-crypto": "5.3.3",
33
- "node-opcua-data-access": "2.167.0",
34
- "node-opcua-data-model": "2.167.0",
35
- "node-opcua-data-value": "2.167.0",
36
- "node-opcua-date-time": "2.167.0",
37
- "node-opcua-debug": "2.165.0",
38
- "node-opcua-enum": "2.167.0",
39
- "node-opcua-extension-object": "2.167.0",
40
- "node-opcua-factory": "2.167.0",
41
- "node-opcua-nodeid": "2.167.0",
42
- "node-opcua-nodeset-ua": "2.167.0",
43
- "node-opcua-numeric-range": "2.167.0",
44
- "node-opcua-object-registry": "2.165.0",
45
- "node-opcua-pseudo-session": "2.167.0",
46
- "node-opcua-service-browse": "2.167.0",
47
- "node-opcua-service-call": "2.167.0",
48
- "node-opcua-service-history": "2.167.0",
49
- "node-opcua-service-translate-browse-path": "2.167.0",
50
- "node-opcua-service-write": "2.167.0",
51
- "node-opcua-status-code": "2.167.0",
52
- "node-opcua-types": "2.167.0",
53
- "node-opcua-utils": "2.165.0",
54
- "node-opcua-variant": "2.167.0",
55
- "node-opcua-xml2json": "2.167.0",
30
+ "node-opcua-crypto": "5.3.5",
31
+ "node-opcua-data-access": "2.169.0",
32
+ "node-opcua-data-model": "2.169.0",
33
+ "node-opcua-data-value": "2.169.0",
34
+ "node-opcua-date-time": "2.169.0",
35
+ "node-opcua-debug": "2.168.0",
36
+ "node-opcua-enum": "2.169.0",
37
+ "node-opcua-extension-object": "2.169.0",
38
+ "node-opcua-factory": "2.169.0",
39
+ "node-opcua-nodeid": "2.169.0",
40
+ "node-opcua-nodeset-ua": "2.169.0",
41
+ "node-opcua-numeric-range": "2.169.0",
42
+ "node-opcua-object-registry": "2.169.0",
43
+ "node-opcua-pseudo-session": "2.169.0",
44
+ "node-opcua-service-browse": "2.169.0",
45
+ "node-opcua-service-call": "2.169.0",
46
+ "node-opcua-service-history": "2.169.0",
47
+ "node-opcua-service-translate-browse-path": "2.169.0",
48
+ "node-opcua-service-write": "2.169.0",
49
+ "node-opcua-status-code": "2.169.0",
50
+ "node-opcua-types": "2.169.0",
51
+ "node-opcua-utils": "2.169.0",
52
+ "node-opcua-variant": "2.169.0",
53
+ "node-opcua-xml2json": "2.169.0",
56
54
  "semver": "^7.7.4",
57
55
  "thenify-ex": "4.4.0",
58
56
  "xml-writer": "^1.7.0"
59
57
  },
60
58
  "devDependencies": {
61
59
  "humanize": "0.0.9",
62
- "node-opcua-benchmarker": "2.167.0",
63
- "node-opcua-leak-detector": "2.165.0",
60
+ "node-opcua-benchmarker": "2.169.0",
61
+ "node-opcua-leak-detector": "2.169.0",
64
62
  "node-opcua-nodesets": "2.163.1",
65
- "node-opcua-packet-analyzer": "2.167.0",
66
- "node-opcua-schemas": "2.167.0",
67
- "node-opcua-service-filter": "2.167.0",
63
+ "node-opcua-packet-analyzer": "2.169.0",
64
+ "node-opcua-schemas": "2.169.0",
65
+ "node-opcua-service-filter": "2.169.0",
68
66
  "node-opcua-test-fixtures": "2.157.0"
69
67
  },
70
68
  "author": "Etienne Rossignon",
@@ -82,7 +80,7 @@
82
80
  "internet of things"
83
81
  ],
84
82
  "homepage": "http://node-opcua.github.io/",
85
- "gitHead": "5decfa86ee53a36ecd3bb454e7bf6e3dd27c7a4e",
83
+ "gitHead": "82d570d3e95bea689cbbe30096279885c5282245",
86
84
  "files": [
87
85
  "dist",
88
86
  "distHelpers",
@@ -29,28 +29,37 @@ function parentIsObjectOrVariableType(node: UAVariable | UAObject): boolean {
29
29
 
30
30
  export async function promoteObjectAndVariablesInNamespace(namespace: INamespace): Promise<void> {
31
31
  const namespaceP = namespace as NamespacePrivate;
32
- for (const a of namespaceP.nodeIterator()) {
33
- if (a.nodeClass === NodeClass.Object || a.nodeClass === NodeClass.Variable) {
34
- // skip object & variable that belong to a ObjectType or VariableType
35
- const aa = a as UAObject | UAVariable;
36
-
37
- if (aa.typeDefinition) {
38
- const promoter = g_promotableObject.get(aa.typeDefinition.toString());
39
- if (promoter) {
40
- if (promoter.onInstanceOnly && parentIsObjectOrVariableType(aa)) {
41
- continue;
42
- }
43
- const before = a.constructor.name;
44
-
45
- promoter.promoter(a as any);
46
- const after = a.constructor.name;
47
- // c8 ignore next
48
- if (doDebug) {
49
- debugLog(`promoting ${a.browseName.toString()} from ${before} to ${after}`);
50
- }
32
+
33
+ const promoteNode = (a: UAObject | UAVariable) => {
34
+ if (a.typeDefinition) {
35
+ const promoter = g_promotableObject.get(a.typeDefinition.toString());
36
+ if (promoter) {
37
+ if (promoter.onInstanceOnly && parentIsObjectOrVariableType(a)) {
38
+ return;
39
+ }
40
+ const before = a.constructor.name;
41
+
42
+ promoter.promoter(a as any);
43
+ const after = a.constructor.name;
44
+ // c8 ignore next
45
+ if (doDebug) {
46
+ debugLog(`promoting ${a.browseName.toString()} from ${before} to ${after}`);
51
47
  }
52
48
  }
53
49
  }
50
+ };
51
+
52
+ // Promote variables first so that TwoStateVariables and other variable types
53
+ // are fully promoted before objects (like StateMachines or Alarms) that contain them.
54
+ for (const a of namespaceP.nodeIterator()) {
55
+ if (a.nodeClass === NodeClass.Variable) {
56
+ promoteNode(a as UAVariable);
57
+ }
58
+ }
59
+ for (const a of namespaceP.nodeIterator()) {
60
+ if (a.nodeClass === NodeClass.Object) {
61
+ promoteNode(a as UAObject);
62
+ }
54
63
  }
55
64
  }
56
65
  export async function promoteObjectsAndVariables(addressSpace: IAddressSpace): Promise<void> {
@@ -207,13 +207,13 @@ export function makeRoles(roleIds: NodeIdLike[] | string | WellKnownRoles): Node
207
207
  }
208
208
  return roleIds.map((r) => resolveNodeId(r));
209
209
  }
210
+
210
211
  export class SessionContext implements ISessionContext {
211
212
  public static defaultContext = new SessionContext({});
212
213
 
213
214
  public object: UAObject | UAObjectType | undefined;
214
215
  public currentTime?: PreciseClock;
215
216
  public continuationPoints: Buffer[] = [];
216
- public userIdentity?: string;
217
217
  public readonly session?: ISessionBase;
218
218
  public readonly server?: IServerBase;
219
219
 
@@ -252,6 +252,35 @@ export class SessionContext implements ISessionContext {
252
252
  }
253
253
  }
254
254
 
255
+ public toJSON(): Record<string, string | null> {
256
+ return {
257
+ userName: this.getUserName(),
258
+ clientApplicationUri: this.clientApplicationUri,
259
+ session: this.session ? this.session.getSessionId().toString() : null
260
+ };
261
+ }
262
+
263
+ public toString(): string {
264
+ if (this === SessionContext.defaultContext) {
265
+ return "SessionContext({ default })";
266
+ }
267
+ return `SessionContext({ userName: "${this.getUserName()}", session: ${this.session ? this.session.getSessionId().toString() : "none"} })`;
268
+ }
269
+
270
+ public [Symbol.for("nodejs.util.inspect.custom")](): string {
271
+ return this.toString();
272
+ }
273
+
274
+ public getUserName(): string {
275
+ if (!this.session) {
276
+ return "<unknown client user id>";
277
+ }
278
+ const userIdentityToken = this.session.userIdentityToken;
279
+ if (!userIdentityToken) {
280
+ return "<unknown client user id>";
281
+ }
282
+ return getUserName(userIdentityToken);
283
+ }
255
284
  /**
256
285
  * getCurrentUserRoles
257
286
  *