opcua-webapi-ts 1.1.20 → 1.1.22
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 +77 -80
- package/dist/cjs/client/utils/UaNodeReader.js +3 -2
- package/dist/client/UaWebClient.d.ts +3 -4
- package/dist/client/UaWebClient.js +77 -80
- package/dist/client/utils/UaNodeReader.d.ts +5 -4
- package/dist/client/utils/UaNodeReader.js +3 -2
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ const common_2 = require("../common");
|
|
|
17
17
|
class UaWebClient {
|
|
18
18
|
constructor(clientConfig) {
|
|
19
19
|
this.clientConfig = clientConfig;
|
|
20
|
-
this.api = this.
|
|
20
|
+
this.api = new __1.UaWebClientNative(this.clientConfig.apiConfig);
|
|
21
21
|
this.requestHandle = 1;
|
|
22
22
|
}
|
|
23
23
|
getUrl() {
|
|
@@ -689,14 +689,18 @@ class UaWebClient {
|
|
|
689
689
|
return results;
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
|
-
|
|
692
|
+
addNodes(nodesToAdd, additionalParameters) {
|
|
693
693
|
return __awaiter(this, void 0, void 0, function* () {
|
|
694
694
|
var _a, _b;
|
|
695
|
-
|
|
695
|
+
if (nodesToAdd.length == 0)
|
|
696
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
697
|
+
let NodesToAdd = [];
|
|
698
|
+
for (let item of nodesToAdd) {
|
|
699
|
+
NodesToAdd.push(item.toStruct());
|
|
700
|
+
}
|
|
701
|
+
let request = (0, opcua_webapi_1.AddNodesRequestFromJSON)({
|
|
696
702
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
697
|
-
|
|
698
|
-
EndpointUrl: endpointUrl,
|
|
699
|
-
LocaleIds: localeIds
|
|
703
|
+
NodesToAdd: NodesToAdd
|
|
700
704
|
});
|
|
701
705
|
let timeout = this.requestTimeout(additionalParameters);
|
|
702
706
|
let response;
|
|
@@ -704,9 +708,10 @@ class UaWebClient {
|
|
|
704
708
|
let controller = new AbortController();
|
|
705
709
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
706
710
|
try {
|
|
707
|
-
response = yield this.api.
|
|
711
|
+
response = yield this.api.addNodes(request, { signal: controller.signal });
|
|
708
712
|
}
|
|
709
713
|
catch (error) {
|
|
714
|
+
console.error(error);
|
|
710
715
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
711
716
|
}
|
|
712
717
|
finally {
|
|
@@ -715,7 +720,7 @@ class UaWebClient {
|
|
|
715
720
|
}
|
|
716
721
|
else {
|
|
717
722
|
try {
|
|
718
|
-
response = yield this.api.
|
|
723
|
+
response = yield this.api.addNodes(request);
|
|
719
724
|
}
|
|
720
725
|
catch (error) {
|
|
721
726
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -723,19 +728,30 @@ class UaWebClient {
|
|
|
723
728
|
}
|
|
724
729
|
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)
|
|
725
730
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
726
|
-
if (!response.
|
|
731
|
+
if (!response.Results)
|
|
727
732
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
728
|
-
|
|
733
|
+
let results = [];
|
|
734
|
+
for (let item of response.Results) {
|
|
735
|
+
let result = common_1.UaAddNodesResult.fromStruct(item);
|
|
736
|
+
if (null == result)
|
|
737
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
738
|
+
results.push(result);
|
|
739
|
+
}
|
|
740
|
+
return results;
|
|
729
741
|
});
|
|
730
742
|
}
|
|
731
|
-
|
|
743
|
+
deleteNodes(nodesToDelete, additionalParameters) {
|
|
732
744
|
return __awaiter(this, void 0, void 0, function* () {
|
|
733
745
|
var _a, _b;
|
|
734
|
-
|
|
746
|
+
if (nodesToDelete.length == 0)
|
|
747
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
748
|
+
let NodesToDelete = [];
|
|
749
|
+
for (let item of nodesToDelete) {
|
|
750
|
+
NodesToDelete.push(item.toStruct());
|
|
751
|
+
}
|
|
752
|
+
let request = (0, opcua_webapi_1.DeleteNodesRequestFromJSON)({
|
|
735
753
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
736
|
-
|
|
737
|
-
LocaleIds: localeIds,
|
|
738
|
-
ProfileUris: profileUris
|
|
754
|
+
NodesToDelete: NodesToDelete
|
|
739
755
|
});
|
|
740
756
|
let timeout = this.requestTimeout(additionalParameters);
|
|
741
757
|
let response;
|
|
@@ -743,7 +759,7 @@ class UaWebClient {
|
|
|
743
759
|
let controller = new AbortController();
|
|
744
760
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
745
761
|
try {
|
|
746
|
-
response = yield this.api.
|
|
762
|
+
response = yield this.api.deleteNodes(request, { signal: controller.signal });
|
|
747
763
|
}
|
|
748
764
|
catch (error) {
|
|
749
765
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -754,7 +770,7 @@ class UaWebClient {
|
|
|
754
770
|
}
|
|
755
771
|
else {
|
|
756
772
|
try {
|
|
757
|
-
response = yield this.api.
|
|
773
|
+
response = yield this.api.deleteNodes(request);
|
|
758
774
|
}
|
|
759
775
|
catch (error) {
|
|
760
776
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -762,23 +778,28 @@ class UaWebClient {
|
|
|
762
778
|
}
|
|
763
779
|
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)
|
|
764
780
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
765
|
-
if (!response.
|
|
781
|
+
if (!response.Results)
|
|
766
782
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
767
|
-
|
|
783
|
+
let results = [];
|
|
784
|
+
for (let item of response.Results) {
|
|
785
|
+
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
786
|
+
results.push(result);
|
|
787
|
+
}
|
|
788
|
+
return results;
|
|
768
789
|
});
|
|
769
790
|
}
|
|
770
|
-
|
|
791
|
+
addReferences(referencesToAdd, additionalParameters) {
|
|
771
792
|
return __awaiter(this, void 0, void 0, function* () {
|
|
772
793
|
var _a, _b;
|
|
773
|
-
if (
|
|
794
|
+
if (referencesToAdd.length == 0)
|
|
774
795
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
775
|
-
let
|
|
776
|
-
for (let item of
|
|
777
|
-
|
|
796
|
+
let ReferencesToAdd = [];
|
|
797
|
+
for (let item of referencesToAdd) {
|
|
798
|
+
ReferencesToAdd.push(item.toStruct());
|
|
778
799
|
}
|
|
779
|
-
let request = (0, opcua_webapi_1.
|
|
800
|
+
let request = (0, opcua_webapi_1.AddReferencesRequestFromJSON)({
|
|
780
801
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
781
|
-
|
|
802
|
+
ReferencesToAdd: ReferencesToAdd
|
|
782
803
|
});
|
|
783
804
|
let timeout = this.requestTimeout(additionalParameters);
|
|
784
805
|
let response;
|
|
@@ -786,10 +807,9 @@ class UaWebClient {
|
|
|
786
807
|
let controller = new AbortController();
|
|
787
808
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
788
809
|
try {
|
|
789
|
-
response = yield this.api.
|
|
810
|
+
response = yield this.api.addReferences(request, { signal: controller.signal });
|
|
790
811
|
}
|
|
791
812
|
catch (error) {
|
|
792
|
-
console.error(error);
|
|
793
813
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
794
814
|
}
|
|
795
815
|
finally {
|
|
@@ -798,7 +818,7 @@ class UaWebClient {
|
|
|
798
818
|
}
|
|
799
819
|
else {
|
|
800
820
|
try {
|
|
801
|
-
response = yield this.api.
|
|
821
|
+
response = yield this.api.addReferences(request);
|
|
802
822
|
}
|
|
803
823
|
catch (error) {
|
|
804
824
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -810,26 +830,24 @@ class UaWebClient {
|
|
|
810
830
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
811
831
|
let results = [];
|
|
812
832
|
for (let item of response.Results) {
|
|
813
|
-
let result = common_1.
|
|
814
|
-
if (null == result)
|
|
815
|
-
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
833
|
+
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
816
834
|
results.push(result);
|
|
817
835
|
}
|
|
818
836
|
return results;
|
|
819
837
|
});
|
|
820
838
|
}
|
|
821
|
-
|
|
839
|
+
deleteReferences(referencesToDelete, additionalParameters) {
|
|
822
840
|
return __awaiter(this, void 0, void 0, function* () {
|
|
823
841
|
var _a, _b;
|
|
824
|
-
if (
|
|
842
|
+
if (referencesToDelete.length == 0)
|
|
825
843
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
826
|
-
let
|
|
827
|
-
for (let item of
|
|
828
|
-
|
|
844
|
+
let ReferencesToDelete = [];
|
|
845
|
+
for (let item of referencesToDelete) {
|
|
846
|
+
ReferencesToDelete.push(item.toStruct());
|
|
829
847
|
}
|
|
830
|
-
let request = (0, opcua_webapi_1.
|
|
848
|
+
let request = (0, opcua_webapi_1.DeleteReferencesRequestFromJSON)({
|
|
831
849
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
832
|
-
|
|
850
|
+
ReferencesToDelete: ReferencesToDelete
|
|
833
851
|
});
|
|
834
852
|
let timeout = this.requestTimeout(additionalParameters);
|
|
835
853
|
let response;
|
|
@@ -837,7 +855,7 @@ class UaWebClient {
|
|
|
837
855
|
let controller = new AbortController();
|
|
838
856
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
839
857
|
try {
|
|
840
|
-
response = yield this.api.
|
|
858
|
+
response = yield this.api.deleteReferences(request, { signal: controller.signal });
|
|
841
859
|
}
|
|
842
860
|
catch (error) {
|
|
843
861
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -848,7 +866,7 @@ class UaWebClient {
|
|
|
848
866
|
}
|
|
849
867
|
else {
|
|
850
868
|
try {
|
|
851
|
-
response = yield this.api.
|
|
869
|
+
response = yield this.api.deleteReferences(request);
|
|
852
870
|
}
|
|
853
871
|
catch (error) {
|
|
854
872
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -866,18 +884,14 @@ class UaWebClient {
|
|
|
866
884
|
return results;
|
|
867
885
|
});
|
|
868
886
|
}
|
|
869
|
-
|
|
887
|
+
findServer(endpointUrl, serverUris, localeIds, additionalParameters) {
|
|
870
888
|
return __awaiter(this, void 0, void 0, function* () {
|
|
871
889
|
var _a, _b;
|
|
872
|
-
|
|
873
|
-
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
874
|
-
let ReferencesToAdd = [];
|
|
875
|
-
for (let item of referencesToAdd) {
|
|
876
|
-
ReferencesToAdd.push(item.toStruct());
|
|
877
|
-
}
|
|
878
|
-
let request = (0, opcua_webapi_1.AddReferencesRequestFromJSON)({
|
|
890
|
+
let request = (0, opcua_webapi_1.FindServersRequestFromJSON)({
|
|
879
891
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
880
|
-
|
|
892
|
+
ServerUris: serverUris,
|
|
893
|
+
EndpointUrl: endpointUrl,
|
|
894
|
+
LocaleIds: localeIds
|
|
881
895
|
});
|
|
882
896
|
let timeout = this.requestTimeout(additionalParameters);
|
|
883
897
|
let response;
|
|
@@ -885,7 +899,7 @@ class UaWebClient {
|
|
|
885
899
|
let controller = new AbortController();
|
|
886
900
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
887
901
|
try {
|
|
888
|
-
response = yield this.api.
|
|
902
|
+
response = yield this.api.findServers(request, { signal: controller.signal });
|
|
889
903
|
}
|
|
890
904
|
catch (error) {
|
|
891
905
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -896,7 +910,7 @@ class UaWebClient {
|
|
|
896
910
|
}
|
|
897
911
|
else {
|
|
898
912
|
try {
|
|
899
|
-
response = yield this.api.
|
|
913
|
+
response = yield this.api.findServers(request);
|
|
900
914
|
}
|
|
901
915
|
catch (error) {
|
|
902
916
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -904,28 +918,19 @@ class UaWebClient {
|
|
|
904
918
|
}
|
|
905
919
|
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)
|
|
906
920
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
907
|
-
if (!response.
|
|
921
|
+
if (!response.Servers)
|
|
908
922
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
909
|
-
|
|
910
|
-
for (let item of response.Results) {
|
|
911
|
-
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
912
|
-
results.push(result);
|
|
913
|
-
}
|
|
914
|
-
return results;
|
|
923
|
+
return response.Servers;
|
|
915
924
|
});
|
|
916
925
|
}
|
|
917
|
-
|
|
926
|
+
getEndpoints(endpointUrl, localeIds, profileUris, additionalParameters) {
|
|
918
927
|
return __awaiter(this, void 0, void 0, function* () {
|
|
919
928
|
var _a, _b;
|
|
920
|
-
|
|
921
|
-
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
922
|
-
let ReferencesToDelete = [];
|
|
923
|
-
for (let item of referencesToDelete) {
|
|
924
|
-
ReferencesToDelete.push(item.toStruct());
|
|
925
|
-
}
|
|
926
|
-
let request = (0, opcua_webapi_1.DeleteReferencesRequestFromJSON)({
|
|
929
|
+
let request = (0, opcua_webapi_1.GetEndpointsRequestFromJSON)({
|
|
927
930
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
928
|
-
|
|
931
|
+
EndpointUrl: endpointUrl,
|
|
932
|
+
LocaleIds: localeIds,
|
|
933
|
+
ProfileUris: profileUris
|
|
929
934
|
});
|
|
930
935
|
let timeout = this.requestTimeout(additionalParameters);
|
|
931
936
|
let response;
|
|
@@ -933,7 +938,7 @@ class UaWebClient {
|
|
|
933
938
|
let controller = new AbortController();
|
|
934
939
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
935
940
|
try {
|
|
936
|
-
response = yield this.api.
|
|
941
|
+
response = yield this.api.getEndpoints(request, { signal: controller.signal });
|
|
937
942
|
}
|
|
938
943
|
catch (error) {
|
|
939
944
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -944,7 +949,7 @@ class UaWebClient {
|
|
|
944
949
|
}
|
|
945
950
|
else {
|
|
946
951
|
try {
|
|
947
|
-
response = yield this.api.
|
|
952
|
+
response = yield this.api.getEndpoints(request);
|
|
948
953
|
}
|
|
949
954
|
catch (error) {
|
|
950
955
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -952,14 +957,9 @@ class UaWebClient {
|
|
|
952
957
|
}
|
|
953
958
|
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)
|
|
954
959
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
955
|
-
if (!response.
|
|
960
|
+
if (!response.Endpoints)
|
|
956
961
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
957
|
-
|
|
958
|
-
for (let item of response.Results) {
|
|
959
|
-
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
960
|
-
results.push(result);
|
|
961
|
-
}
|
|
962
|
-
return results;
|
|
962
|
+
return response.Endpoints;
|
|
963
963
|
});
|
|
964
964
|
}
|
|
965
965
|
requestHeader(additionalParameters) {
|
|
@@ -982,8 +982,5 @@ class UaWebClient {
|
|
|
982
982
|
timeout = additionalParameters.timeout;
|
|
983
983
|
return timeout;
|
|
984
984
|
}
|
|
985
|
-
createApi() {
|
|
986
|
-
return new __1.UaWebClientNative(this.clientConfig.apiConfig);
|
|
987
|
-
}
|
|
988
985
|
}
|
|
989
986
|
exports.UaWebClient = UaWebClient;
|
|
@@ -14,11 +14,12 @@ const opcua_webapi_1 = require("opcua-webapi");
|
|
|
14
14
|
const common_1 = require("../../common");
|
|
15
15
|
const UaNodeBrowser_1 = require("./UaNodeBrowser");
|
|
16
16
|
class UaNodeReader {
|
|
17
|
-
constructor(client, returnDescription, returnVariable, returnMethod, returnAttributes, returnValue) {
|
|
17
|
+
constructor(client, returnDescription, returnVariable, returnMethod, returnAttributes, returnValue, referenceTypeToReturn) {
|
|
18
18
|
this._client = client;
|
|
19
19
|
this._returnDescription = (returnDescription) ? returnDescription : false;
|
|
20
20
|
this._returnAttributes = (returnAttributes) ? returnAttributes : false;
|
|
21
21
|
this._returnValue = (returnValue) ? returnValue : false;
|
|
22
|
+
this._referenceTypeToReturn = (referenceTypeToReturn) ? referenceTypeToReturn : common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences);
|
|
22
23
|
this._nodeClassToReturn = 0;
|
|
23
24
|
if (returnVariable)
|
|
24
25
|
this._nodeClassToReturn += opcua_webapi_1.NodeClass.Variable;
|
|
@@ -68,7 +69,7 @@ class UaNodeReader {
|
|
|
68
69
|
nodeIdsToBrowse.push(item.nodeId);
|
|
69
70
|
nodeIdsSet.add(item.nodeId.toString());
|
|
70
71
|
}
|
|
71
|
-
let nodeReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, nodeIdsToBrowse,
|
|
72
|
+
let nodeReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, nodeIdsToBrowse, this._referenceTypeToReturn, this._nodeClassToReturn, false);
|
|
72
73
|
yield nodeReferenceBrowser.browse();
|
|
73
74
|
let childReferences = nodeReferenceBrowser.results();
|
|
74
75
|
let childNodesToBrowse = [];
|
|
@@ -13,7 +13,7 @@ export type UaMethodArguments = {
|
|
|
13
13
|
outputArguments: Array<UaArgument>;
|
|
14
14
|
};
|
|
15
15
|
export declare class UaWebClient {
|
|
16
|
-
|
|
16
|
+
protected api: UaWebClientApi;
|
|
17
17
|
private clientConfig;
|
|
18
18
|
private requestHandle;
|
|
19
19
|
constructor(clientConfig: UaClientConfiguration);
|
|
@@ -41,13 +41,12 @@ export declare class UaWebClient {
|
|
|
41
41
|
write(nodesToWrite: Array<UaWriteValue>, additionalParameters?: UaClientParameters): Promise<Array<UaStatusCode>>;
|
|
42
42
|
call(methodsToCall: Array<UaCallMethodRequest>, additionalParameters?: UaClientParameters): Promise<Array<UaCallMethodResult>>;
|
|
43
43
|
historyRead(nodesToRead: Array<UaHistoryReadValueId>, historyReadDetails: UaExtensionObject, timestampsToReturn?: number, releaseContinuationPoints?: boolean, additionalParameters?: UaClientParameters): Promise<Array<UaHistoryReadResult>>;
|
|
44
|
-
findServer(endpointUrl: string, serverUris: Array<string>, localeIds?: Array<string>, additionalParameters?: UaClientParameters): Promise<Array<ApplicationDescription>>;
|
|
45
|
-
getEndpoints(endpointUrl?: string, localeIds?: Array<string>, profileUris?: Array<string>, additionalParameters?: UaClientParameters): Promise<Array<EndpointDescription>>;
|
|
46
44
|
addNodes(nodesToAdd: Array<UaAddNodesItem>, additionalParameters?: UaClientParameters): Promise<Array<UaAddNodesResult>>;
|
|
47
45
|
deleteNodes(nodesToDelete: Array<UaDeleteNodesItem>, additionalParameters?: UaClientParameters): Promise<Array<UaStatusCode>>;
|
|
48
46
|
addReferences(referencesToAdd: Array<UaAddReferencesItem>, additionalParameters?: UaClientParameters): Promise<Array<UaStatusCode>>;
|
|
49
47
|
deleteReferences(referencesToDelete: Array<UaDeleteReferencesItem>, additionalParameters?: UaClientParameters): Promise<Array<UaStatusCode>>;
|
|
48
|
+
findServer(endpointUrl: string, serverUris: Array<string>, localeIds?: Array<string>, additionalParameters?: UaClientParameters): Promise<Array<ApplicationDescription>>;
|
|
49
|
+
getEndpoints(endpointUrl?: string, localeIds?: Array<string>, profileUris?: Array<string>, additionalParameters?: UaClientParameters): Promise<Array<EndpointDescription>>;
|
|
50
50
|
protected requestHeader(additionalParameters?: UaClientParameters): RequestHeader;
|
|
51
51
|
protected requestTimeout(additionalParameters?: UaClientParameters): number;
|
|
52
|
-
protected createApi(): UaWebClientApi;
|
|
53
52
|
}
|
|
@@ -17,7 +17,7 @@ const common_2 = require("../common");
|
|
|
17
17
|
class UaWebClient {
|
|
18
18
|
constructor(clientConfig) {
|
|
19
19
|
this.clientConfig = clientConfig;
|
|
20
|
-
this.api = this.
|
|
20
|
+
this.api = new __1.UaWebClientNative(this.clientConfig.apiConfig);
|
|
21
21
|
this.requestHandle = 1;
|
|
22
22
|
}
|
|
23
23
|
getUrl() {
|
|
@@ -689,14 +689,18 @@ class UaWebClient {
|
|
|
689
689
|
return results;
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
|
-
|
|
692
|
+
addNodes(nodesToAdd, additionalParameters) {
|
|
693
693
|
return __awaiter(this, void 0, void 0, function* () {
|
|
694
694
|
var _a, _b;
|
|
695
|
-
|
|
695
|
+
if (nodesToAdd.length == 0)
|
|
696
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
697
|
+
let NodesToAdd = [];
|
|
698
|
+
for (let item of nodesToAdd) {
|
|
699
|
+
NodesToAdd.push(item.toStruct());
|
|
700
|
+
}
|
|
701
|
+
let request = (0, opcua_webapi_1.AddNodesRequestFromJSON)({
|
|
696
702
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
697
|
-
|
|
698
|
-
EndpointUrl: endpointUrl,
|
|
699
|
-
LocaleIds: localeIds
|
|
703
|
+
NodesToAdd: NodesToAdd
|
|
700
704
|
});
|
|
701
705
|
let timeout = this.requestTimeout(additionalParameters);
|
|
702
706
|
let response;
|
|
@@ -704,9 +708,10 @@ class UaWebClient {
|
|
|
704
708
|
let controller = new AbortController();
|
|
705
709
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
706
710
|
try {
|
|
707
|
-
response = yield this.api.
|
|
711
|
+
response = yield this.api.addNodes(request, { signal: controller.signal });
|
|
708
712
|
}
|
|
709
713
|
catch (error) {
|
|
714
|
+
console.error(error);
|
|
710
715
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
711
716
|
}
|
|
712
717
|
finally {
|
|
@@ -715,7 +720,7 @@ class UaWebClient {
|
|
|
715
720
|
}
|
|
716
721
|
else {
|
|
717
722
|
try {
|
|
718
|
-
response = yield this.api.
|
|
723
|
+
response = yield this.api.addNodes(request);
|
|
719
724
|
}
|
|
720
725
|
catch (error) {
|
|
721
726
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -723,19 +728,30 @@ class UaWebClient {
|
|
|
723
728
|
}
|
|
724
729
|
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)
|
|
725
730
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
726
|
-
if (!response.
|
|
731
|
+
if (!response.Results)
|
|
727
732
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
728
|
-
|
|
733
|
+
let results = [];
|
|
734
|
+
for (let item of response.Results) {
|
|
735
|
+
let result = common_1.UaAddNodesResult.fromStruct(item);
|
|
736
|
+
if (null == result)
|
|
737
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
738
|
+
results.push(result);
|
|
739
|
+
}
|
|
740
|
+
return results;
|
|
729
741
|
});
|
|
730
742
|
}
|
|
731
|
-
|
|
743
|
+
deleteNodes(nodesToDelete, additionalParameters) {
|
|
732
744
|
return __awaiter(this, void 0, void 0, function* () {
|
|
733
745
|
var _a, _b;
|
|
734
|
-
|
|
746
|
+
if (nodesToDelete.length == 0)
|
|
747
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
748
|
+
let NodesToDelete = [];
|
|
749
|
+
for (let item of nodesToDelete) {
|
|
750
|
+
NodesToDelete.push(item.toStruct());
|
|
751
|
+
}
|
|
752
|
+
let request = (0, opcua_webapi_1.DeleteNodesRequestFromJSON)({
|
|
735
753
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
736
|
-
|
|
737
|
-
LocaleIds: localeIds,
|
|
738
|
-
ProfileUris: profileUris
|
|
754
|
+
NodesToDelete: NodesToDelete
|
|
739
755
|
});
|
|
740
756
|
let timeout = this.requestTimeout(additionalParameters);
|
|
741
757
|
let response;
|
|
@@ -743,7 +759,7 @@ class UaWebClient {
|
|
|
743
759
|
let controller = new AbortController();
|
|
744
760
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
745
761
|
try {
|
|
746
|
-
response = yield this.api.
|
|
762
|
+
response = yield this.api.deleteNodes(request, { signal: controller.signal });
|
|
747
763
|
}
|
|
748
764
|
catch (error) {
|
|
749
765
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -754,7 +770,7 @@ class UaWebClient {
|
|
|
754
770
|
}
|
|
755
771
|
else {
|
|
756
772
|
try {
|
|
757
|
-
response = yield this.api.
|
|
773
|
+
response = yield this.api.deleteNodes(request);
|
|
758
774
|
}
|
|
759
775
|
catch (error) {
|
|
760
776
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -762,23 +778,28 @@ class UaWebClient {
|
|
|
762
778
|
}
|
|
763
779
|
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)
|
|
764
780
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
765
|
-
if (!response.
|
|
781
|
+
if (!response.Results)
|
|
766
782
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
767
|
-
|
|
783
|
+
let results = [];
|
|
784
|
+
for (let item of response.Results) {
|
|
785
|
+
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
786
|
+
results.push(result);
|
|
787
|
+
}
|
|
788
|
+
return results;
|
|
768
789
|
});
|
|
769
790
|
}
|
|
770
|
-
|
|
791
|
+
addReferences(referencesToAdd, additionalParameters) {
|
|
771
792
|
return __awaiter(this, void 0, void 0, function* () {
|
|
772
793
|
var _a, _b;
|
|
773
|
-
if (
|
|
794
|
+
if (referencesToAdd.length == 0)
|
|
774
795
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
775
|
-
let
|
|
776
|
-
for (let item of
|
|
777
|
-
|
|
796
|
+
let ReferencesToAdd = [];
|
|
797
|
+
for (let item of referencesToAdd) {
|
|
798
|
+
ReferencesToAdd.push(item.toStruct());
|
|
778
799
|
}
|
|
779
|
-
let request = (0, opcua_webapi_1.
|
|
800
|
+
let request = (0, opcua_webapi_1.AddReferencesRequestFromJSON)({
|
|
780
801
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
781
|
-
|
|
802
|
+
ReferencesToAdd: ReferencesToAdd
|
|
782
803
|
});
|
|
783
804
|
let timeout = this.requestTimeout(additionalParameters);
|
|
784
805
|
let response;
|
|
@@ -786,10 +807,9 @@ class UaWebClient {
|
|
|
786
807
|
let controller = new AbortController();
|
|
787
808
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
788
809
|
try {
|
|
789
|
-
response = yield this.api.
|
|
810
|
+
response = yield this.api.addReferences(request, { signal: controller.signal });
|
|
790
811
|
}
|
|
791
812
|
catch (error) {
|
|
792
|
-
console.error(error);
|
|
793
813
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
794
814
|
}
|
|
795
815
|
finally {
|
|
@@ -798,7 +818,7 @@ class UaWebClient {
|
|
|
798
818
|
}
|
|
799
819
|
else {
|
|
800
820
|
try {
|
|
801
|
-
response = yield this.api.
|
|
821
|
+
response = yield this.api.addReferences(request);
|
|
802
822
|
}
|
|
803
823
|
catch (error) {
|
|
804
824
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -810,26 +830,24 @@ class UaWebClient {
|
|
|
810
830
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
811
831
|
let results = [];
|
|
812
832
|
for (let item of response.Results) {
|
|
813
|
-
let result = common_1.
|
|
814
|
-
if (null == result)
|
|
815
|
-
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
833
|
+
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
816
834
|
results.push(result);
|
|
817
835
|
}
|
|
818
836
|
return results;
|
|
819
837
|
});
|
|
820
838
|
}
|
|
821
|
-
|
|
839
|
+
deleteReferences(referencesToDelete, additionalParameters) {
|
|
822
840
|
return __awaiter(this, void 0, void 0, function* () {
|
|
823
841
|
var _a, _b;
|
|
824
|
-
if (
|
|
842
|
+
if (referencesToDelete.length == 0)
|
|
825
843
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
826
|
-
let
|
|
827
|
-
for (let item of
|
|
828
|
-
|
|
844
|
+
let ReferencesToDelete = [];
|
|
845
|
+
for (let item of referencesToDelete) {
|
|
846
|
+
ReferencesToDelete.push(item.toStruct());
|
|
829
847
|
}
|
|
830
|
-
let request = (0, opcua_webapi_1.
|
|
848
|
+
let request = (0, opcua_webapi_1.DeleteReferencesRequestFromJSON)({
|
|
831
849
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
832
|
-
|
|
850
|
+
ReferencesToDelete: ReferencesToDelete
|
|
833
851
|
});
|
|
834
852
|
let timeout = this.requestTimeout(additionalParameters);
|
|
835
853
|
let response;
|
|
@@ -837,7 +855,7 @@ class UaWebClient {
|
|
|
837
855
|
let controller = new AbortController();
|
|
838
856
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
839
857
|
try {
|
|
840
|
-
response = yield this.api.
|
|
858
|
+
response = yield this.api.deleteReferences(request, { signal: controller.signal });
|
|
841
859
|
}
|
|
842
860
|
catch (error) {
|
|
843
861
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -848,7 +866,7 @@ class UaWebClient {
|
|
|
848
866
|
}
|
|
849
867
|
else {
|
|
850
868
|
try {
|
|
851
|
-
response = yield this.api.
|
|
869
|
+
response = yield this.api.deleteReferences(request);
|
|
852
870
|
}
|
|
853
871
|
catch (error) {
|
|
854
872
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -866,18 +884,14 @@ class UaWebClient {
|
|
|
866
884
|
return results;
|
|
867
885
|
});
|
|
868
886
|
}
|
|
869
|
-
|
|
887
|
+
findServer(endpointUrl, serverUris, localeIds, additionalParameters) {
|
|
870
888
|
return __awaiter(this, void 0, void 0, function* () {
|
|
871
889
|
var _a, _b;
|
|
872
|
-
|
|
873
|
-
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
874
|
-
let ReferencesToAdd = [];
|
|
875
|
-
for (let item of referencesToAdd) {
|
|
876
|
-
ReferencesToAdd.push(item.toStruct());
|
|
877
|
-
}
|
|
878
|
-
let request = (0, opcua_webapi_1.AddReferencesRequestFromJSON)({
|
|
890
|
+
let request = (0, opcua_webapi_1.FindServersRequestFromJSON)({
|
|
879
891
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
880
|
-
|
|
892
|
+
ServerUris: serverUris,
|
|
893
|
+
EndpointUrl: endpointUrl,
|
|
894
|
+
LocaleIds: localeIds
|
|
881
895
|
});
|
|
882
896
|
let timeout = this.requestTimeout(additionalParameters);
|
|
883
897
|
let response;
|
|
@@ -885,7 +899,7 @@ class UaWebClient {
|
|
|
885
899
|
let controller = new AbortController();
|
|
886
900
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
887
901
|
try {
|
|
888
|
-
response = yield this.api.
|
|
902
|
+
response = yield this.api.findServers(request, { signal: controller.signal });
|
|
889
903
|
}
|
|
890
904
|
catch (error) {
|
|
891
905
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -896,7 +910,7 @@ class UaWebClient {
|
|
|
896
910
|
}
|
|
897
911
|
else {
|
|
898
912
|
try {
|
|
899
|
-
response = yield this.api.
|
|
913
|
+
response = yield this.api.findServers(request);
|
|
900
914
|
}
|
|
901
915
|
catch (error) {
|
|
902
916
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -904,28 +918,19 @@ class UaWebClient {
|
|
|
904
918
|
}
|
|
905
919
|
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)
|
|
906
920
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
907
|
-
if (!response.
|
|
921
|
+
if (!response.Servers)
|
|
908
922
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
909
|
-
|
|
910
|
-
for (let item of response.Results) {
|
|
911
|
-
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
912
|
-
results.push(result);
|
|
913
|
-
}
|
|
914
|
-
return results;
|
|
923
|
+
return response.Servers;
|
|
915
924
|
});
|
|
916
925
|
}
|
|
917
|
-
|
|
926
|
+
getEndpoints(endpointUrl, localeIds, profileUris, additionalParameters) {
|
|
918
927
|
return __awaiter(this, void 0, void 0, function* () {
|
|
919
928
|
var _a, _b;
|
|
920
|
-
|
|
921
|
-
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
922
|
-
let ReferencesToDelete = [];
|
|
923
|
-
for (let item of referencesToDelete) {
|
|
924
|
-
ReferencesToDelete.push(item.toStruct());
|
|
925
|
-
}
|
|
926
|
-
let request = (0, opcua_webapi_1.DeleteReferencesRequestFromJSON)({
|
|
929
|
+
let request = (0, opcua_webapi_1.GetEndpointsRequestFromJSON)({
|
|
927
930
|
RequestHeader: this.requestHeader(additionalParameters),
|
|
928
|
-
|
|
931
|
+
EndpointUrl: endpointUrl,
|
|
932
|
+
LocaleIds: localeIds,
|
|
933
|
+
ProfileUris: profileUris
|
|
929
934
|
});
|
|
930
935
|
let timeout = this.requestTimeout(additionalParameters);
|
|
931
936
|
let response;
|
|
@@ -933,7 +938,7 @@ class UaWebClient {
|
|
|
933
938
|
let controller = new AbortController();
|
|
934
939
|
let timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
935
940
|
try {
|
|
936
|
-
response = yield this.api.
|
|
941
|
+
response = yield this.api.getEndpoints(request, { signal: controller.signal });
|
|
937
942
|
}
|
|
938
943
|
catch (error) {
|
|
939
944
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -944,7 +949,7 @@ class UaWebClient {
|
|
|
944
949
|
}
|
|
945
950
|
else {
|
|
946
951
|
try {
|
|
947
|
-
response = yield this.api.
|
|
952
|
+
response = yield this.api.getEndpoints(request);
|
|
948
953
|
}
|
|
949
954
|
catch (error) {
|
|
950
955
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadCommunicationError));
|
|
@@ -952,14 +957,9 @@ class UaWebClient {
|
|
|
952
957
|
}
|
|
953
958
|
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)
|
|
954
959
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
955
|
-
if (!response.
|
|
960
|
+
if (!response.Endpoints)
|
|
956
961
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
957
|
-
|
|
958
|
-
for (let item of response.Results) {
|
|
959
|
-
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
960
|
-
results.push(result);
|
|
961
|
-
}
|
|
962
|
-
return results;
|
|
962
|
+
return response.Endpoints;
|
|
963
963
|
});
|
|
964
964
|
}
|
|
965
965
|
requestHeader(additionalParameters) {
|
|
@@ -982,8 +982,5 @@ class UaWebClient {
|
|
|
982
982
|
timeout = additionalParameters.timeout;
|
|
983
983
|
return timeout;
|
|
984
984
|
}
|
|
985
|
-
createApi() {
|
|
986
|
-
return new __1.UaWebClientNative(this.clientConfig.apiConfig);
|
|
987
|
-
}
|
|
988
985
|
}
|
|
989
986
|
exports.UaWebClient = UaWebClient;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UaNode, UaNodeId, UaReference } from "../../common";
|
|
1
|
+
import { UaNode, UaNodeId, UaObject, UaReference, UaDefintionNode } from "../../common";
|
|
2
2
|
import { UaWebClient } from "../UaWebClient";
|
|
3
3
|
export declare class UaNodeReader {
|
|
4
4
|
private _client;
|
|
@@ -6,9 +6,10 @@ export declare class UaNodeReader {
|
|
|
6
6
|
private _returnDescription;
|
|
7
7
|
private _returnAttributes;
|
|
8
8
|
private _returnValue;
|
|
9
|
+
private _referenceTypeToReturn;
|
|
9
10
|
private static s_variableTypeWithoutMember;
|
|
10
11
|
private static s_variablesNameToRead;
|
|
11
|
-
constructor(client: UaWebClient, returnDescription?: boolean | null, returnVariable?: boolean | null, returnMethod?: boolean | null, returnAttributes?: boolean | null, returnValue?: boolean | null);
|
|
12
|
+
constructor(client: UaWebClient, returnDescription?: boolean | null, returnVariable?: boolean | null, returnMethod?: boolean | null, returnAttributes?: boolean | null, returnValue?: boolean | null, referenceTypeToReturn?: UaNodeId);
|
|
12
13
|
read(nodeIds: Array<UaNodeId>): Promise<Array<UaNode>>;
|
|
13
14
|
readByReferences(references: Array<UaReference>): Promise<Array<UaNode>>;
|
|
14
15
|
private _readRootNodes;
|
|
@@ -21,9 +22,9 @@ export declare class UaNodeReader {
|
|
|
21
22
|
}
|
|
22
23
|
export declare class UaObjectReader extends UaNodeReader {
|
|
23
24
|
constructor(client: UaWebClient, returnDescription?: boolean | null, returnValue?: boolean | null);
|
|
24
|
-
read(nodeIds: Array<UaNodeId>): Promise<Array<
|
|
25
|
+
read(nodeIds: Array<UaNodeId>): Promise<Array<UaObject>>;
|
|
25
26
|
}
|
|
26
27
|
export declare class UaTypeReader extends UaNodeReader {
|
|
27
28
|
constructor(client: UaWebClient);
|
|
28
|
-
read(nodeIds: Array<UaNodeId>): Promise<Array<
|
|
29
|
+
read(nodeIds: Array<UaNodeId>): Promise<Array<UaDefintionNode>>;
|
|
29
30
|
}
|
|
@@ -14,11 +14,12 @@ const opcua_webapi_1 = require("opcua-webapi");
|
|
|
14
14
|
const common_1 = require("../../common");
|
|
15
15
|
const UaNodeBrowser_1 = require("./UaNodeBrowser");
|
|
16
16
|
class UaNodeReader {
|
|
17
|
-
constructor(client, returnDescription, returnVariable, returnMethod, returnAttributes, returnValue) {
|
|
17
|
+
constructor(client, returnDescription, returnVariable, returnMethod, returnAttributes, returnValue, referenceTypeToReturn) {
|
|
18
18
|
this._client = client;
|
|
19
19
|
this._returnDescription = (returnDescription) ? returnDescription : false;
|
|
20
20
|
this._returnAttributes = (returnAttributes) ? returnAttributes : false;
|
|
21
21
|
this._returnValue = (returnValue) ? returnValue : false;
|
|
22
|
+
this._referenceTypeToReturn = (referenceTypeToReturn) ? referenceTypeToReturn : common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences);
|
|
22
23
|
this._nodeClassToReturn = 0;
|
|
23
24
|
if (returnVariable)
|
|
24
25
|
this._nodeClassToReturn += opcua_webapi_1.NodeClass.Variable;
|
|
@@ -68,7 +69,7 @@ class UaNodeReader {
|
|
|
68
69
|
nodeIdsToBrowse.push(item.nodeId);
|
|
69
70
|
nodeIdsSet.add(item.nodeId.toString());
|
|
70
71
|
}
|
|
71
|
-
let nodeReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, nodeIdsToBrowse,
|
|
72
|
+
let nodeReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, nodeIdsToBrowse, this._referenceTypeToReturn, this._nodeClassToReturn, false);
|
|
72
73
|
yield nodeReferenceBrowser.browse();
|
|
73
74
|
let childReferences = nodeReferenceBrowser.results();
|
|
74
75
|
let childNodesToBrowse = [];
|