opcua-webapi-ts 1.1.19 → 1.1.20

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.
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReferenceToNode = void 0;
4
+ const opcua_webapi_1 = require("opcua-webapi");
5
+ const types_1 = require("../../common/types");
6
+ const UaObject_1 = require("../../common/nodes/UaObject");
7
+ const UaMethod_1 = require("../../common/nodes/UaMethod");
8
+ const UaObjectType_1 = require("../../common/nodes/UaObjectType");
9
+ const UaDataType_1 = require("../../common/nodes/UaDataType");
10
+ const UaVariableType_1 = require("../../common/nodes/UaVariableType");
11
+ const UaReferenceType_1 = require("../../common/nodes/UaReferenceType");
12
+ const __1 = require("../..");
13
+ class ReferenceToNode {
14
+ static fromReference(reference) {
15
+ if (reference.nodeClass === opcua_webapi_1.NodeClass.Object) {
16
+ return new UaObject_1.UaObject(reference.nodeId, reference.browseName, reference.displayName, 0, reference.typeDefinitionId);
17
+ }
18
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.Method) {
19
+ return new UaMethod_1.UaMethod(reference.nodeId, reference.browseName, reference.displayName);
20
+ }
21
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.ObjectType) {
22
+ return new UaObjectType_1.UaObjectType(reference.nodeId, reference.browseName, reference.displayName, false);
23
+ }
24
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.DataType) {
25
+ return new UaDataType_1.UaDataType(reference.nodeId, reference.browseName, reference.displayName, false);
26
+ }
27
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.VariableType) {
28
+ return new UaVariableType_1.UaVariableType(reference.nodeId, reference.browseName, reference.displayName, false, types_1.UaNodeId.nullNodeId, -1);
29
+ }
30
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.ReferenceType) {
31
+ return new UaReferenceType_1.UaReferenceType(reference.nodeId, reference.browseName, reference.displayName, false, types_1.UaLocalizedText.nullText, false);
32
+ }
33
+ return null;
34
+ }
35
+ static fromVariableAttribute(reference, variableAttributes) {
36
+ if (reference.nodeClass !== opcua_webapi_1.NodeClass.Variable)
37
+ return null;
38
+ return new __1.UaVariable(reference.nodeId, reference.browseName, reference.displayName, variableAttributes.dataType, variableAttributes.valueRank, variableAttributes.accessLevel, variableAttributes.userAccessLevel, variableAttributes.historizing, reference.typeDefinitionId);
39
+ }
40
+ }
41
+ exports.ReferenceToNode = ReferenceToNode;
@@ -20,3 +20,4 @@ __exportStar(require("./UaReferenceTypeDictionary"), exports);
20
20
  __exportStar(require("./UaNodeBrowser"), exports);
21
21
  __exportStar(require("./UaNodeReader"), exports);
22
22
  __exportStar(require("./UaModelling"), exports);
23
+ __exportStar(require("./UaReferenceToNode"), exports);
@@ -0,0 +1,7 @@
1
+ import { UaReference } from "../../common/types";
2
+ import { UaNode } from "../../common/nodes/UaNode";
3
+ import { OpcUaVariableAttributes, UaVariable } from "../..";
4
+ export declare class ReferenceToNode {
5
+ static fromReference(reference: UaReference): UaNode | null;
6
+ static fromVariableAttribute(reference: UaReference, variableAttributes: OpcUaVariableAttributes): UaVariable | null;
7
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReferenceToNode = void 0;
4
+ const opcua_webapi_1 = require("opcua-webapi");
5
+ const types_1 = require("../../common/types");
6
+ const UaObject_1 = require("../../common/nodes/UaObject");
7
+ const UaMethod_1 = require("../../common/nodes/UaMethod");
8
+ const UaObjectType_1 = require("../../common/nodes/UaObjectType");
9
+ const UaDataType_1 = require("../../common/nodes/UaDataType");
10
+ const UaVariableType_1 = require("../../common/nodes/UaVariableType");
11
+ const UaReferenceType_1 = require("../../common/nodes/UaReferenceType");
12
+ const __1 = require("../..");
13
+ class ReferenceToNode {
14
+ static fromReference(reference) {
15
+ if (reference.nodeClass === opcua_webapi_1.NodeClass.Object) {
16
+ return new UaObject_1.UaObject(reference.nodeId, reference.browseName, reference.displayName, 0, reference.typeDefinitionId);
17
+ }
18
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.Method) {
19
+ return new UaMethod_1.UaMethod(reference.nodeId, reference.browseName, reference.displayName);
20
+ }
21
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.ObjectType) {
22
+ return new UaObjectType_1.UaObjectType(reference.nodeId, reference.browseName, reference.displayName, false);
23
+ }
24
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.DataType) {
25
+ return new UaDataType_1.UaDataType(reference.nodeId, reference.browseName, reference.displayName, false);
26
+ }
27
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.VariableType) {
28
+ return new UaVariableType_1.UaVariableType(reference.nodeId, reference.browseName, reference.displayName, false, types_1.UaNodeId.nullNodeId, -1);
29
+ }
30
+ else if (reference.nodeClass === opcua_webapi_1.NodeClass.ReferenceType) {
31
+ return new UaReferenceType_1.UaReferenceType(reference.nodeId, reference.browseName, reference.displayName, false, types_1.UaLocalizedText.nullText, false);
32
+ }
33
+ return null;
34
+ }
35
+ static fromVariableAttribute(reference, variableAttributes) {
36
+ if (reference.nodeClass !== opcua_webapi_1.NodeClass.Variable)
37
+ return null;
38
+ return new __1.UaVariable(reference.nodeId, reference.browseName, reference.displayName, variableAttributes.dataType, variableAttributes.valueRank, variableAttributes.accessLevel, variableAttributes.userAccessLevel, variableAttributes.historizing, reference.typeDefinitionId);
39
+ }
40
+ }
41
+ exports.ReferenceToNode = ReferenceToNode;
@@ -4,3 +4,4 @@ export * from "./UaReferenceTypeDictionary";
4
4
  export * from "./UaNodeBrowser";
5
5
  export * from "./UaNodeReader";
6
6
  export * from "./UaModelling";
7
+ export * from "./UaReferenceToNode";
@@ -20,3 +20,4 @@ __exportStar(require("./UaReferenceTypeDictionary"), exports);
20
20
  __exportStar(require("./UaNodeBrowser"), exports);
21
21
  __exportStar(require("./UaNodeReader"), exports);
22
22
  __exportStar(require("./UaModelling"), exports);
23
+ __exportStar(require("./UaReferenceToNode"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opcua-webapi-ts",
3
- "version": "1.1.19",
3
+ "version": "1.1.20",
4
4
  "description": "Provides OPC UA WebAPI wrapper and client based on opcua-webapi-typescript",
5
5
  "author": "DingYan",
6
6
  "license": "MIT",