opcua-webapi-ts 1.1.12 → 1.1.16
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/cjs/client/UaWebClient.js +214 -0
- package/dist/cjs/client/base/UaWebClientNative.js +18 -6
- package/dist/cjs/common/payload/UaAddNodesItem.js +66 -0
- package/dist/cjs/common/payload/UaAddNodesResult.js +36 -0
- package/dist/cjs/common/payload/UaAddReferencesItem.js +54 -0
- package/dist/cjs/common/payload/UaDeleteNodesItem.js +32 -0
- package/dist/cjs/common/payload/UaDeleteReferencesItem.js +56 -0
- package/dist/cjs/common/payload/index.js +5 -0
- package/dist/cjs/common/structure/UaObjectAttributes.js +62 -0
- package/dist/cjs/common/structure/index.js +1 -0
- package/dist/client/UaWebClient.d.ts +10 -4
- package/dist/client/UaWebClient.js +214 -0
- package/dist/client/base/UaWebClientApi.d.ts +8 -4
- package/dist/client/base/UaWebClientNative.d.ts +8 -4
- package/dist/client/base/UaWebClientNative.js +18 -6
- package/dist/common/nodes/UaAttributes.d.ts +3 -3
- package/dist/common/payload/UaAddNodesItem.d.ts +22 -0
- package/dist/common/payload/UaAddNodesItem.js +66 -0
- package/dist/common/payload/UaAddNodesResult.d.ts +12 -0
- package/dist/common/payload/UaAddNodesResult.js +36 -0
- package/dist/common/payload/UaAddReferencesItem.d.ts +18 -0
- package/dist/common/payload/UaAddReferencesItem.js +54 -0
- package/dist/common/payload/UaDeleteNodesItem.d.ts +12 -0
- package/dist/common/payload/UaDeleteNodesItem.js +32 -0
- package/dist/common/payload/UaDeleteReferencesItem.d.ts +18 -0
- package/dist/common/payload/UaDeleteReferencesItem.js +56 -0
- package/dist/common/payload/index.d.ts +5 -0
- package/dist/common/payload/index.js +5 -0
- package/dist/common/structure/UaObjectAttributes.d.ts +20 -0
- package/dist/common/structure/UaObjectAttributes.js +62 -0
- package/dist/common/structure/index.d.ts +1 -0
- package/dist/common/structure/index.js +1 -0
- package/package.json +4 -4
|
@@ -369,6 +369,26 @@ class UaWebClient {
|
|
|
369
369
|
return ret;
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
|
+
addObject(parentNodeId, typeDefinitionNodeId, displayName, browseName, referenceTypeId) {
|
|
373
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
374
|
+
let objectAttributes = new common_1.UaObjectAttributes(displayName);
|
|
375
|
+
let extensionObject = objectAttributes.toExtensionObject();
|
|
376
|
+
let nodeToAdd = new common_1.UaAddNodesItem(new common_1.UaExpandedNodeId(parentNodeId), opcua_webapi_1.NodeClass.Object, extensionObject, new common_1.UaExpandedNodeId(typeDefinitionNodeId), null, browseName, referenceTypeId);
|
|
377
|
+
let results = yield this.addNodes([nodeToAdd]);
|
|
378
|
+
if (results[0].statusCode.isNotGood())
|
|
379
|
+
throw new common_1.UaError(results[0].statusCode);
|
|
380
|
+
let newNodeId = results[0].addedNodeId;
|
|
381
|
+
return newNodeId;
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
deleteNode(nodeId) {
|
|
385
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
386
|
+
let nodeToDelete = new common_1.UaDeleteNodesItem(nodeId);
|
|
387
|
+
let results = yield this.deleteNodes([nodeToDelete]);
|
|
388
|
+
if (results[0].isNotGood())
|
|
389
|
+
throw new common_1.UaError(results[0]);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
372
392
|
// Native APIs
|
|
373
393
|
browse(nodesToBrowse, maxReferencesPerNode, view, additionalParameters) {
|
|
374
394
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -754,6 +774,200 @@ class UaWebClient {
|
|
|
754
774
|
return response.Endpoints;
|
|
755
775
|
});
|
|
756
776
|
}
|
|
777
|
+
addNodes(nodesToAdd, additionalParameters) {
|
|
778
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
779
|
+
var _a, _b;
|
|
780
|
+
if (nodesToAdd.length == 0)
|
|
781
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
782
|
+
let NodesToAdd = [];
|
|
783
|
+
for (let item of nodesToAdd) {
|
|
784
|
+
NodesToAdd.push(item.toStruct());
|
|
785
|
+
}
|
|
786
|
+
let request = (0, opcua_webapi_1.AddNodesRequestFromJSON)({
|
|
787
|
+
RequestHeader: this.requestHeader(additionalParameters),
|
|
788
|
+
NodesToAdd: NodesToAdd
|
|
789
|
+
});
|
|
790
|
+
let timeout = this.requestTimeout(additionalParameters);
|
|
791
|
+
let response;
|
|
792
|
+
if (timeout > 0 && typeof AbortController !== "undefined") {
|
|
793
|
+
let controller = new AbortController();
|
|
794
|
+
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
795
|
+
try {
|
|
796
|
+
response = yield this.api.addNodes(request, { signal: controller.signal });
|
|
797
|
+
}
|
|
798
|
+
catch (error) {
|
|
799
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
800
|
+
}
|
|
801
|
+
finally {
|
|
802
|
+
clearTimeout(timeoutId);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
try {
|
|
807
|
+
response = yield this.api.addNodes(request);
|
|
808
|
+
}
|
|
809
|
+
catch (error) {
|
|
810
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.ResponseHeader) === null || _a === void 0 ? void 0 : _a.ServiceResult) === null || _b === void 0 ? void 0 : _b.Code)
|
|
814
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
815
|
+
if (!response.Results)
|
|
816
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
817
|
+
let results = [];
|
|
818
|
+
for (let item of response.Results) {
|
|
819
|
+
let result = common_1.UaAddNodesResult.fromStruct(item);
|
|
820
|
+
if (null == result)
|
|
821
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
822
|
+
results.push(result);
|
|
823
|
+
}
|
|
824
|
+
return results;
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
deleteNodes(nodesToDelete, additionalParameters) {
|
|
828
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
829
|
+
var _a, _b;
|
|
830
|
+
if (nodesToDelete.length == 0)
|
|
831
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
832
|
+
let NodesToDelete = [];
|
|
833
|
+
for (let item of nodesToDelete) {
|
|
834
|
+
NodesToDelete.push(item.toStruct());
|
|
835
|
+
}
|
|
836
|
+
let request = (0, opcua_webapi_1.DeleteNodesRequestFromJSON)({
|
|
837
|
+
RequestHeader: this.requestHeader(additionalParameters),
|
|
838
|
+
NodesToDelete: NodesToDelete
|
|
839
|
+
});
|
|
840
|
+
let timeout = this.requestTimeout(additionalParameters);
|
|
841
|
+
let response;
|
|
842
|
+
if (timeout > 0 && typeof AbortController !== "undefined") {
|
|
843
|
+
let controller = new AbortController();
|
|
844
|
+
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
845
|
+
try {
|
|
846
|
+
response = yield this.api.deleteNodes(request, { signal: controller.signal });
|
|
847
|
+
}
|
|
848
|
+
catch (error) {
|
|
849
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
850
|
+
}
|
|
851
|
+
finally {
|
|
852
|
+
clearTimeout(timeoutId);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
try {
|
|
857
|
+
response = yield this.api.deleteNodes(request);
|
|
858
|
+
}
|
|
859
|
+
catch (error) {
|
|
860
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.ResponseHeader) === null || _a === void 0 ? void 0 : _a.ServiceResult) === null || _b === void 0 ? void 0 : _b.Code)
|
|
864
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
865
|
+
if (!response.Results)
|
|
866
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
867
|
+
let results = [];
|
|
868
|
+
for (let item of response.Results) {
|
|
869
|
+
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
870
|
+
results.push(result);
|
|
871
|
+
}
|
|
872
|
+
return results;
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
addReferences(referencesToAdd, additionalParameters) {
|
|
876
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
877
|
+
var _a, _b;
|
|
878
|
+
if (referencesToAdd.length == 0)
|
|
879
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
880
|
+
let ReferencesToAdd = [];
|
|
881
|
+
for (let item of referencesToAdd) {
|
|
882
|
+
ReferencesToAdd.push(item.toStruct());
|
|
883
|
+
}
|
|
884
|
+
let request = (0, opcua_webapi_1.AddReferencesRequestFromJSON)({
|
|
885
|
+
RequestHeader: this.requestHeader(additionalParameters),
|
|
886
|
+
ReferencesToAdd: ReferencesToAdd
|
|
887
|
+
});
|
|
888
|
+
let timeout = this.requestTimeout(additionalParameters);
|
|
889
|
+
let response;
|
|
890
|
+
if (timeout > 0 && typeof AbortController !== "undefined") {
|
|
891
|
+
let controller = new AbortController();
|
|
892
|
+
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
893
|
+
try {
|
|
894
|
+
response = yield this.api.addReferences(request, { signal: controller.signal });
|
|
895
|
+
}
|
|
896
|
+
catch (error) {
|
|
897
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
898
|
+
}
|
|
899
|
+
finally {
|
|
900
|
+
clearTimeout(timeoutId);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
else {
|
|
904
|
+
try {
|
|
905
|
+
response = yield this.api.addReferences(request);
|
|
906
|
+
}
|
|
907
|
+
catch (error) {
|
|
908
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.ResponseHeader) === null || _a === void 0 ? void 0 : _a.ServiceResult) === null || _b === void 0 ? void 0 : _b.Code)
|
|
912
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
913
|
+
if (!response.Results)
|
|
914
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
915
|
+
let results = [];
|
|
916
|
+
for (let item of response.Results) {
|
|
917
|
+
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
918
|
+
results.push(result);
|
|
919
|
+
}
|
|
920
|
+
return results;
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
deleteReferences(referencesToDelete, additionalParameters) {
|
|
924
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
925
|
+
var _a, _b;
|
|
926
|
+
if (referencesToDelete.length == 0)
|
|
927
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
928
|
+
let ReferencesToDelete = [];
|
|
929
|
+
for (let item of referencesToDelete) {
|
|
930
|
+
ReferencesToDelete.push(item.toStruct());
|
|
931
|
+
}
|
|
932
|
+
let request = (0, opcua_webapi_1.DeleteReferencesRequestFromJSON)({
|
|
933
|
+
RequestHeader: this.requestHeader(additionalParameters),
|
|
934
|
+
ReferencesToDelete: ReferencesToDelete
|
|
935
|
+
});
|
|
936
|
+
let timeout = this.requestTimeout(additionalParameters);
|
|
937
|
+
let response;
|
|
938
|
+
if (timeout > 0 && typeof AbortController !== "undefined") {
|
|
939
|
+
let controller = new AbortController();
|
|
940
|
+
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
941
|
+
try {
|
|
942
|
+
response = yield this.api.deleteReferences(request, { signal: controller.signal });
|
|
943
|
+
}
|
|
944
|
+
catch (error) {
|
|
945
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
946
|
+
}
|
|
947
|
+
finally {
|
|
948
|
+
clearTimeout(timeoutId);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
try {
|
|
953
|
+
response = yield this.api.deleteReferences(request);
|
|
954
|
+
}
|
|
955
|
+
catch (error) {
|
|
956
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.ResponseHeader) === null || _a === void 0 ? void 0 : _a.ServiceResult) === null || _b === void 0 ? void 0 : _b.Code)
|
|
960
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
961
|
+
if (!response.Results)
|
|
962
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
963
|
+
let results = [];
|
|
964
|
+
for (let item of response.Results) {
|
|
965
|
+
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
966
|
+
results.push(result);
|
|
967
|
+
}
|
|
968
|
+
return results;
|
|
969
|
+
});
|
|
970
|
+
}
|
|
757
971
|
requestHeader(additionalParameters) {
|
|
758
972
|
let timeout = this.requestTimeout(additionalParameters);
|
|
759
973
|
let ret = {
|
|
@@ -12,23 +12,35 @@ class UaWebClientNative {
|
|
|
12
12
|
browseNext(request, initOverrides) {
|
|
13
13
|
return this.api.browseNext({ browseNextRequest: request }, initOverrides);
|
|
14
14
|
}
|
|
15
|
+
read(request, initOverrides) {
|
|
16
|
+
return this.api.read({ readRequest: request }, initOverrides);
|
|
17
|
+
}
|
|
18
|
+
write(request, initOverrides) {
|
|
19
|
+
return this.api.write({ writeRequest: request }, initOverrides);
|
|
20
|
+
}
|
|
15
21
|
call(request, initOverrides) {
|
|
16
22
|
return this.api.call({ callRequest: request }, initOverrides);
|
|
17
23
|
}
|
|
24
|
+
historyRead(request, initOverrides) {
|
|
25
|
+
return this.api.historyRead({ historyReadRequest: request }, initOverrides);
|
|
26
|
+
}
|
|
18
27
|
findServers(request, initOverrides) {
|
|
19
28
|
return this.api.findServers({ findServersRequest: request }, initOverrides);
|
|
20
29
|
}
|
|
21
30
|
getEndpoints(request, initOverrides) {
|
|
22
31
|
return this.api.getEndpoints({ getEndpointsRequest: request }, initOverrides);
|
|
23
32
|
}
|
|
24
|
-
|
|
25
|
-
return this.api.
|
|
33
|
+
addNodes(request, initOverrides) {
|
|
34
|
+
return this.api.addNodes({ addNodesRequest: request }, initOverrides);
|
|
26
35
|
}
|
|
27
|
-
|
|
28
|
-
return this.api.
|
|
36
|
+
deleteNodes(request, initOverrides) {
|
|
37
|
+
return this.api.deleteNodes({ deleteNodesRequest: request }, initOverrides);
|
|
29
38
|
}
|
|
30
|
-
|
|
31
|
-
return this.api.
|
|
39
|
+
addReferences(request, initOverrides) {
|
|
40
|
+
return this.api.addReferences({ addReferencesRequest: request }, initOverrides);
|
|
41
|
+
}
|
|
42
|
+
deleteReferences(request, initOverrides) {
|
|
43
|
+
return this.api.deleteReferences({ deleteReferencesRequest: request }, initOverrides);
|
|
32
44
|
}
|
|
33
45
|
}
|
|
34
46
|
exports.UaWebClientNative = UaWebClientNative;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaAddNodesItem = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const nodes_1 = require("../nodes");
|
|
6
|
+
const __1 = require("../..");
|
|
7
|
+
class UaAddNodesItem {
|
|
8
|
+
constructor(parentNodeId, nodeClass, nodeAttributes, typeDefinition, requestedNewNodeId, browseName, referenceTypeId) {
|
|
9
|
+
this._parentNodeId = parentNodeId;
|
|
10
|
+
this._nodeClass = nodeClass;
|
|
11
|
+
this._nodeAttributes = nodeAttributes;
|
|
12
|
+
this._typeDefinition = (undefined != typeDefinition) ? typeDefinition : null;
|
|
13
|
+
this._requestedNewNodeId = (undefined != requestedNewNodeId) ? requestedNewNodeId : null;
|
|
14
|
+
this._browseName = (undefined != browseName) ? browseName : null;
|
|
15
|
+
this._referenceTypeId = (undefined != referenceTypeId) ? referenceTypeId : null;
|
|
16
|
+
}
|
|
17
|
+
get parentNodeId() {
|
|
18
|
+
return this._parentNodeId;
|
|
19
|
+
}
|
|
20
|
+
get nodeClass() {
|
|
21
|
+
return this._nodeClass;
|
|
22
|
+
}
|
|
23
|
+
get nodeAttributes() {
|
|
24
|
+
return this._nodeAttributes;
|
|
25
|
+
}
|
|
26
|
+
get typeDefinition() {
|
|
27
|
+
return this._typeDefinition;
|
|
28
|
+
}
|
|
29
|
+
get requestedNewNodeId() {
|
|
30
|
+
return this._requestedNewNodeId;
|
|
31
|
+
}
|
|
32
|
+
get browseName() {
|
|
33
|
+
return this._browseName;
|
|
34
|
+
}
|
|
35
|
+
get referenceTypeId() {
|
|
36
|
+
return this._referenceTypeId;
|
|
37
|
+
}
|
|
38
|
+
toStruct() {
|
|
39
|
+
let addNodesItem = {
|
|
40
|
+
ParentNodeId: this._parentNodeId.toString(),
|
|
41
|
+
NodeClass: this._nodeClass,
|
|
42
|
+
NodeAttributes: __1.UaPayloadMapper.extensionObjectToWebApi(this._nodeAttributes),
|
|
43
|
+
TypeDefinition: (this._typeDefinition) ? this._typeDefinition.toString() : undefined,
|
|
44
|
+
RequestedNewNodeId: (this._requestedNewNodeId) ? this._requestedNewNodeId.toString() : undefined,
|
|
45
|
+
BrowseName: (this._browseName) ? this._browseName : undefined,
|
|
46
|
+
ReferenceTypeId: (this._referenceTypeId) ? this._referenceTypeId.toString() : undefined
|
|
47
|
+
};
|
|
48
|
+
return addNodesItem;
|
|
49
|
+
}
|
|
50
|
+
static fromStruct(addNodesItem) {
|
|
51
|
+
if (addNodesItem.ParentNodeId === undefined || addNodesItem.NodeClass === undefined || addNodesItem.NodeAttributes === undefined)
|
|
52
|
+
return null;
|
|
53
|
+
let parentNodeId = (0, types_1.parseUaExpandedNodeIdOrNull)(addNodesItem.ParentNodeId);
|
|
54
|
+
let nodeClass = (typeof addNodesItem.NodeClass === "number") ? addNodesItem.NodeClass : null;
|
|
55
|
+
let nodeAttributes = __1.UaPayloadMapper.extensionObjectFromWebApi(addNodesItem.NodeAttributes);
|
|
56
|
+
let typeDefinition = (addNodesItem.TypeDefinition) ? (0, types_1.parseUaExpandedNodeIdOrNull)(addNodesItem.TypeDefinition) : null;
|
|
57
|
+
let requestedNewNodeId = (addNodesItem.RequestedNewNodeId) ? (0, types_1.parseUaExpandedNodeIdOrNull)(addNodesItem.RequestedNewNodeId) : null;
|
|
58
|
+
let browseName = (typeof addNodesItem.BrowseName === "string") ? addNodesItem.BrowseName : null;
|
|
59
|
+
let referenceTypeId = (addNodesItem.ReferenceTypeId) ? (0, types_1.parseUaNodeIdOrNull)(addNodesItem.ReferenceTypeId) : null;
|
|
60
|
+
if (null == parentNodeId || null == nodeClass || null == nodeAttributes)
|
|
61
|
+
return null;
|
|
62
|
+
return new UaAddNodesItem(parentNodeId, nodeClass, nodeAttributes, typeDefinition, requestedNewNodeId, browseName, referenceTypeId);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.UaAddNodesItem = UaAddNodesItem;
|
|
66
|
+
UaAddNodesItem.dataTypeId = new types_1.UaNodeId(nodes_1.DataTypeIds.AddNodesItem);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaAddNodesResult = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const nodes_1 = require("../nodes");
|
|
6
|
+
const __1 = require("../..");
|
|
7
|
+
class UaAddNodesResult {
|
|
8
|
+
constructor(statusCode, addedNodeId) {
|
|
9
|
+
this._statusCode = statusCode;
|
|
10
|
+
this._addedNodeId = addedNodeId;
|
|
11
|
+
}
|
|
12
|
+
get statusCode() {
|
|
13
|
+
return this._statusCode;
|
|
14
|
+
}
|
|
15
|
+
get addedNodeId() {
|
|
16
|
+
return this._addedNodeId;
|
|
17
|
+
}
|
|
18
|
+
toStruct() {
|
|
19
|
+
let addNodesResult = {
|
|
20
|
+
StatusCode: __1.UaPayloadMapper.statusCodeToWebApi(this._statusCode),
|
|
21
|
+
AddedNodeId: this._addedNodeId.toString()
|
|
22
|
+
};
|
|
23
|
+
return addNodesResult;
|
|
24
|
+
}
|
|
25
|
+
static fromStruct(addNodesResult) {
|
|
26
|
+
if (addNodesResult.StatusCode === undefined || addNodesResult.AddedNodeId === undefined)
|
|
27
|
+
return null;
|
|
28
|
+
let statusCode = __1.UaPayloadMapper.statusCodeFromWebApi(addNodesResult.StatusCode);
|
|
29
|
+
let addedNodeId = (0, types_1.parseUaNodeIdOrNull)(addNodesResult.AddedNodeId);
|
|
30
|
+
if (addedNodeId === null)
|
|
31
|
+
return null;
|
|
32
|
+
return new UaAddNodesResult(statusCode, addedNodeId);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.UaAddNodesResult = UaAddNodesResult;
|
|
36
|
+
UaAddNodesResult.dataTypeId = new types_1.UaNodeId(nodes_1.DataTypeIds.AddNodesResult);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaAddReferencesItem = void 0;
|
|
4
|
+
const opcua_webapi_1 = require("opcua-webapi");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const nodes_1 = require("../nodes");
|
|
7
|
+
class UaAddReferencesItem {
|
|
8
|
+
constructor(sourceNodeId, targetNodeId, isForward, referenceTypeId, targetNodeClass) {
|
|
9
|
+
this._sourceNodeId = sourceNodeId;
|
|
10
|
+
this._targetNodeId = targetNodeId;
|
|
11
|
+
this._isForward = isForward;
|
|
12
|
+
this._referenceTypeId = referenceTypeId;
|
|
13
|
+
this._targetNodeClass = targetNodeClass;
|
|
14
|
+
}
|
|
15
|
+
get sourceNodeId() {
|
|
16
|
+
return this._sourceNodeId;
|
|
17
|
+
}
|
|
18
|
+
get targetNodeId() {
|
|
19
|
+
return this._targetNodeId;
|
|
20
|
+
}
|
|
21
|
+
get isForward() {
|
|
22
|
+
return this._isForward;
|
|
23
|
+
}
|
|
24
|
+
get referenceTypeId() {
|
|
25
|
+
return this._referenceTypeId;
|
|
26
|
+
}
|
|
27
|
+
get targetNodeClass() {
|
|
28
|
+
return this._targetNodeClass;
|
|
29
|
+
}
|
|
30
|
+
toStruct() {
|
|
31
|
+
let addReferencesItem = {
|
|
32
|
+
SourceNodeId: this._sourceNodeId.toString(),
|
|
33
|
+
TargetNodeId: this._targetNodeId.toString(),
|
|
34
|
+
IsForward: this._isForward,
|
|
35
|
+
ReferenceTypeId: this._referenceTypeId.toString(),
|
|
36
|
+
TargetNodeClass: this._targetNodeClass
|
|
37
|
+
};
|
|
38
|
+
return addReferencesItem;
|
|
39
|
+
}
|
|
40
|
+
static fromStruct(addReferencesItem) {
|
|
41
|
+
if (addReferencesItem.SourceNodeId === undefined || addReferencesItem.TargetNodeId === undefined)
|
|
42
|
+
return null;
|
|
43
|
+
let sourceNodeId = (0, types_1.parseUaNodeIdOrNull)(addReferencesItem.SourceNodeId);
|
|
44
|
+
let targetNodeId = (0, types_1.parseUaExpandedNodeIdOrNull)(addReferencesItem.TargetNodeId);
|
|
45
|
+
let isForward = (undefined != addReferencesItem.IsForward) ? addReferencesItem.IsForward : true;
|
|
46
|
+
let referenceTypeId = (undefined != addReferencesItem.ReferenceTypeId) ? (0, types_1.parseUaNodeIdOrNull)(addReferencesItem.ReferenceTypeId) : undefined;
|
|
47
|
+
let targetNodeClass = (undefined != addReferencesItem.TargetNodeClass) ? addReferencesItem.TargetNodeClass : opcua_webapi_1.NodeClass.Unspecified;
|
|
48
|
+
if (sourceNodeId === null || targetNodeId === null || referenceTypeId === undefined)
|
|
49
|
+
return null;
|
|
50
|
+
return new UaAddReferencesItem(sourceNodeId, targetNodeId, isForward, referenceTypeId, targetNodeClass);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.UaAddReferencesItem = UaAddReferencesItem;
|
|
54
|
+
UaAddReferencesItem.dataTypeId = new types_1.UaNodeId(nodes_1.DataTypeIds.AddReferencesItem);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaDeleteNodesItem = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const nodes_1 = require("../nodes");
|
|
6
|
+
class UaDeleteNodesItem {
|
|
7
|
+
constructor(nodeId, deleteTargetReferences = false) {
|
|
8
|
+
this._nodeId = nodeId;
|
|
9
|
+
this._deleteTargetReferences = deleteTargetReferences;
|
|
10
|
+
}
|
|
11
|
+
get nodeId() {
|
|
12
|
+
return this._nodeId;
|
|
13
|
+
}
|
|
14
|
+
get deleteTargetReferences() {
|
|
15
|
+
return this._deleteTargetReferences;
|
|
16
|
+
}
|
|
17
|
+
toStruct() {
|
|
18
|
+
let item = {
|
|
19
|
+
NodeId: this._nodeId.toString(),
|
|
20
|
+
DeleteTargetReferences: this._deleteTargetReferences
|
|
21
|
+
};
|
|
22
|
+
return item;
|
|
23
|
+
}
|
|
24
|
+
fromStruct(item) {
|
|
25
|
+
let nodeId = (0, types_1.parseUaNodeIdOrNull)(item.NodeId);
|
|
26
|
+
if (!nodeId)
|
|
27
|
+
return null;
|
|
28
|
+
return new UaDeleteNodesItem(nodeId, item.DeleteTargetReferences);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.UaDeleteNodesItem = UaDeleteNodesItem;
|
|
32
|
+
UaDeleteNodesItem.dataTypeId = new types_1.UaNodeId(nodes_1.DataTypeIds.DeleteNodesItem);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaDeleteReferencesItem = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const nodes_1 = require("../nodes");
|
|
6
|
+
class UaDeleteReferencesItem {
|
|
7
|
+
constructor(sourceNodeId, targetNodeId, isForward, referenceTypeId, deleteBidirectional = true) {
|
|
8
|
+
this._sourceNodeId = sourceNodeId;
|
|
9
|
+
this._targetNodeId = targetNodeId;
|
|
10
|
+
this._isForward = isForward;
|
|
11
|
+
this._referenceTypeId = referenceTypeId;
|
|
12
|
+
this._deleteBidirectional = deleteBidirectional;
|
|
13
|
+
}
|
|
14
|
+
get sourceNodeId() {
|
|
15
|
+
return this._sourceNodeId;
|
|
16
|
+
}
|
|
17
|
+
get targetNodeId() {
|
|
18
|
+
return this._targetNodeId;
|
|
19
|
+
}
|
|
20
|
+
get isForward() {
|
|
21
|
+
return this._isForward;
|
|
22
|
+
}
|
|
23
|
+
get referenceTypeId() {
|
|
24
|
+
return this._referenceTypeId;
|
|
25
|
+
}
|
|
26
|
+
get deleteBidirectional() {
|
|
27
|
+
return this._deleteBidirectional;
|
|
28
|
+
}
|
|
29
|
+
toStruct() {
|
|
30
|
+
return {
|
|
31
|
+
SourceNodeId: this._sourceNodeId.toString(),
|
|
32
|
+
TargetNodeId: this._targetNodeId.toString(),
|
|
33
|
+
IsForward: this._isForward,
|
|
34
|
+
ReferenceTypeId: this._referenceTypeId.toString(),
|
|
35
|
+
DeleteBidirectional: this._deleteBidirectional
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
static fromStruct(item) {
|
|
39
|
+
if (!item.SourceNodeId || !item.TargetNodeId)
|
|
40
|
+
return null;
|
|
41
|
+
let sourceNodeId = (0, types_1.parseUaNodeIdOrNull)(item.SourceNodeId);
|
|
42
|
+
if (!sourceNodeId)
|
|
43
|
+
return null;
|
|
44
|
+
let targetNodeId = (0, types_1.parseUaExpandedNodeIdOrNull)(item.TargetNodeId);
|
|
45
|
+
if (!targetNodeId)
|
|
46
|
+
return null;
|
|
47
|
+
let referenceTypeId = (item.ReferenceTypeId) ? (0, types_1.parseUaNodeIdOrNull)(item.ReferenceTypeId) : types_1.UaNodeId.nullNodeId;
|
|
48
|
+
if (!referenceTypeId)
|
|
49
|
+
return null;
|
|
50
|
+
let isForward = (item.IsForward !== undefined) ? item.IsForward : true;
|
|
51
|
+
let deleteBidirectional = (item.DeleteBidirectional !== undefined) ? item.DeleteBidirectional : true;
|
|
52
|
+
return new UaDeleteReferencesItem(sourceNodeId, targetNodeId, isForward, referenceTypeId, deleteBidirectional);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.UaDeleteReferencesItem = UaDeleteReferencesItem;
|
|
56
|
+
UaDeleteReferencesItem.dataTypeId = new types_1.UaNodeId(nodes_1.DataTypeIds.DeleteReferencesItem);
|
|
@@ -24,3 +24,8 @@ __exportStar(require("./UaHistoryReadValueId"), exports);
|
|
|
24
24
|
__exportStar(require("./UaHistoryReadResult"), exports);
|
|
25
25
|
__exportStar(require("./UaCallMethodRequest"), exports);
|
|
26
26
|
__exportStar(require("./UaCallMethodResult"), exports);
|
|
27
|
+
__exportStar(require("./UaAddNodesItem"), exports);
|
|
28
|
+
__exportStar(require("./UaAddNodesResult"), exports);
|
|
29
|
+
__exportStar(require("./UaAddReferencesItem"), exports);
|
|
30
|
+
__exportStar(require("./UaDeleteNodesItem"), exports);
|
|
31
|
+
__exportStar(require("./UaDeleteReferencesItem"), exports);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaObjectAttributes = void 0;
|
|
4
|
+
const opcua_webapi_1 = require("opcua-webapi");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const nodes_1 = require("../nodes");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
class UaObjectAttributes {
|
|
9
|
+
constructor(displayName, eventNotifier, description, writeMask, userWriteMask) {
|
|
10
|
+
this._displayName = displayName;
|
|
11
|
+
this._eventNotifier = (undefined != eventNotifier) ? eventNotifier : null;
|
|
12
|
+
this._description = (undefined != description) ? description : null;
|
|
13
|
+
this._writeMask = (undefined != writeMask) ? writeMask : null;
|
|
14
|
+
this._userWriteMask = (undefined != userWriteMask) ? userWriteMask : null;
|
|
15
|
+
}
|
|
16
|
+
get displayName() {
|
|
17
|
+
return this._displayName;
|
|
18
|
+
}
|
|
19
|
+
get eventNotifier() {
|
|
20
|
+
return this._eventNotifier;
|
|
21
|
+
}
|
|
22
|
+
get description() {
|
|
23
|
+
return this._description;
|
|
24
|
+
}
|
|
25
|
+
get writeMask() {
|
|
26
|
+
return this._writeMask;
|
|
27
|
+
}
|
|
28
|
+
get userWriteMask() {
|
|
29
|
+
return this._userWriteMask;
|
|
30
|
+
}
|
|
31
|
+
toStruct() {
|
|
32
|
+
let struct = {
|
|
33
|
+
DisplayName: __1.UaPayloadMapper.localizedTextToWebApi(this._displayName),
|
|
34
|
+
EventNotifier: (null != this._eventNotifier) ? this._eventNotifier : undefined,
|
|
35
|
+
Description: (this._description) ? __1.UaPayloadMapper.localizedTextToWebApi(this._description) : undefined,
|
|
36
|
+
WriteMask: (null != this._writeMask) ? this._writeMask : undefined,
|
|
37
|
+
UserWriteMask: (null != this._userWriteMask) ? this._userWriteMask : undefined
|
|
38
|
+
};
|
|
39
|
+
return struct;
|
|
40
|
+
}
|
|
41
|
+
static fromStruct(struct) {
|
|
42
|
+
if (struct.DisplayName === undefined)
|
|
43
|
+
return null;
|
|
44
|
+
let displayName = __1.UaPayloadMapper.localizedTextFromWebApi(struct.DisplayName);
|
|
45
|
+
let eventNotifier = (undefined != struct.EventNotifier) ? struct.EventNotifier : null;
|
|
46
|
+
let description = (undefined != struct.Description) ? __1.UaPayloadMapper.localizedTextFromWebApi(struct.Description) : null;
|
|
47
|
+
let writeMask = (undefined != struct.WriteMask) ? struct.WriteMask : null;
|
|
48
|
+
let userWriteMask = (undefined != struct.UserWriteMask) ? struct.UserWriteMask : null;
|
|
49
|
+
return new UaObjectAttributes(displayName, eventNotifier, description, writeMask, userWriteMask);
|
|
50
|
+
}
|
|
51
|
+
toExtensionObject() {
|
|
52
|
+
return new types_1.UaExtensionObject(UaObjectAttributes.dataTypeId, (0, opcua_webapi_1.ObjectAttributesToJSONTyped)(this.toStruct()));
|
|
53
|
+
}
|
|
54
|
+
static fromExtensionObject(extensionObject) {
|
|
55
|
+
if (!UaObjectAttributes.dataTypeId.equal(extensionObject.typeId))
|
|
56
|
+
return null;
|
|
57
|
+
let struct = (0, opcua_webapi_1.ObjectAttributesFromJSON)(extensionObject.body);
|
|
58
|
+
return UaObjectAttributes.fromStruct(struct);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.UaObjectAttributes = UaObjectAttributes;
|
|
62
|
+
UaObjectAttributes.dataTypeId = new types_1.UaNodeId(nodes_1.DataTypeIds.ObjectAttributes);
|
|
@@ -30,3 +30,4 @@ __exportStar(require("./UaReadRawModifiedDetails"), exports);
|
|
|
30
30
|
__exportStar(require("./UaReadProcessedDetails"), exports);
|
|
31
31
|
__exportStar(require("./UaReadEventDetails"), exports);
|
|
32
32
|
__exportStar(require("./UaSimpleAttributeOperand"), exports);
|
|
33
|
+
__exportStar(require("./UaObjectAttributes"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ViewDescription, RequestHeader, ApplicationDescription, BrowseDirection, EndpointDescription } from "opcua-webapi";
|
|
2
|
-
import { UaBrowseResult,
|
|
2
|
+
import { UaBrowseResult, OpcUaNodeAttributes, OpcUaVariableAttributes, UaNodeId, UaDataValue, UaVariant, UaStatusCode, UaExtensionObject, UaHistoryDataResult, UaQuery, UaMethodArguments, UaApplicationDescriptor, UaBrowseDescription, UaReadValueId, UaWriteValue, UaHistoryReadValueId, UaHistoryReadResult, UaLocalizedText, UaAddNodesItem, UaAddNodesResult, OpcUaObjectAttributes, UaDeleteNodesItem, UaAddReferencesItem, UaDeleteReferencesItem } from "../common";
|
|
3
3
|
import { UaClientConfiguration, UaClientParameters, UaWebClientApi } from "..";
|
|
4
4
|
import { UaHistoryEventResult, UaCallMethodRequest, UaCallMethodResult } from "../common";
|
|
5
5
|
export declare class UaWebClient {
|
|
@@ -14,16 +14,18 @@ export declare class UaWebClient {
|
|
|
14
14
|
browseNextByCP(continuationPoint: string): Promise<UaBrowseResult>;
|
|
15
15
|
readValues(nodeIds: Array<UaNodeId>, timestampsToReturn?: number): Promise<Array<UaDataValue>>;
|
|
16
16
|
writeValue(nodeId: UaNodeId, value: UaVariant): Promise<void>;
|
|
17
|
-
readNodeAttributes(nodeId: UaNodeId, returnDescription?: boolean): Promise<
|
|
18
|
-
readVariableAttributes(nodeIds: Array<UaNodeId>): Promise<Array<
|
|
17
|
+
readNodeAttributes(nodeId: UaNodeId, returnDescription?: boolean): Promise<OpcUaNodeAttributes>;
|
|
18
|
+
readVariableAttributes(nodeIds: Array<UaNodeId>): Promise<Array<OpcUaVariableAttributes>>;
|
|
19
19
|
readMethodArguments(nodeId: UaNodeId): Promise<UaMethodArguments>;
|
|
20
|
-
readObjectAttributes(nodeId: UaNodeId): Promise<
|
|
20
|
+
readObjectAttributes(nodeId: UaNodeId): Promise<OpcUaObjectAttributes>;
|
|
21
21
|
methodCall(objectId: UaNodeId, methodId: UaNodeId, inputArguments: Array<UaVariant>): Promise<Array<UaVariant>>;
|
|
22
22
|
getGeneratedEventType(typeId: UaNodeId): Promise<Array<UaNodeId>>;
|
|
23
23
|
historyReadRawData(nodeId: UaNodeId, startTime: Date, endTime: Date, numValuesPerNode?: number | null, continuationPoint?: string | null, returnBounds?: boolean | null, isReadModified?: boolean | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
|
|
24
24
|
historyReadAtTime(nodeId: UaNodeId, requiredTimes: Array<Date>, useSimpleBounds?: boolean | null, continuationPoint?: string | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
|
|
25
25
|
historyReadProcessed(nodeId: UaNodeId, startTime: Date, endTime: Date, processingInterval: number, aggregateType?: UaNodeId | null, continuationPoint?: string | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
|
|
26
26
|
historyReadEvent(nodeId: UaNodeId, startTime: Date, endTime: Date, select: Array<string>, where?: UaQuery | null, numValuesPerNode?: number | null, continuationPoint?: string | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryEventResult>;
|
|
27
|
+
addObject(parentNodeId: UaNodeId, typeDefinitionNodeId: UaNodeId, displayName: UaLocalizedText, browseName?: string, referenceTypeId?: UaNodeId): Promise<UaNodeId>;
|
|
28
|
+
deleteNode(nodeId: UaNodeId): Promise<void>;
|
|
27
29
|
browse(nodesToBrowse: Array<UaBrowseDescription>, maxReferencesPerNode?: number, view?: ViewDescription, additionalParameters?: UaClientParameters): Promise<Array<UaBrowseResult>>;
|
|
28
30
|
browseNext(continuationPoints: Array<string>, releaseContinuationPoints: boolean, additionalParameters?: UaClientParameters): Promise<Array<UaBrowseResult>>;
|
|
29
31
|
read(nodesToRead: Array<UaReadValueId>, timestampsToReturn?: number, maxAge?: number, additionalParameters?: UaClientParameters): Promise<Array<UaDataValue>>;
|
|
@@ -32,6 +34,10 @@ export declare class UaWebClient {
|
|
|
32
34
|
historyRead(nodesToRead: Array<UaHistoryReadValueId>, historyReadDetails: UaExtensionObject, timestampsToReturn?: number, releaseContinuationPoints?: boolean, additionalParameters?: UaClientParameters): Promise<Array<UaHistoryReadResult>>;
|
|
33
35
|
findServer(endpointUrl: string, serverUris: Array<string>, localeIds?: Array<string>, additionalParameters?: UaClientParameters): Promise<Array<ApplicationDescription>>;
|
|
34
36
|
getEndpoints(endpointUrl?: string, localeIds?: Array<string>, profileUris?: Array<string>, additionalParameters?: UaClientParameters): Promise<Array<EndpointDescription>>;
|
|
37
|
+
addNodes(nodesToAdd: Array<UaAddNodesItem>, additionalParameters?: UaClientParameters): Promise<Array<UaAddNodesResult>>;
|
|
38
|
+
deleteNodes(nodesToDelete: Array<UaDeleteNodesItem>, additionalParameters?: UaClientParameters): Promise<Array<UaStatusCode>>;
|
|
39
|
+
addReferences(referencesToAdd: Array<UaAddReferencesItem>, additionalParameters?: UaClientParameters): Promise<Array<UaStatusCode>>;
|
|
40
|
+
deleteReferences(referencesToDelete: Array<UaDeleteReferencesItem>, additionalParameters?: UaClientParameters): Promise<Array<UaStatusCode>>;
|
|
35
41
|
protected requestHeader(additionalParameters?: UaClientParameters): RequestHeader;
|
|
36
42
|
protected requestTimeout(additionalParameters?: UaClientParameters): number;
|
|
37
43
|
protected createApi(): UaWebClientApi;
|