node-opcua-client-proxy 2.55.0 → 2.58.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,14 +1,13 @@
1
- /**
2
- * @module node-opcua-client-proxy
3
- */
4
- import { NodeClass } from "node-opcua-data-model";
5
- import { NodeId } from "node-opcua-nodeid";
6
- import { ProxyBaseNode } from "./proxy_base_node";
7
- import { UAProxyManager } from "./proxy_manager";
8
-
9
- export class ProxyObject extends ProxyBaseNode {
10
-
11
- constructor(proxyManager: UAProxyManager, nodeId: NodeId) {
12
- super(proxyManager, nodeId, NodeClass.Object);
13
- }
14
- }
1
+ /**
2
+ * @module node-opcua-client-proxy
3
+ */
4
+ import { NodeClass } from "node-opcua-data-model";
5
+ import { NodeId } from "node-opcua-nodeid";
6
+ import { ProxyBaseNode } from "./proxy_base_node";
7
+ import { UAProxyManager } from "./proxy_manager";
8
+
9
+ export class ProxyObject extends ProxyBaseNode {
10
+ constructor(proxyManager: UAProxyManager, nodeId: NodeId) {
11
+ super(proxyManager, nodeId, NodeClass.Object);
12
+ }
13
+ }
@@ -2,20 +2,20 @@
2
2
  * @module node-opcua-client-proxy
3
3
  */
4
4
  import { NodeId } from "node-opcua-nodeid";
5
+ import { ProxyNode } from "./proxy_transition";
5
6
 
6
7
  export class ProxyState {
7
-
8
8
  private _node: any;
9
9
 
10
- constructor(proxyNode: any) {
11
- Object.defineProperty(this, "_node", { value: proxyNode, enumerable: false });
10
+ constructor(proxyNode: ProxyNode) {
11
+ this._node = proxyNode;
12
12
  }
13
13
 
14
- public get browseName() {
14
+ public get browseName(): string {
15
15
  return this._node.browseName.toString();
16
16
  }
17
17
 
18
- public get stateNumber() {
18
+ public get stateNumber(): string {
19
19
  // note stateNumber has no real dataValue
20
20
  return this._node.stateNumber.nodeId.value.toString();
21
21
  }
@@ -26,11 +26,10 @@ export class ProxyState {
26
26
  }
27
27
 
28
28
  public toString(): string {
29
-
30
29
  return "state " + this.browseName + " stateNumber :" + this.stateNumber.toString();
31
30
  }
32
31
  }
33
32
 
34
- export function makeProxyState(node: any) {
33
+ export function makeProxyState(node: ProxyNode): ProxyState {
35
34
  return new ProxyState(node);
36
35
  }
@@ -1,25 +1,23 @@
1
- /**
2
- * @module node-opcua-client-proxy
3
- */
4
- import { EventEmitter } from "events";
5
- import { assert } from "node-opcua-assert";
6
- import { NodeId } from "node-opcua-nodeid";
7
- import { UAProxyManager } from "./proxy_manager";
8
-
9
- export class StateMachineProxy extends EventEmitter {
10
-
11
- public nodeId: NodeId;
12
- private proxyManager: UAProxyManager;
13
-
14
- constructor(proxyManager: UAProxyManager, nodeId: NodeId) {
15
-
16
- super();
17
- this.nodeId = nodeId;
18
- this.proxyManager = proxyManager;
19
- assert(this.proxyManager.session, "expecting valid session");
20
- Object.defineProperty(this, "proxyManager", {
21
- enumerable: false,
22
- writable: true
23
- });
24
- }
25
- }
1
+ /**
2
+ * @module node-opcua-client-proxy
3
+ */
4
+ import { EventEmitter } from "events";
5
+ import { assert } from "node-opcua-assert";
6
+ import { NodeId } from "node-opcua-nodeid";
7
+ import { UAProxyManager } from "./proxy_manager";
8
+
9
+ export class StateMachineProxy extends EventEmitter {
10
+ public nodeId: NodeId;
11
+ private proxyManager: UAProxyManager;
12
+
13
+ constructor(proxyManager: UAProxyManager, nodeId: NodeId) {
14
+ super();
15
+ this.nodeId = nodeId;
16
+ this.proxyManager = proxyManager;
17
+ assert(this.proxyManager.session, "expecting valid session");
18
+ Object.defineProperty(this, "proxyManager", {
19
+ enumerable: false,
20
+ writable: true
21
+ });
22
+ }
23
+ }
@@ -1,31 +1,41 @@
1
+ import { QualifiedName } from "node-opcua-data-model";
2
+ import { NodeId } from "node-opcua-nodeid";
3
+
4
+ export interface ProxyNode {
5
+ nodeId: NodeId;
6
+ browseName: QualifiedName;
7
+ $fromState: ProxyNode;
8
+ $toState: ProxyNode;
9
+ $components: ProxyNode[];
10
+ typeDefinition?: { toString(): string };
11
+ }
1
12
  /**
2
13
  * @module node-opcua-client-proxy
3
14
  */
4
15
  export class ProxyTransition {
16
+ private _node: ProxyNode;
5
17
 
6
- private _node: any;
7
-
8
- constructor(proxyNode: any) {
9
- Object.defineProperty(this, "_node", {value: proxyNode, enumerable: false});
18
+ constructor(proxyNode: ProxyNode) {
19
+ this._node = proxyNode;
10
20
  }
11
21
 
12
- get nodeId() {
22
+ get nodeId(): string {
13
23
  // note stateNumber has no real dataValue
14
24
  return this._node.nodeId.value.toString();
15
25
  }
16
26
 
17
- get browseName() {
27
+ get browseName(): string {
18
28
  return this._node.browseName.toString();
19
29
  }
20
30
 
21
- get fromStateNode() {
31
+ get fromStateNode(): ProxyNode {
22
32
  return this._node.$fromState;
23
33
  }
24
34
 
25
- get toStateNode() {
35
+ get toStateNode(): ProxyNode {
26
36
  return this._node.$toState;
27
37
  }
28
38
  }
29
- export function makeProxyTransition(node: any) {
39
+ export function makeProxyTransition(node: ProxyNode): ProxyTransition {
30
40
  return new ProxyTransition(node);
31
41
  }
@@ -1,15 +1,14 @@
1
- /**
2
- * @module node-opcua-client-proxy
3
- */
4
- import { NodeClass } from "node-opcua-data-model";
5
- import { NodeId } from "node-opcua-nodeid";
6
- import { ReferenceDescription } from "node-opcua-service-browse";
7
- import { ProxyBaseNode } from "./proxy_base_node";
8
- import { UAProxyManager } from "./proxy_manager";
9
-
10
- export class ProxyVariable extends ProxyBaseNode {
11
-
12
- constructor(proxyManager: UAProxyManager, nodeId: NodeId, reference: ReferenceDescription) {
13
- super(proxyManager, nodeId, NodeClass.Variable);
14
- }
15
- }
1
+ /**
2
+ * @module node-opcua-client-proxy
3
+ */
4
+ import { NodeClass } from "node-opcua-data-model";
5
+ import { NodeId } from "node-opcua-nodeid";
6
+ import { ReferenceDescription } from "node-opcua-service-browse";
7
+ import { ProxyBaseNode } from "./proxy_base_node";
8
+ import { UAProxyManager } from "./proxy_manager";
9
+
10
+ export class ProxyVariable extends ProxyBaseNode {
11
+ constructor(proxyManager: UAProxyManager, nodeId: NodeId, reference: ReferenceDescription) {
12
+ super(proxyManager, nodeId, NodeClass.Variable);
13
+ }
14
+ }
@@ -1,57 +1,59 @@
1
- /**
2
- * @module node-opcua-client-proxy
3
- */
4
- import { assert } from "node-opcua-assert";
5
- import { makeProxyState, ProxyState } from "./proxy_state";
6
- import { makeProxyTransition, ProxyTransition } from "./proxy_transition";
7
-
8
- export class ProxyStateMachineType {
9
-
10
- public initialState: ProxyState | undefined;
11
- public states: ProxyState[];
12
- public transitions: ProxyTransition[];
13
-
14
- constructor(obj: any) {
15
-
16
- const localInitialState = obj.$components.filter((component: any) => {
17
- if (!component.typeDefinition) {
18
- return false;
19
- }
20
- return component.typeDefinition.toString() === "InitialStateType";
21
- });
22
-
23
- if (localInitialState.length) {
24
- assert(localInitialState.length === 1);
25
- this.initialState = new ProxyState(localInitialState[0]);
26
- } else {
27
- this.initialState = undefined;
28
- }
29
-
30
- this.states = obj.$components.filter((component: any) => {
31
- if (!component.typeDefinition) {
32
- return false;
33
- }
34
- return component.typeDefinition.toString() === "StateType";
35
- }).map(makeProxyState);
36
-
37
- this.transitions = obj.$components.filter((component: any) => {
38
- if (!component.typeDefinition) {
39
- return false;
40
- }
41
- return component.typeDefinition.toString() === "TransitionType";
42
- }).map(makeProxyTransition);
43
- }
44
-
45
- // var initialStateTypeId = makeRefId("InitialStateType");
46
- //
47
- // var initialStateType = addressSpace.findObjectType("InitialStateType");
48
- // should(!!initialStateType).eql(true);
49
- //
50
- // var stateType = addressSpace.findObjectType("StateType");
51
- // should(!!stateType).eql(true);
52
- //
53
- // var transitionType = addressSpace.findObjectType("TransitionType");
54
- // should(!!transitionType).eql(true);
55
-
56
- // }
57
- }
1
+ /**
2
+ * @module node-opcua-client-proxy
3
+ */
4
+ import { assert } from "node-opcua-assert";
5
+ import { makeProxyState, ProxyState } from "./proxy_state";
6
+ import { makeProxyTransition, ProxyNode, ProxyTransition } from "./proxy_transition";
7
+
8
+ export class ProxyStateMachineType {
9
+ public initialState: ProxyState | undefined;
10
+ public states: ProxyState[];
11
+ public transitions: ProxyTransition[];
12
+
13
+ constructor(obj: ProxyNode) {
14
+ const localInitialState = obj.$components.filter((component: any) => {
15
+ if (!component.typeDefinition) {
16
+ return false;
17
+ }
18
+ return component.typeDefinition.toString() === "InitialStateType";
19
+ });
20
+
21
+ if (localInitialState.length) {
22
+ assert(localInitialState.length === 1);
23
+ this.initialState = new ProxyState(localInitialState[0]);
24
+ } else {
25
+ this.initialState = undefined;
26
+ }
27
+
28
+ this.states = obj.$components
29
+ .filter((component: any) => {
30
+ if (!component.typeDefinition) {
31
+ return false;
32
+ }
33
+ return component.typeDefinition.toString() === "StateType";
34
+ })
35
+ .map(makeProxyState);
36
+
37
+ this.transitions = obj.$components
38
+ .filter((component: ProxyNode) => {
39
+ if (!component.typeDefinition) {
40
+ return false;
41
+ }
42
+ return component.typeDefinition.toString() === "TransitionType";
43
+ })
44
+ .map(makeProxyTransition);
45
+ }
46
+
47
+ // var initialStateTypeId = makeRefId("InitialStateType");
48
+ //
49
+ // var initialStateType = addressSpace.findObjectType("InitialStateType");
50
+ // should(!!initialStateType).eql(true);
51
+ //
52
+ // var stateType = addressSpace.findObjectType("StateType");
53
+ // should(!!stateType).eql(true);
54
+ //
55
+ // var transitionType = addressSpace.findObjectType("TransitionType");
56
+ // should(!!transitionType).eql(true);
57
+
58
+ // }
59
+ }