opcua-webapi-ts 1.0.25 → 1.0.27
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 +15 -8
- package/dist/cjs/client/utils/UaNodeReader.js +5 -5
- package/dist/cjs/common/nodes/Identifiers.d.ts +15 -0
- package/dist/cjs/common/nodes/Identifiers.js +15 -0
- package/dist/cjs/common/nodes/UaMethod.js +2 -2
- package/dist/cjs/common/payload/UaBrowseResult.js +1 -1
- package/dist/cjs/common/payload/UaPayloadMapper.js +27 -19
- package/dist/cjs/common/payload/UaReferenceDescription.js +1 -1
- package/dist/cjs/common/structure/UaEnumValueType.js +4 -2
- package/dist/cjs/common/structure/UaRange.js +3 -3
- package/dist/cjs/common/structure/UaReadRawModifiedDetails.js +3 -3
- package/dist/cjs/common/types/UaAccessLevel.d.ts +1 -0
- package/dist/cjs/common/types/UaAccessLevel.js +4 -0
- package/dist/cjs/common/types/UaBrowseMask.d.ts +11 -0
- package/dist/cjs/common/types/UaBrowseMask.js +18 -0
- package/dist/cjs/common/types/UaNodeId.js +1 -3
- package/dist/cjs/common/types/UaQuery.js +1 -1
- package/dist/cjs/common/types/UaStatusCode.js +1 -1
- package/dist/cjs/common/types/UaValueRank.d.ts +7 -0
- package/dist/cjs/common/types/UaValueRank.js +11 -0
- package/dist/cjs/common/types/UaWriteMask.d.ts +1 -0
- package/dist/cjs/common/types/UaWriteMask.js +4 -0
- package/dist/cjs/common/types/index.d.ts +2 -0
- package/dist/cjs/common/types/index.js +2 -0
- package/dist/client/UaWebClient.js +15 -8
- package/dist/client/utils/UaNodeReader.d.ts +2 -2
- package/dist/client/utils/UaNodeReader.js +5 -5
- package/dist/common/nodes/Identifiers.d.ts +15 -0
- package/dist/common/nodes/Identifiers.js +15 -0
- package/dist/common/nodes/UaMethod.d.ts +1 -1
- package/dist/common/nodes/UaMethod.js +2 -2
- package/dist/common/payload/UaBrowseResult.js +1 -1
- package/dist/common/payload/UaPayloadMapper.js +27 -19
- package/dist/common/payload/UaReferenceDescription.js +1 -1
- package/dist/common/structure/UaEnumValueType.d.ts +2 -2
- package/dist/common/structure/UaEnumValueType.js +4 -2
- package/dist/common/structure/UaRange.js +3 -3
- package/dist/common/structure/UaReadEventDetails.d.ts +1 -1
- package/dist/common/structure/UaReadRawModifiedDetails.js +3 -3
- package/dist/common/types/UaAccessLevel.d.ts +1 -0
- package/dist/common/types/UaAccessLevel.js +4 -0
- package/dist/common/types/UaBrowseMask.d.ts +11 -0
- package/dist/common/types/UaBrowseMask.js +18 -0
- package/dist/common/types/UaNodeId.d.ts +1 -1
- package/dist/common/types/UaNodeId.js +1 -3
- package/dist/common/types/UaQuery.js +1 -1
- package/dist/common/types/UaStatusCode.js +1 -1
- package/dist/common/types/UaValueRank.d.ts +7 -0
- package/dist/common/types/UaValueRank.js +11 -0
- package/dist/common/types/UaWriteMask.d.ts +1 -0
- package/dist/common/types/UaWriteMask.js +4 -0
- package/dist/common/types/index.d.ts +2 -0
- package/dist/common/types/index.js +2 -0
- package/package.json +3 -5
|
@@ -30,9 +30,10 @@ class UaWebClient {
|
|
|
30
30
|
let results = yield this.findServer(this.clientConfig.apiConfig.basePath, (applicationUris) ? applicationUris : []);
|
|
31
31
|
let ret = [];
|
|
32
32
|
for (let item of results) {
|
|
33
|
+
let applicationName = common_1.UaPayloadMapper.localizedTextFromWebApi(item.ApplicationName);
|
|
33
34
|
ret.push({
|
|
34
35
|
applicationUri: (item.ApplicationUri) ? item.ApplicationUri : "",
|
|
35
|
-
applicationName: common_1.
|
|
36
|
+
applicationName: (applicationName) ? applicationName : common_1.UaLocalizedText.nullText,
|
|
36
37
|
productUri: (item.ProductUri) ? item.ProductUri : "",
|
|
37
38
|
urls: (item.DiscoveryUrls) ? item.DiscoveryUrls : []
|
|
38
39
|
});
|
|
@@ -276,7 +277,9 @@ class UaWebClient {
|
|
|
276
277
|
let browseResult = results[0];
|
|
277
278
|
let ret = [];
|
|
278
279
|
for (let item of browseResult.results) {
|
|
279
|
-
|
|
280
|
+
let nodeId = item.nodeId.getNodeId();
|
|
281
|
+
if (nodeId)
|
|
282
|
+
ret.push(nodeId);
|
|
280
283
|
}
|
|
281
284
|
return ret;
|
|
282
285
|
});
|
|
@@ -284,13 +287,15 @@ class UaWebClient {
|
|
|
284
287
|
historyReadRawData(nodeId, startTime, endTime, numValuesPerNode, continuationPoint, returnBounds, isReadModified, timestampsToReturn, releaseContinuationPoints) {
|
|
285
288
|
return __awaiter(this, void 0, void 0, function* () {
|
|
286
289
|
let nodeToRead = new common_1.UaHistoryReadValueId(nodeId, continuationPoint);
|
|
287
|
-
let details = new common_2.UaReadRawModifiedDetails(startTime, endTime, numValuesPerNode, returnBounds, isReadModified);
|
|
290
|
+
let details = new common_2.UaReadRawModifiedDetails(startTime, endTime, (numValuesPerNode) ? numValuesPerNode : 0, (returnBounds) ? returnBounds : false, (isReadModified) ? isReadModified : false);
|
|
288
291
|
let historyReadDetails = details.toExtensionObject();
|
|
289
292
|
let nodesToRead = [nodeToRead];
|
|
290
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, timestampsToReturn, releaseContinuationPoints);
|
|
293
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Neither, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
291
294
|
if (results[0].statusCode.isNotGood())
|
|
292
295
|
throw new common_1.UaError(results[0].statusCode);
|
|
293
296
|
let extensionObject = results[0].historyData;
|
|
297
|
+
if (!extensionObject)
|
|
298
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
294
299
|
let historyData = common_1.UaHistoryData.fromExtensionObject(extensionObject);
|
|
295
300
|
if (null == historyData)
|
|
296
301
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
@@ -306,10 +311,12 @@ class UaWebClient {
|
|
|
306
311
|
let details = new common_2.UaReadAtTimeDetails(requiredTimes, useSimpleBounds);
|
|
307
312
|
let historyReadDetails = details.toExtensionObject();
|
|
308
313
|
let nodesToRead = [nodeToRead];
|
|
309
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, timestampsToReturn, releaseContinuationPoints);
|
|
314
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Neither, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
310
315
|
if (results[0].statusCode.isNotGood())
|
|
311
316
|
throw new common_1.UaError(results[0].statusCode);
|
|
312
317
|
let extensionObject = results[0].historyData;
|
|
318
|
+
if (!extensionObject)
|
|
319
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
313
320
|
let historyData = common_1.UaHistoryData.fromExtensionObject(extensionObject);
|
|
314
321
|
if (null == historyData)
|
|
315
322
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
@@ -328,14 +335,14 @@ class UaWebClient {
|
|
|
328
335
|
let selectedField = new common_1.UaSimpleAttributeOperand([item]);
|
|
329
336
|
selectClauses.push(selectedField);
|
|
330
337
|
}
|
|
331
|
-
let details = new common_1.UaReadEventDetails(startTime, endTime, new common_1.UaEventFilter(selectClauses, whereClauses), numValuesPerNode);
|
|
338
|
+
let details = new common_1.UaReadEventDetails(startTime, endTime, new common_1.UaEventFilter(selectClauses, whereClauses), (numValuesPerNode) ? numValuesPerNode : null);
|
|
332
339
|
let historyReadDetails = details.toExtensionObject();
|
|
333
340
|
let nodesToRead = [nodeToRead];
|
|
334
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, opcua_webapi_1.TimestampsToReturn.Both, releaseContinuationPoints);
|
|
341
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, opcua_webapi_1.TimestampsToReturn.Both, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
335
342
|
if (results[0].statusCode.isNotGood())
|
|
336
343
|
throw new common_1.UaError(results[0].statusCode);
|
|
337
344
|
let extensionObject = results[0].historyData;
|
|
338
|
-
let historyData = common_2.UaHistoryEvent.fromExtensionObject(extensionObject);
|
|
345
|
+
let historyData = (extensionObject) ? common_2.UaHistoryEvent.fromExtensionObject(extensionObject) : null;
|
|
339
346
|
if (null == historyData)
|
|
340
347
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
341
348
|
let ret = new common_2.UaHistoryEventResult(historyData.events, results[0].continuationPoint);
|
|
@@ -61,11 +61,11 @@ class UaNodeReaderBase {
|
|
|
61
61
|
this._browseResults.push({
|
|
62
62
|
fromNodeId: currentNode.nodeId,
|
|
63
63
|
nodeId: nodeId,
|
|
64
|
-
nodeClass: item.nodeClass,
|
|
65
|
-
browseName: item.browseName,
|
|
66
|
-
displayName: item.displayName,
|
|
67
|
-
referenceTypeId: item.referenceTypeId,
|
|
68
|
-
isForward: item.isForward,
|
|
64
|
+
nodeClass: (item.nodeClass) ? item.nodeClass : opcua_webapi_1.NodeClass.Unspecified,
|
|
65
|
+
browseName: item.browseName ? item.browseName : "",
|
|
66
|
+
displayName: item.displayName ? item.displayName : common_1.UaLocalizedText.nullText,
|
|
67
|
+
referenceTypeId: item.referenceTypeId ? item.referenceTypeId : common_1.UaNodeId.nullNodeId,
|
|
68
|
+
isForward: (item.isForward) ? item.isForward : false,
|
|
69
69
|
typeDefinitionId: (typeDefinition) ? typeDefinition : undefined
|
|
70
70
|
});
|
|
71
71
|
this._updateNodesToBrowse(item);
|
|
@@ -1961,6 +1961,17 @@ export declare enum VariableIds {
|
|
|
1961
1961
|
DataTypeDescriptionType_DictionaryFragment = 105,
|
|
1962
1962
|
DataTypeDictionaryType_DataTypeVersion = 106,
|
|
1963
1963
|
DataTypeDictionaryType_NamespaceUri = 107,
|
|
1964
|
+
ServerType_ServerArray = 2005,
|
|
1965
|
+
ServerType_NamespaceArray = 2006,
|
|
1966
|
+
BaseEventType_EventId = 2042,
|
|
1967
|
+
BaseEventType_EventType = 2043,
|
|
1968
|
+
BaseEventType_SourceNode = 2044,
|
|
1969
|
+
BaseEventType_SourceName = 2045,
|
|
1970
|
+
BaseEventType_Time = 2046,
|
|
1971
|
+
BaseEventType_ReceiveTime = 2047,
|
|
1972
|
+
BaseEventType_LocalTime = 3190,
|
|
1973
|
+
BaseEventType_Message = 2050,
|
|
1974
|
+
BaseEventType_Severity = 2051,
|
|
1964
1975
|
Server_ServerArray = 2254,
|
|
1965
1976
|
Server_NamespaceArray = 2255,
|
|
1966
1977
|
Server_ServerStatus = 2256,
|
|
@@ -1993,6 +2004,8 @@ export declare enum VariableIds {
|
|
|
1993
2004
|
Server_ServerDiagnostics_SamplingIntervalDiagnosticsArray = 2289,
|
|
1994
2005
|
Server_ServerDiagnostics_SubscriptionDiagnosticsArray = 2290,
|
|
1995
2006
|
Server_ServerDiagnostics_EnabledFlag = 2294,
|
|
2007
|
+
DataItemType_Definition = 2366,
|
|
2008
|
+
DataItemType_ValuePrecision = 2367,
|
|
1996
2009
|
Server_ServerCapabilities_MaxBrowseContinuationPoints = 2735,
|
|
1997
2010
|
Server_ServerCapabilities_MaxQueryContinuationPoints = 2736,
|
|
1998
2011
|
Server_ServerCapabilities_MaxHistoryContinuationPoints = 2737,
|
|
@@ -2108,6 +2121,8 @@ export declare enum VariableIds {
|
|
|
2108
2121
|
OPCUANamespaceMetadata_DefaultUserRolePermissions = 16135,
|
|
2109
2122
|
OPCUANamespaceMetadata_DefaultAccessRestrictions = 16136,
|
|
2110
2123
|
PublishSubscribe_SupportedTransportProfiles = 17481,
|
|
2124
|
+
BaseAnalogType_EURange = 17568,
|
|
2125
|
+
BaseAnalogType_EngineeringUnits = 17569,
|
|
2111
2126
|
DefaultInstanceBrowseName = 17605,
|
|
2112
2127
|
Server_LocalTime = 17634,
|
|
2113
2128
|
HistoryServerCapabilities_ServerTimestampSupported = 19091,
|
|
@@ -1972,6 +1972,17 @@ var VariableIds;
|
|
|
1972
1972
|
VariableIds[VariableIds["DataTypeDescriptionType_DictionaryFragment"] = 105] = "DataTypeDescriptionType_DictionaryFragment";
|
|
1973
1973
|
VariableIds[VariableIds["DataTypeDictionaryType_DataTypeVersion"] = 106] = "DataTypeDictionaryType_DataTypeVersion";
|
|
1974
1974
|
VariableIds[VariableIds["DataTypeDictionaryType_NamespaceUri"] = 107] = "DataTypeDictionaryType_NamespaceUri";
|
|
1975
|
+
VariableIds[VariableIds["ServerType_ServerArray"] = 2005] = "ServerType_ServerArray";
|
|
1976
|
+
VariableIds[VariableIds["ServerType_NamespaceArray"] = 2006] = "ServerType_NamespaceArray";
|
|
1977
|
+
VariableIds[VariableIds["BaseEventType_EventId"] = 2042] = "BaseEventType_EventId";
|
|
1978
|
+
VariableIds[VariableIds["BaseEventType_EventType"] = 2043] = "BaseEventType_EventType";
|
|
1979
|
+
VariableIds[VariableIds["BaseEventType_SourceNode"] = 2044] = "BaseEventType_SourceNode";
|
|
1980
|
+
VariableIds[VariableIds["BaseEventType_SourceName"] = 2045] = "BaseEventType_SourceName";
|
|
1981
|
+
VariableIds[VariableIds["BaseEventType_Time"] = 2046] = "BaseEventType_Time";
|
|
1982
|
+
VariableIds[VariableIds["BaseEventType_ReceiveTime"] = 2047] = "BaseEventType_ReceiveTime";
|
|
1983
|
+
VariableIds[VariableIds["BaseEventType_LocalTime"] = 3190] = "BaseEventType_LocalTime";
|
|
1984
|
+
VariableIds[VariableIds["BaseEventType_Message"] = 2050] = "BaseEventType_Message";
|
|
1985
|
+
VariableIds[VariableIds["BaseEventType_Severity"] = 2051] = "BaseEventType_Severity";
|
|
1975
1986
|
VariableIds[VariableIds["Server_ServerArray"] = 2254] = "Server_ServerArray";
|
|
1976
1987
|
VariableIds[VariableIds["Server_NamespaceArray"] = 2255] = "Server_NamespaceArray";
|
|
1977
1988
|
VariableIds[VariableIds["Server_ServerStatus"] = 2256] = "Server_ServerStatus";
|
|
@@ -2004,6 +2015,8 @@ var VariableIds;
|
|
|
2004
2015
|
VariableIds[VariableIds["Server_ServerDiagnostics_SamplingIntervalDiagnosticsArray"] = 2289] = "Server_ServerDiagnostics_SamplingIntervalDiagnosticsArray";
|
|
2005
2016
|
VariableIds[VariableIds["Server_ServerDiagnostics_SubscriptionDiagnosticsArray"] = 2290] = "Server_ServerDiagnostics_SubscriptionDiagnosticsArray";
|
|
2006
2017
|
VariableIds[VariableIds["Server_ServerDiagnostics_EnabledFlag"] = 2294] = "Server_ServerDiagnostics_EnabledFlag";
|
|
2018
|
+
VariableIds[VariableIds["DataItemType_Definition"] = 2366] = "DataItemType_Definition";
|
|
2019
|
+
VariableIds[VariableIds["DataItemType_ValuePrecision"] = 2367] = "DataItemType_ValuePrecision";
|
|
2007
2020
|
VariableIds[VariableIds["Server_ServerCapabilities_MaxBrowseContinuationPoints"] = 2735] = "Server_ServerCapabilities_MaxBrowseContinuationPoints";
|
|
2008
2021
|
VariableIds[VariableIds["Server_ServerCapabilities_MaxQueryContinuationPoints"] = 2736] = "Server_ServerCapabilities_MaxQueryContinuationPoints";
|
|
2009
2022
|
VariableIds[VariableIds["Server_ServerCapabilities_MaxHistoryContinuationPoints"] = 2737] = "Server_ServerCapabilities_MaxHistoryContinuationPoints";
|
|
@@ -2119,6 +2132,8 @@ var VariableIds;
|
|
|
2119
2132
|
VariableIds[VariableIds["OPCUANamespaceMetadata_DefaultUserRolePermissions"] = 16135] = "OPCUANamespaceMetadata_DefaultUserRolePermissions";
|
|
2120
2133
|
VariableIds[VariableIds["OPCUANamespaceMetadata_DefaultAccessRestrictions"] = 16136] = "OPCUANamespaceMetadata_DefaultAccessRestrictions";
|
|
2121
2134
|
VariableIds[VariableIds["PublishSubscribe_SupportedTransportProfiles"] = 17481] = "PublishSubscribe_SupportedTransportProfiles";
|
|
2135
|
+
VariableIds[VariableIds["BaseAnalogType_EURange"] = 17568] = "BaseAnalogType_EURange";
|
|
2136
|
+
VariableIds[VariableIds["BaseAnalogType_EngineeringUnits"] = 17569] = "BaseAnalogType_EngineeringUnits";
|
|
2122
2137
|
VariableIds[VariableIds["DefaultInstanceBrowseName"] = 17605] = "DefaultInstanceBrowseName";
|
|
2123
2138
|
VariableIds[VariableIds["Server_LocalTime"] = 17634] = "Server_LocalTime";
|
|
2124
2139
|
VariableIds[VariableIds["HistoryServerCapabilities_ServerTimestampSupported"] = 19091] = "HistoryServerCapabilities_ServerTimestampSupported";
|
|
@@ -26,12 +26,12 @@ class UaMethod extends _1.UaInstanceNode {
|
|
|
26
26
|
return;
|
|
27
27
|
let extensionObjects = node.value.toExtensionObjects();
|
|
28
28
|
if (null == extensionObjects)
|
|
29
|
-
return
|
|
29
|
+
return;
|
|
30
30
|
let args = [];
|
|
31
31
|
for (let item2 of extensionObjects) {
|
|
32
32
|
let argument = structure_1.UaArgument.fromExtensionObject(item2);
|
|
33
33
|
if (null == argument)
|
|
34
|
-
return
|
|
34
|
+
return;
|
|
35
35
|
args.push(argument);
|
|
36
36
|
}
|
|
37
37
|
if (isInputArgument) {
|
|
@@ -45,7 +45,7 @@ class UaBrowseResult {
|
|
|
45
45
|
references.push(reference);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
return new UaBrowseResult(references, browseResult.ContinuationPoint, (browseResult.StatusCode) ? (0, types_1.makeUaStatusCode)(browseResult.StatusCode.Code) : (0, types_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.Good));
|
|
48
|
+
return new UaBrowseResult(references, (browseResult.ContinuationPoint) ? browseResult.ContinuationPoint : null, (browseResult.StatusCode) ? (0, types_1.makeUaStatusCode)(browseResult.StatusCode.Code) : (0, types_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.Good));
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
exports.UaBrowseResult = UaBrowseResult;
|
|
@@ -28,12 +28,12 @@ class UaPayloadMapper {
|
|
|
28
28
|
static extensionObjectFromWebApi(json) {
|
|
29
29
|
try {
|
|
30
30
|
let extensionObject = (0, opcua_webapi_1.ExtensionObjectFromJSON)(json);
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
if (!extensionObject || !extensionObject.UaTypeId || !extensionObject.UaBody)
|
|
32
|
+
throw new types_1.UaError((0, types_1.makeUaStatusCode)(opcua_webapi_2.StatusCodes.BadDecodingError));
|
|
33
|
+
let typeId = (0, types_1.parseUaNodeId)(extensionObject.UaTypeId);
|
|
34
|
+
let jsonStr = atob(extensionObject.UaBody);
|
|
35
|
+
let body = JSON.parse(jsonStr);
|
|
36
|
+
return new types_2.UaExtensionObject(typeId, body);
|
|
37
37
|
}
|
|
38
38
|
catch (e) {
|
|
39
39
|
throw new types_1.UaError((0, types_1.makeUaStatusCode)(opcua_webapi_2.StatusCodes.BadDecodingError));
|
|
@@ -71,7 +71,7 @@ class UaPayloadMapper {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
|
-
if (value.every(item => typeof item === 'number')) {
|
|
74
|
+
if (value.every((item) => typeof item === 'number')) {
|
|
75
75
|
return types_2.UaVariant.integers(value, dataType);
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
@@ -89,7 +89,7 @@ class UaPayloadMapper {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
|
-
if (value.every(item => typeof item === 'number')) {
|
|
92
|
+
if (value.every((item) => typeof item === 'number')) {
|
|
93
93
|
return types_2.UaVariant.doubles(value);
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
@@ -107,7 +107,7 @@ class UaPayloadMapper {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
|
-
if (value.every(item => typeof item === 'number')) {
|
|
110
|
+
if (value.every((item) => typeof item === 'number')) {
|
|
111
111
|
return types_2.UaVariant.floats(value);
|
|
112
112
|
}
|
|
113
113
|
else {
|
|
@@ -125,7 +125,7 @@ class UaPayloadMapper {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
|
-
if (value.every(item => typeof item === 'boolean')) {
|
|
128
|
+
if (value.every((item) => typeof item === 'boolean')) {
|
|
129
129
|
return types_2.UaVariant.booleans(value);
|
|
130
130
|
}
|
|
131
131
|
else {
|
|
@@ -143,7 +143,7 @@ class UaPayloadMapper {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
else {
|
|
146
|
-
if (value.every(item => typeof item === 'string')) {
|
|
146
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
147
147
|
return types_2.UaVariant.strings(value);
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
@@ -161,7 +161,7 @@ class UaPayloadMapper {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
else {
|
|
164
|
-
if (value.every(item => typeof item === 'string')) {
|
|
164
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
165
165
|
let nodeIds = [];
|
|
166
166
|
for (let item of value) {
|
|
167
167
|
nodeIds.push((0, types_1.parseUaNodeId)(item));
|
|
@@ -183,7 +183,7 @@ class UaPayloadMapper {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
else {
|
|
186
|
-
if (value.every(item => typeof item === 'string')) {
|
|
186
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
187
187
|
let nodeIds = [];
|
|
188
188
|
for (let item of value) {
|
|
189
189
|
nodeIds.push((0, types_1.parseUaExpandedNodeId)(item));
|
|
@@ -205,7 +205,7 @@ class UaPayloadMapper {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
else {
|
|
208
|
-
if (value.every(item => typeof item === 'string')) {
|
|
208
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
209
209
|
let datetimes = [];
|
|
210
210
|
for (let item of value) {
|
|
211
211
|
datetimes.push(new Date(item));
|
|
@@ -227,7 +227,7 @@ class UaPayloadMapper {
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
else {
|
|
230
|
-
if (value.every(item => typeof item === 'string')) {
|
|
230
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
231
231
|
let byteStrings = [];
|
|
232
232
|
for (let item of value) {
|
|
233
233
|
byteStrings.push(item);
|
|
@@ -249,7 +249,7 @@ class UaPayloadMapper {
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
else {
|
|
252
|
-
if (value.every(item => typeof item === 'string')) {
|
|
252
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
253
253
|
let qualifiedNames = [];
|
|
254
254
|
for (let item of value) {
|
|
255
255
|
qualifiedNames.push(item);
|
|
@@ -271,7 +271,7 @@ class UaPayloadMapper {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
else {
|
|
274
|
-
if (value.every(item => typeof item === 'string')) {
|
|
274
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
275
275
|
let guids = [];
|
|
276
276
|
for (let item of value) {
|
|
277
277
|
guids.push(item);
|
|
@@ -309,12 +309,20 @@ class UaPayloadMapper {
|
|
|
309
309
|
}
|
|
310
310
|
else if (types_1.UaVariantType.LocalizedText == dataType) {
|
|
311
311
|
if (!isArray) {
|
|
312
|
-
|
|
312
|
+
let localizedText = UaPayloadMapper.localizedTextFromWebApi(value);
|
|
313
|
+
if (!localizedText) {
|
|
314
|
+
throw new types_1.UaError((0, types_1.makeUaStatusCode)(opcua_webapi_2.StatusCodes.BadDecodingError));
|
|
315
|
+
}
|
|
316
|
+
return types_2.UaVariant.localizedText(localizedText);
|
|
313
317
|
}
|
|
314
318
|
else {
|
|
315
319
|
let localizedTexts = [];
|
|
316
320
|
for (let item of value) {
|
|
317
|
-
|
|
321
|
+
let localizedText = UaPayloadMapper.localizedTextFromWebApi(item);
|
|
322
|
+
if (!localizedText) {
|
|
323
|
+
throw new types_1.UaError((0, types_1.makeUaStatusCode)(opcua_webapi_2.StatusCodes.BadDecodingError));
|
|
324
|
+
}
|
|
325
|
+
localizedTexts.push(localizedText);
|
|
318
326
|
}
|
|
319
327
|
return types_2.UaVariant.localizedTexts(localizedTexts);
|
|
320
328
|
}
|
|
@@ -52,7 +52,7 @@ class UaReferenceDescription {
|
|
|
52
52
|
let displayName = (referenceDescription.DisplayName) ? _1.UaPayloadMapper.localizedTextFromWebApi(referenceDescription.DisplayName) : undefined;
|
|
53
53
|
let referenceTypeId = (referenceDescription.ReferenceTypeId) ? (0, types_1.parseUaNodeIdOrNull)(referenceDescription.ReferenceTypeId) : undefined;
|
|
54
54
|
let typeDefinition = (referenceDescription.TypeDefinition) ? (0, types_1.parseUaExpandedNodeIdOrNull)(referenceDescription.TypeDefinition) : undefined;
|
|
55
|
-
if (null
|
|
55
|
+
if (null === nodeId || null === displayName || null === referenceTypeId || null === typeDefinition)
|
|
56
56
|
return null;
|
|
57
57
|
return new UaReferenceDescription(nodeId, referenceDescription.NodeClass, referenceDescription.BrowseName, displayName, referenceTypeId, referenceDescription.IsForward, typeDefinition);
|
|
58
58
|
}
|
|
@@ -24,14 +24,16 @@ class UaEnumValueType {
|
|
|
24
24
|
let enumValue = {
|
|
25
25
|
Value: this._value,
|
|
26
26
|
DisplayName: payload_1.UaPayloadMapper.localizedTextToWebApi(this._displayName),
|
|
27
|
-
Description: payload_1.UaPayloadMapper.localizedTextToWebApi(this._description)
|
|
27
|
+
Description: (null !== this._description) ? payload_1.UaPayloadMapper.localizedTextToWebApi(this._description) : undefined
|
|
28
28
|
};
|
|
29
29
|
return enumValue;
|
|
30
30
|
}
|
|
31
31
|
static fromStruct(enumValueType) {
|
|
32
|
-
let value =
|
|
32
|
+
let value = enumValueType.Value;
|
|
33
33
|
let displayName = payload_1.UaPayloadMapper.localizedTextFromWebApi(enumValueType.DisplayName);
|
|
34
34
|
let description = payload_1.UaPayloadMapper.localizedTextFromWebApi(enumValueType.Description);
|
|
35
|
+
if (typeof value !== "number" || null == displayName)
|
|
36
|
+
return null;
|
|
35
37
|
return new UaEnumValueType(value, displayName, description);
|
|
36
38
|
}
|
|
37
39
|
toExtensionObject() {
|
|
@@ -22,13 +22,13 @@ class UaRange {
|
|
|
22
22
|
}
|
|
23
23
|
toStruct() {
|
|
24
24
|
let range = {
|
|
25
|
-
Low: this._low,
|
|
26
|
-
High: this._high
|
|
25
|
+
Low: (null !== this._low) ? this._low : undefined,
|
|
26
|
+
High: (null !== this._high) ? this._high : undefined
|
|
27
27
|
};
|
|
28
28
|
return range;
|
|
29
29
|
}
|
|
30
30
|
static fromStruct(range) {
|
|
31
|
-
return new UaRange(range.Low, range.High);
|
|
31
|
+
return new UaRange((typeof range.Low === "number") ? range.Low : null, (typeof range.High === "number") ? range.High : null);
|
|
32
32
|
}
|
|
33
33
|
toExtensionObject() {
|
|
34
34
|
return new types_1.UaExtensionObject(UaRange.dataTypeId, (0, opcua_webapi_1.RangeToJSONTyped)(this.toStruct()));
|
|
@@ -8,9 +8,9 @@ class UaReadRawModifiedDetails {
|
|
|
8
8
|
constructor(startTime, endTime, numValuesPerNode, returnBounds, isReadModified) {
|
|
9
9
|
this._startTime = startTime;
|
|
10
10
|
this._endTime = endTime;
|
|
11
|
-
this._numValuesPerNode = (numValuesPerNode > 0) ? numValuesPerNode : 0;
|
|
12
|
-
this._returnBounds = (returnBounds) ? returnBounds :
|
|
13
|
-
this._isReadModified = (isReadModified) ? isReadModified :
|
|
11
|
+
this._numValuesPerNode = (numValuesPerNode && numValuesPerNode > 0) ? numValuesPerNode : 0;
|
|
12
|
+
this._returnBounds = (returnBounds) ? returnBounds : false;
|
|
13
|
+
this._isReadModified = (isReadModified) ? isReadModified : false;
|
|
14
14
|
}
|
|
15
15
|
get startTime() {
|
|
16
16
|
return this._startTime;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UaAccessLevel = void 0;
|
|
4
|
+
exports.isAccessible = isAccessible;
|
|
4
5
|
var UaAccessLevel;
|
|
5
6
|
(function (UaAccessLevel) {
|
|
6
7
|
UaAccessLevel[UaAccessLevel["None"] = 0] = "None";
|
|
@@ -12,3 +13,6 @@ var UaAccessLevel;
|
|
|
12
13
|
UaAccessLevel[UaAccessLevel["StatusWrite"] = 32] = "StatusWrite";
|
|
13
14
|
UaAccessLevel[UaAccessLevel["TimestampWrite"] = 64] = "TimestampWrite";
|
|
14
15
|
})(UaAccessLevel || (exports.UaAccessLevel = UaAccessLevel = {}));
|
|
16
|
+
function isAccessible(accessLevel, requiredAccessLevel) {
|
|
17
|
+
return (accessLevel & requiredAccessLevel) === requiredAccessLevel;
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum UaBrowseMask {
|
|
2
|
+
None = 0,
|
|
3
|
+
ReferenceTypeId = 1,
|
|
4
|
+
IsForward = 2,
|
|
5
|
+
NodeClass = 4,
|
|
6
|
+
BrowseName = 8,
|
|
7
|
+
DisplayName = 16,
|
|
8
|
+
TypeDefinition = 32,
|
|
9
|
+
All = 63
|
|
10
|
+
}
|
|
11
|
+
export declare function isBrowseMaskRequired(mask: number, requiredMask: UaBrowseMask): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaBrowseMask = void 0;
|
|
4
|
+
exports.isBrowseMaskRequired = isBrowseMaskRequired;
|
|
5
|
+
var UaBrowseMask;
|
|
6
|
+
(function (UaBrowseMask) {
|
|
7
|
+
UaBrowseMask[UaBrowseMask["None"] = 0] = "None";
|
|
8
|
+
UaBrowseMask[UaBrowseMask["ReferenceTypeId"] = 1] = "ReferenceTypeId";
|
|
9
|
+
UaBrowseMask[UaBrowseMask["IsForward"] = 2] = "IsForward";
|
|
10
|
+
UaBrowseMask[UaBrowseMask["NodeClass"] = 4] = "NodeClass";
|
|
11
|
+
UaBrowseMask[UaBrowseMask["BrowseName"] = 8] = "BrowseName";
|
|
12
|
+
UaBrowseMask[UaBrowseMask["DisplayName"] = 16] = "DisplayName";
|
|
13
|
+
UaBrowseMask[UaBrowseMask["TypeDefinition"] = 32] = "TypeDefinition";
|
|
14
|
+
UaBrowseMask[UaBrowseMask["All"] = 63] = "All";
|
|
15
|
+
})(UaBrowseMask || (exports.UaBrowseMask = UaBrowseMask = {}));
|
|
16
|
+
function isBrowseMaskRequired(mask, requiredMask) {
|
|
17
|
+
return (mask & requiredMask) === requiredMask;
|
|
18
|
+
}
|
|
@@ -97,7 +97,7 @@ const regexNamespaceS = /ns=([0-9]+);s=(.*)/;
|
|
|
97
97
|
const regexNamespaceB = /ns=([0-9]+);b=(.*)/;
|
|
98
98
|
const regexNamespaceG = /ns=([0-9]+);g=([0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12})/;
|
|
99
99
|
function parseUaNodeId(value) {
|
|
100
|
-
if (value.length <= 2)
|
|
100
|
+
if (!value || value.length <= 2)
|
|
101
101
|
throw new _1.UaError((0, _1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeIdInvalid));
|
|
102
102
|
let identifierType = UaNodeIdType.NUMERIC;
|
|
103
103
|
let idValue;
|
|
@@ -146,8 +146,6 @@ function parseUaNodeId(value) {
|
|
|
146
146
|
return new UaNodeId(idValue, nsIndex, identifierType);
|
|
147
147
|
}
|
|
148
148
|
function parseUaNodeIdOrNull(value) {
|
|
149
|
-
if (!value)
|
|
150
|
-
return null;
|
|
151
149
|
try {
|
|
152
150
|
return parseUaNodeId(value);
|
|
153
151
|
}
|
|
@@ -56,7 +56,7 @@ class UaQuery {
|
|
|
56
56
|
else if (item.operator >= opcua_webapi_1.FilterOperator.Equals && item.operator <= opcua_webapi_1.FilterOperator.InList) {
|
|
57
57
|
let query = UaQueryFilter_1.UaQueryFilter.fromContentFilterElement(item);
|
|
58
58
|
if (null == query)
|
|
59
|
-
return;
|
|
59
|
+
return null;
|
|
60
60
|
queryElements.set(index, query);
|
|
61
61
|
}
|
|
62
62
|
else if (item.operator == opcua_webapi_1.FilterOperator.Or) {
|
|
@@ -12,7 +12,7 @@ class UaStatusCode {
|
|
|
12
12
|
}
|
|
13
13
|
get name() {
|
|
14
14
|
if (null == UaStatusCode._codesDictionary) {
|
|
15
|
-
UaStatusCode._codesDictionary = new Map;
|
|
15
|
+
UaStatusCode._codesDictionary = new Map();
|
|
16
16
|
for (const key in opcua_webapi_1.StatusCodes) {
|
|
17
17
|
const value = opcua_webapi_1.StatusCodes[key];
|
|
18
18
|
UaStatusCode._codesDictionary.set(value, key);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaValueRank = void 0;
|
|
4
|
+
var UaValueRank;
|
|
5
|
+
(function (UaValueRank) {
|
|
6
|
+
UaValueRank[UaValueRank["OneDimension"] = 1] = "OneDimension";
|
|
7
|
+
UaValueRank[UaValueRank["OneOrMoreDimensions"] = 0] = "OneOrMoreDimensions";
|
|
8
|
+
UaValueRank[UaValueRank["Scalar"] = -1] = "Scalar";
|
|
9
|
+
UaValueRank[UaValueRank["Any"] = -2] = "Any";
|
|
10
|
+
UaValueRank[UaValueRank["ScalarOrOneDimension"] = -3] = "ScalarOrOneDimension";
|
|
11
|
+
})(UaValueRank || (exports.UaValueRank = UaValueRank = {}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UaWriteMask = void 0;
|
|
4
|
+
exports.isWriteMaskRequired = isWriteMaskRequired;
|
|
4
5
|
var UaWriteMask;
|
|
5
6
|
(function (UaWriteMask) {
|
|
6
7
|
UaWriteMask[UaWriteMask["AccessLevel"] = 1] = "AccessLevel";
|
|
@@ -30,3 +31,6 @@ var UaWriteMask;
|
|
|
30
31
|
UaWriteMask[UaWriteMask["AccessRestrictions"] = 16777216] = "AccessRestrictions";
|
|
31
32
|
UaWriteMask[UaWriteMask["AccessLevelEx"] = 33554432] = "AccessLevelEx";
|
|
32
33
|
})(UaWriteMask || (exports.UaWriteMask = UaWriteMask = {}));
|
|
34
|
+
function isWriteMaskRequired(mask, requiredMask) {
|
|
35
|
+
return (mask & requiredMask) === requiredMask;
|
|
36
|
+
}
|
|
@@ -31,4 +31,6 @@ __exportStar(require("./UaRequestPatameters"), exports);
|
|
|
31
31
|
__exportStar(require("./UaStatusCode"), exports);
|
|
32
32
|
__exportStar(require("./UaVariant"), exports);
|
|
33
33
|
__exportStar(require("./UaAccessLevel"), exports);
|
|
34
|
+
__exportStar(require("./UaBrowseMask"), exports);
|
|
35
|
+
__exportStar(require("./UaValueRank"), exports);
|
|
34
36
|
__exportStar(require("./UaWriteMask"), exports);
|
|
@@ -30,9 +30,10 @@ class UaWebClient {
|
|
|
30
30
|
let results = yield this.findServer(this.clientConfig.apiConfig.basePath, (applicationUris) ? applicationUris : []);
|
|
31
31
|
let ret = [];
|
|
32
32
|
for (let item of results) {
|
|
33
|
+
let applicationName = common_1.UaPayloadMapper.localizedTextFromWebApi(item.ApplicationName);
|
|
33
34
|
ret.push({
|
|
34
35
|
applicationUri: (item.ApplicationUri) ? item.ApplicationUri : "",
|
|
35
|
-
applicationName: common_1.
|
|
36
|
+
applicationName: (applicationName) ? applicationName : common_1.UaLocalizedText.nullText,
|
|
36
37
|
productUri: (item.ProductUri) ? item.ProductUri : "",
|
|
37
38
|
urls: (item.DiscoveryUrls) ? item.DiscoveryUrls : []
|
|
38
39
|
});
|
|
@@ -276,7 +277,9 @@ class UaWebClient {
|
|
|
276
277
|
let browseResult = results[0];
|
|
277
278
|
let ret = [];
|
|
278
279
|
for (let item of browseResult.results) {
|
|
279
|
-
|
|
280
|
+
let nodeId = item.nodeId.getNodeId();
|
|
281
|
+
if (nodeId)
|
|
282
|
+
ret.push(nodeId);
|
|
280
283
|
}
|
|
281
284
|
return ret;
|
|
282
285
|
});
|
|
@@ -284,13 +287,15 @@ class UaWebClient {
|
|
|
284
287
|
historyReadRawData(nodeId, startTime, endTime, numValuesPerNode, continuationPoint, returnBounds, isReadModified, timestampsToReturn, releaseContinuationPoints) {
|
|
285
288
|
return __awaiter(this, void 0, void 0, function* () {
|
|
286
289
|
let nodeToRead = new common_1.UaHistoryReadValueId(nodeId, continuationPoint);
|
|
287
|
-
let details = new common_2.UaReadRawModifiedDetails(startTime, endTime, numValuesPerNode, returnBounds, isReadModified);
|
|
290
|
+
let details = new common_2.UaReadRawModifiedDetails(startTime, endTime, (numValuesPerNode) ? numValuesPerNode : 0, (returnBounds) ? returnBounds : false, (isReadModified) ? isReadModified : false);
|
|
288
291
|
let historyReadDetails = details.toExtensionObject();
|
|
289
292
|
let nodesToRead = [nodeToRead];
|
|
290
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, timestampsToReturn, releaseContinuationPoints);
|
|
293
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Neither, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
291
294
|
if (results[0].statusCode.isNotGood())
|
|
292
295
|
throw new common_1.UaError(results[0].statusCode);
|
|
293
296
|
let extensionObject = results[0].historyData;
|
|
297
|
+
if (!extensionObject)
|
|
298
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
294
299
|
let historyData = common_1.UaHistoryData.fromExtensionObject(extensionObject);
|
|
295
300
|
if (null == historyData)
|
|
296
301
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
@@ -306,10 +311,12 @@ class UaWebClient {
|
|
|
306
311
|
let details = new common_2.UaReadAtTimeDetails(requiredTimes, useSimpleBounds);
|
|
307
312
|
let historyReadDetails = details.toExtensionObject();
|
|
308
313
|
let nodesToRead = [nodeToRead];
|
|
309
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, timestampsToReturn, releaseContinuationPoints);
|
|
314
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Neither, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
310
315
|
if (results[0].statusCode.isNotGood())
|
|
311
316
|
throw new common_1.UaError(results[0].statusCode);
|
|
312
317
|
let extensionObject = results[0].historyData;
|
|
318
|
+
if (!extensionObject)
|
|
319
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
313
320
|
let historyData = common_1.UaHistoryData.fromExtensionObject(extensionObject);
|
|
314
321
|
if (null == historyData)
|
|
315
322
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
@@ -328,14 +335,14 @@ class UaWebClient {
|
|
|
328
335
|
let selectedField = new common_1.UaSimpleAttributeOperand([item]);
|
|
329
336
|
selectClauses.push(selectedField);
|
|
330
337
|
}
|
|
331
|
-
let details = new common_1.UaReadEventDetails(startTime, endTime, new common_1.UaEventFilter(selectClauses, whereClauses), numValuesPerNode);
|
|
338
|
+
let details = new common_1.UaReadEventDetails(startTime, endTime, new common_1.UaEventFilter(selectClauses, whereClauses), (numValuesPerNode) ? numValuesPerNode : null);
|
|
332
339
|
let historyReadDetails = details.toExtensionObject();
|
|
333
340
|
let nodesToRead = [nodeToRead];
|
|
334
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, opcua_webapi_1.TimestampsToReturn.Both, releaseContinuationPoints);
|
|
341
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, opcua_webapi_1.TimestampsToReturn.Both, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
335
342
|
if (results[0].statusCode.isNotGood())
|
|
336
343
|
throw new common_1.UaError(results[0].statusCode);
|
|
337
344
|
let extensionObject = results[0].historyData;
|
|
338
|
-
let historyData = common_2.UaHistoryEvent.fromExtensionObject(extensionObject);
|
|
345
|
+
let historyData = (extensionObject) ? common_2.UaHistoryEvent.fromExtensionObject(extensionObject) : null;
|
|
339
346
|
if (null == historyData)
|
|
340
347
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
341
348
|
let ret = new common_2.UaHistoryEventResult(historyData.events, results[0].continuationPoint);
|
|
@@ -15,8 +15,8 @@ type BrowseResult = {
|
|
|
15
15
|
browseName: string;
|
|
16
16
|
displayName: UaLocalizedText;
|
|
17
17
|
referenceTypeId: UaNodeId;
|
|
18
|
-
isForward
|
|
19
|
-
typeDefinitionId?: UaNodeId
|
|
18
|
+
isForward?: boolean;
|
|
19
|
+
typeDefinitionId?: UaNodeId;
|
|
20
20
|
};
|
|
21
21
|
type ReadResult = {
|
|
22
22
|
parentId: UaNodeId;
|
|
@@ -61,11 +61,11 @@ class UaNodeReaderBase {
|
|
|
61
61
|
this._browseResults.push({
|
|
62
62
|
fromNodeId: currentNode.nodeId,
|
|
63
63
|
nodeId: nodeId,
|
|
64
|
-
nodeClass: item.nodeClass,
|
|
65
|
-
browseName: item.browseName,
|
|
66
|
-
displayName: item.displayName,
|
|
67
|
-
referenceTypeId: item.referenceTypeId,
|
|
68
|
-
isForward: item.isForward,
|
|
64
|
+
nodeClass: (item.nodeClass) ? item.nodeClass : opcua_webapi_1.NodeClass.Unspecified,
|
|
65
|
+
browseName: item.browseName ? item.browseName : "",
|
|
66
|
+
displayName: item.displayName ? item.displayName : common_1.UaLocalizedText.nullText,
|
|
67
|
+
referenceTypeId: item.referenceTypeId ? item.referenceTypeId : common_1.UaNodeId.nullNodeId,
|
|
68
|
+
isForward: (item.isForward) ? item.isForward : false,
|
|
69
69
|
typeDefinitionId: (typeDefinition) ? typeDefinition : undefined
|
|
70
70
|
});
|
|
71
71
|
this._updateNodesToBrowse(item);
|
|
@@ -1961,6 +1961,17 @@ export declare enum VariableIds {
|
|
|
1961
1961
|
DataTypeDescriptionType_DictionaryFragment = 105,
|
|
1962
1962
|
DataTypeDictionaryType_DataTypeVersion = 106,
|
|
1963
1963
|
DataTypeDictionaryType_NamespaceUri = 107,
|
|
1964
|
+
ServerType_ServerArray = 2005,
|
|
1965
|
+
ServerType_NamespaceArray = 2006,
|
|
1966
|
+
BaseEventType_EventId = 2042,
|
|
1967
|
+
BaseEventType_EventType = 2043,
|
|
1968
|
+
BaseEventType_SourceNode = 2044,
|
|
1969
|
+
BaseEventType_SourceName = 2045,
|
|
1970
|
+
BaseEventType_Time = 2046,
|
|
1971
|
+
BaseEventType_ReceiveTime = 2047,
|
|
1972
|
+
BaseEventType_LocalTime = 3190,
|
|
1973
|
+
BaseEventType_Message = 2050,
|
|
1974
|
+
BaseEventType_Severity = 2051,
|
|
1964
1975
|
Server_ServerArray = 2254,
|
|
1965
1976
|
Server_NamespaceArray = 2255,
|
|
1966
1977
|
Server_ServerStatus = 2256,
|
|
@@ -1993,6 +2004,8 @@ export declare enum VariableIds {
|
|
|
1993
2004
|
Server_ServerDiagnostics_SamplingIntervalDiagnosticsArray = 2289,
|
|
1994
2005
|
Server_ServerDiagnostics_SubscriptionDiagnosticsArray = 2290,
|
|
1995
2006
|
Server_ServerDiagnostics_EnabledFlag = 2294,
|
|
2007
|
+
DataItemType_Definition = 2366,
|
|
2008
|
+
DataItemType_ValuePrecision = 2367,
|
|
1996
2009
|
Server_ServerCapabilities_MaxBrowseContinuationPoints = 2735,
|
|
1997
2010
|
Server_ServerCapabilities_MaxQueryContinuationPoints = 2736,
|
|
1998
2011
|
Server_ServerCapabilities_MaxHistoryContinuationPoints = 2737,
|
|
@@ -2108,6 +2121,8 @@ export declare enum VariableIds {
|
|
|
2108
2121
|
OPCUANamespaceMetadata_DefaultUserRolePermissions = 16135,
|
|
2109
2122
|
OPCUANamespaceMetadata_DefaultAccessRestrictions = 16136,
|
|
2110
2123
|
PublishSubscribe_SupportedTransportProfiles = 17481,
|
|
2124
|
+
BaseAnalogType_EURange = 17568,
|
|
2125
|
+
BaseAnalogType_EngineeringUnits = 17569,
|
|
2111
2126
|
DefaultInstanceBrowseName = 17605,
|
|
2112
2127
|
Server_LocalTime = 17634,
|
|
2113
2128
|
HistoryServerCapabilities_ServerTimestampSupported = 19091,
|
|
@@ -1972,6 +1972,17 @@ var VariableIds;
|
|
|
1972
1972
|
VariableIds[VariableIds["DataTypeDescriptionType_DictionaryFragment"] = 105] = "DataTypeDescriptionType_DictionaryFragment";
|
|
1973
1973
|
VariableIds[VariableIds["DataTypeDictionaryType_DataTypeVersion"] = 106] = "DataTypeDictionaryType_DataTypeVersion";
|
|
1974
1974
|
VariableIds[VariableIds["DataTypeDictionaryType_NamespaceUri"] = 107] = "DataTypeDictionaryType_NamespaceUri";
|
|
1975
|
+
VariableIds[VariableIds["ServerType_ServerArray"] = 2005] = "ServerType_ServerArray";
|
|
1976
|
+
VariableIds[VariableIds["ServerType_NamespaceArray"] = 2006] = "ServerType_NamespaceArray";
|
|
1977
|
+
VariableIds[VariableIds["BaseEventType_EventId"] = 2042] = "BaseEventType_EventId";
|
|
1978
|
+
VariableIds[VariableIds["BaseEventType_EventType"] = 2043] = "BaseEventType_EventType";
|
|
1979
|
+
VariableIds[VariableIds["BaseEventType_SourceNode"] = 2044] = "BaseEventType_SourceNode";
|
|
1980
|
+
VariableIds[VariableIds["BaseEventType_SourceName"] = 2045] = "BaseEventType_SourceName";
|
|
1981
|
+
VariableIds[VariableIds["BaseEventType_Time"] = 2046] = "BaseEventType_Time";
|
|
1982
|
+
VariableIds[VariableIds["BaseEventType_ReceiveTime"] = 2047] = "BaseEventType_ReceiveTime";
|
|
1983
|
+
VariableIds[VariableIds["BaseEventType_LocalTime"] = 3190] = "BaseEventType_LocalTime";
|
|
1984
|
+
VariableIds[VariableIds["BaseEventType_Message"] = 2050] = "BaseEventType_Message";
|
|
1985
|
+
VariableIds[VariableIds["BaseEventType_Severity"] = 2051] = "BaseEventType_Severity";
|
|
1975
1986
|
VariableIds[VariableIds["Server_ServerArray"] = 2254] = "Server_ServerArray";
|
|
1976
1987
|
VariableIds[VariableIds["Server_NamespaceArray"] = 2255] = "Server_NamespaceArray";
|
|
1977
1988
|
VariableIds[VariableIds["Server_ServerStatus"] = 2256] = "Server_ServerStatus";
|
|
@@ -2004,6 +2015,8 @@ var VariableIds;
|
|
|
2004
2015
|
VariableIds[VariableIds["Server_ServerDiagnostics_SamplingIntervalDiagnosticsArray"] = 2289] = "Server_ServerDiagnostics_SamplingIntervalDiagnosticsArray";
|
|
2005
2016
|
VariableIds[VariableIds["Server_ServerDiagnostics_SubscriptionDiagnosticsArray"] = 2290] = "Server_ServerDiagnostics_SubscriptionDiagnosticsArray";
|
|
2006
2017
|
VariableIds[VariableIds["Server_ServerDiagnostics_EnabledFlag"] = 2294] = "Server_ServerDiagnostics_EnabledFlag";
|
|
2018
|
+
VariableIds[VariableIds["DataItemType_Definition"] = 2366] = "DataItemType_Definition";
|
|
2019
|
+
VariableIds[VariableIds["DataItemType_ValuePrecision"] = 2367] = "DataItemType_ValuePrecision";
|
|
2007
2020
|
VariableIds[VariableIds["Server_ServerCapabilities_MaxBrowseContinuationPoints"] = 2735] = "Server_ServerCapabilities_MaxBrowseContinuationPoints";
|
|
2008
2021
|
VariableIds[VariableIds["Server_ServerCapabilities_MaxQueryContinuationPoints"] = 2736] = "Server_ServerCapabilities_MaxQueryContinuationPoints";
|
|
2009
2022
|
VariableIds[VariableIds["Server_ServerCapabilities_MaxHistoryContinuationPoints"] = 2737] = "Server_ServerCapabilities_MaxHistoryContinuationPoints";
|
|
@@ -2119,6 +2132,8 @@ var VariableIds;
|
|
|
2119
2132
|
VariableIds[VariableIds["OPCUANamespaceMetadata_DefaultUserRolePermissions"] = 16135] = "OPCUANamespaceMetadata_DefaultUserRolePermissions";
|
|
2120
2133
|
VariableIds[VariableIds["OPCUANamespaceMetadata_DefaultAccessRestrictions"] = 16136] = "OPCUANamespaceMetadata_DefaultAccessRestrictions";
|
|
2121
2134
|
VariableIds[VariableIds["PublishSubscribe_SupportedTransportProfiles"] = 17481] = "PublishSubscribe_SupportedTransportProfiles";
|
|
2135
|
+
VariableIds[VariableIds["BaseAnalogType_EURange"] = 17568] = "BaseAnalogType_EURange";
|
|
2136
|
+
VariableIds[VariableIds["BaseAnalogType_EngineeringUnits"] = 17569] = "BaseAnalogType_EngineeringUnits";
|
|
2122
2137
|
VariableIds[VariableIds["DefaultInstanceBrowseName"] = 17605] = "DefaultInstanceBrowseName";
|
|
2123
2138
|
VariableIds[VariableIds["Server_LocalTime"] = 17634] = "Server_LocalTime";
|
|
2124
2139
|
VariableIds[VariableIds["HistoryServerCapabilities_ServerTimestampSupported"] = 19091] = "HistoryServerCapabilities_ServerTimestampSupported";
|
|
@@ -9,7 +9,7 @@ export declare class UaMethod extends UaInstanceNode {
|
|
|
9
9
|
private _outputArguments;
|
|
10
10
|
constructor(nodeId: UaNodeId, browseName: string, displayName: UaLocalizedText);
|
|
11
11
|
get nodeClass(): NodeClass;
|
|
12
|
-
addMember(node: UaVariable):
|
|
12
|
+
addMember(node: UaVariable): void;
|
|
13
13
|
get inputArguments(): Array<UaArgument> | null;
|
|
14
14
|
get outputArguments(): Array<UaArgument> | null;
|
|
15
15
|
toJson(): any;
|
|
@@ -26,12 +26,12 @@ class UaMethod extends _1.UaInstanceNode {
|
|
|
26
26
|
return;
|
|
27
27
|
let extensionObjects = node.value.toExtensionObjects();
|
|
28
28
|
if (null == extensionObjects)
|
|
29
|
-
return
|
|
29
|
+
return;
|
|
30
30
|
let args = [];
|
|
31
31
|
for (let item2 of extensionObjects) {
|
|
32
32
|
let argument = structure_1.UaArgument.fromExtensionObject(item2);
|
|
33
33
|
if (null == argument)
|
|
34
|
-
return
|
|
34
|
+
return;
|
|
35
35
|
args.push(argument);
|
|
36
36
|
}
|
|
37
37
|
if (isInputArgument) {
|
|
@@ -45,7 +45,7 @@ class UaBrowseResult {
|
|
|
45
45
|
references.push(reference);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
return new UaBrowseResult(references, browseResult.ContinuationPoint, (browseResult.StatusCode) ? (0, types_1.makeUaStatusCode)(browseResult.StatusCode.Code) : (0, types_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.Good));
|
|
48
|
+
return new UaBrowseResult(references, (browseResult.ContinuationPoint) ? browseResult.ContinuationPoint : null, (browseResult.StatusCode) ? (0, types_1.makeUaStatusCode)(browseResult.StatusCode.Code) : (0, types_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.Good));
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
exports.UaBrowseResult = UaBrowseResult;
|
|
@@ -28,12 +28,12 @@ class UaPayloadMapper {
|
|
|
28
28
|
static extensionObjectFromWebApi(json) {
|
|
29
29
|
try {
|
|
30
30
|
let extensionObject = (0, opcua_webapi_1.ExtensionObjectFromJSON)(json);
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
if (!extensionObject || !extensionObject.UaTypeId || !extensionObject.UaBody)
|
|
32
|
+
throw new types_1.UaError((0, types_1.makeUaStatusCode)(opcua_webapi_2.StatusCodes.BadDecodingError));
|
|
33
|
+
let typeId = (0, types_1.parseUaNodeId)(extensionObject.UaTypeId);
|
|
34
|
+
let jsonStr = atob(extensionObject.UaBody);
|
|
35
|
+
let body = JSON.parse(jsonStr);
|
|
36
|
+
return new types_2.UaExtensionObject(typeId, body);
|
|
37
37
|
}
|
|
38
38
|
catch (e) {
|
|
39
39
|
throw new types_1.UaError((0, types_1.makeUaStatusCode)(opcua_webapi_2.StatusCodes.BadDecodingError));
|
|
@@ -71,7 +71,7 @@ class UaPayloadMapper {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
|
-
if (value.every(item => typeof item === 'number')) {
|
|
74
|
+
if (value.every((item) => typeof item === 'number')) {
|
|
75
75
|
return types_2.UaVariant.integers(value, dataType);
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
@@ -89,7 +89,7 @@ class UaPayloadMapper {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
|
-
if (value.every(item => typeof item === 'number')) {
|
|
92
|
+
if (value.every((item) => typeof item === 'number')) {
|
|
93
93
|
return types_2.UaVariant.doubles(value);
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
@@ -107,7 +107,7 @@ class UaPayloadMapper {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
|
-
if (value.every(item => typeof item === 'number')) {
|
|
110
|
+
if (value.every((item) => typeof item === 'number')) {
|
|
111
111
|
return types_2.UaVariant.floats(value);
|
|
112
112
|
}
|
|
113
113
|
else {
|
|
@@ -125,7 +125,7 @@ class UaPayloadMapper {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
|
-
if (value.every(item => typeof item === 'boolean')) {
|
|
128
|
+
if (value.every((item) => typeof item === 'boolean')) {
|
|
129
129
|
return types_2.UaVariant.booleans(value);
|
|
130
130
|
}
|
|
131
131
|
else {
|
|
@@ -143,7 +143,7 @@ class UaPayloadMapper {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
else {
|
|
146
|
-
if (value.every(item => typeof item === 'string')) {
|
|
146
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
147
147
|
return types_2.UaVariant.strings(value);
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
@@ -161,7 +161,7 @@ class UaPayloadMapper {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
else {
|
|
164
|
-
if (value.every(item => typeof item === 'string')) {
|
|
164
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
165
165
|
let nodeIds = [];
|
|
166
166
|
for (let item of value) {
|
|
167
167
|
nodeIds.push((0, types_1.parseUaNodeId)(item));
|
|
@@ -183,7 +183,7 @@ class UaPayloadMapper {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
else {
|
|
186
|
-
if (value.every(item => typeof item === 'string')) {
|
|
186
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
187
187
|
let nodeIds = [];
|
|
188
188
|
for (let item of value) {
|
|
189
189
|
nodeIds.push((0, types_1.parseUaExpandedNodeId)(item));
|
|
@@ -205,7 +205,7 @@ class UaPayloadMapper {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
else {
|
|
208
|
-
if (value.every(item => typeof item === 'string')) {
|
|
208
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
209
209
|
let datetimes = [];
|
|
210
210
|
for (let item of value) {
|
|
211
211
|
datetimes.push(new Date(item));
|
|
@@ -227,7 +227,7 @@ class UaPayloadMapper {
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
else {
|
|
230
|
-
if (value.every(item => typeof item === 'string')) {
|
|
230
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
231
231
|
let byteStrings = [];
|
|
232
232
|
for (let item of value) {
|
|
233
233
|
byteStrings.push(item);
|
|
@@ -249,7 +249,7 @@ class UaPayloadMapper {
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
else {
|
|
252
|
-
if (value.every(item => typeof item === 'string')) {
|
|
252
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
253
253
|
let qualifiedNames = [];
|
|
254
254
|
for (let item of value) {
|
|
255
255
|
qualifiedNames.push(item);
|
|
@@ -271,7 +271,7 @@ class UaPayloadMapper {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
else {
|
|
274
|
-
if (value.every(item => typeof item === 'string')) {
|
|
274
|
+
if (value.every((item) => typeof item === 'string')) {
|
|
275
275
|
let guids = [];
|
|
276
276
|
for (let item of value) {
|
|
277
277
|
guids.push(item);
|
|
@@ -309,12 +309,20 @@ class UaPayloadMapper {
|
|
|
309
309
|
}
|
|
310
310
|
else if (types_1.UaVariantType.LocalizedText == dataType) {
|
|
311
311
|
if (!isArray) {
|
|
312
|
-
|
|
312
|
+
let localizedText = UaPayloadMapper.localizedTextFromWebApi(value);
|
|
313
|
+
if (!localizedText) {
|
|
314
|
+
throw new types_1.UaError((0, types_1.makeUaStatusCode)(opcua_webapi_2.StatusCodes.BadDecodingError));
|
|
315
|
+
}
|
|
316
|
+
return types_2.UaVariant.localizedText(localizedText);
|
|
313
317
|
}
|
|
314
318
|
else {
|
|
315
319
|
let localizedTexts = [];
|
|
316
320
|
for (let item of value) {
|
|
317
|
-
|
|
321
|
+
let localizedText = UaPayloadMapper.localizedTextFromWebApi(item);
|
|
322
|
+
if (!localizedText) {
|
|
323
|
+
throw new types_1.UaError((0, types_1.makeUaStatusCode)(opcua_webapi_2.StatusCodes.BadDecodingError));
|
|
324
|
+
}
|
|
325
|
+
localizedTexts.push(localizedText);
|
|
318
326
|
}
|
|
319
327
|
return types_2.UaVariant.localizedTexts(localizedTexts);
|
|
320
328
|
}
|
|
@@ -52,7 +52,7 @@ class UaReferenceDescription {
|
|
|
52
52
|
let displayName = (referenceDescription.DisplayName) ? _1.UaPayloadMapper.localizedTextFromWebApi(referenceDescription.DisplayName) : undefined;
|
|
53
53
|
let referenceTypeId = (referenceDescription.ReferenceTypeId) ? (0, types_1.parseUaNodeIdOrNull)(referenceDescription.ReferenceTypeId) : undefined;
|
|
54
54
|
let typeDefinition = (referenceDescription.TypeDefinition) ? (0, types_1.parseUaExpandedNodeIdOrNull)(referenceDescription.TypeDefinition) : undefined;
|
|
55
|
-
if (null
|
|
55
|
+
if (null === nodeId || null === displayName || null === referenceTypeId || null === typeDefinition)
|
|
56
56
|
return null;
|
|
57
57
|
return new UaReferenceDescription(nodeId, referenceDescription.NodeClass, referenceDescription.BrowseName, displayName, referenceTypeId, referenceDescription.IsForward, typeDefinition);
|
|
58
58
|
}
|
|
@@ -5,10 +5,10 @@ export declare class UaEnumValueType {
|
|
|
5
5
|
private _value;
|
|
6
6
|
private _displayName;
|
|
7
7
|
private _description;
|
|
8
|
-
constructor(value: number, displayName: UaLocalizedText, description: UaLocalizedText);
|
|
8
|
+
constructor(value: number, displayName: UaLocalizedText, description: UaLocalizedText | null);
|
|
9
9
|
get value(): number;
|
|
10
10
|
get displayName(): UaLocalizedText;
|
|
11
|
-
get description(): UaLocalizedText;
|
|
11
|
+
get description(): UaLocalizedText | null;
|
|
12
12
|
toStruct(): EnumValueType;
|
|
13
13
|
static fromStruct(enumValueType: EnumValueType): UaEnumValueType | null;
|
|
14
14
|
toExtensionObject(): UaExtensionObject;
|
|
@@ -24,14 +24,16 @@ class UaEnumValueType {
|
|
|
24
24
|
let enumValue = {
|
|
25
25
|
Value: this._value,
|
|
26
26
|
DisplayName: payload_1.UaPayloadMapper.localizedTextToWebApi(this._displayName),
|
|
27
|
-
Description: payload_1.UaPayloadMapper.localizedTextToWebApi(this._description)
|
|
27
|
+
Description: (null !== this._description) ? payload_1.UaPayloadMapper.localizedTextToWebApi(this._description) : undefined
|
|
28
28
|
};
|
|
29
29
|
return enumValue;
|
|
30
30
|
}
|
|
31
31
|
static fromStruct(enumValueType) {
|
|
32
|
-
let value =
|
|
32
|
+
let value = enumValueType.Value;
|
|
33
33
|
let displayName = payload_1.UaPayloadMapper.localizedTextFromWebApi(enumValueType.DisplayName);
|
|
34
34
|
let description = payload_1.UaPayloadMapper.localizedTextFromWebApi(enumValueType.Description);
|
|
35
|
+
if (typeof value !== "number" || null == displayName)
|
|
36
|
+
return null;
|
|
35
37
|
return new UaEnumValueType(value, displayName, description);
|
|
36
38
|
}
|
|
37
39
|
toExtensionObject() {
|
|
@@ -22,13 +22,13 @@ class UaRange {
|
|
|
22
22
|
}
|
|
23
23
|
toStruct() {
|
|
24
24
|
let range = {
|
|
25
|
-
Low: this._low,
|
|
26
|
-
High: this._high
|
|
25
|
+
Low: (null !== this._low) ? this._low : undefined,
|
|
26
|
+
High: (null !== this._high) ? this._high : undefined
|
|
27
27
|
};
|
|
28
28
|
return range;
|
|
29
29
|
}
|
|
30
30
|
static fromStruct(range) {
|
|
31
|
-
return new UaRange(range.Low, range.High);
|
|
31
|
+
return new UaRange((typeof range.Low === "number") ? range.Low : null, (typeof range.High === "number") ? range.High : null);
|
|
32
32
|
}
|
|
33
33
|
toExtensionObject() {
|
|
34
34
|
return new types_1.UaExtensionObject(UaRange.dataTypeId, (0, opcua_webapi_1.RangeToJSONTyped)(this.toStruct()));
|
|
@@ -7,7 +7,7 @@ export declare class UaReadEventDetails {
|
|
|
7
7
|
private _endTime;
|
|
8
8
|
private _filter;
|
|
9
9
|
private _numValuesPerNode;
|
|
10
|
-
constructor(startTime: Date, endTime: Date, filter: UaEventFilter, numValuesPerNode?: number);
|
|
10
|
+
constructor(startTime: Date, endTime: Date, filter: UaEventFilter, numValuesPerNode?: number | null);
|
|
11
11
|
get startTime(): Date;
|
|
12
12
|
get endTime(): Date;
|
|
13
13
|
get filter(): UaEventFilter;
|
|
@@ -8,9 +8,9 @@ class UaReadRawModifiedDetails {
|
|
|
8
8
|
constructor(startTime, endTime, numValuesPerNode, returnBounds, isReadModified) {
|
|
9
9
|
this._startTime = startTime;
|
|
10
10
|
this._endTime = endTime;
|
|
11
|
-
this._numValuesPerNode = (numValuesPerNode > 0) ? numValuesPerNode : 0;
|
|
12
|
-
this._returnBounds = (returnBounds) ? returnBounds :
|
|
13
|
-
this._isReadModified = (isReadModified) ? isReadModified :
|
|
11
|
+
this._numValuesPerNode = (numValuesPerNode && numValuesPerNode > 0) ? numValuesPerNode : 0;
|
|
12
|
+
this._returnBounds = (returnBounds) ? returnBounds : false;
|
|
13
|
+
this._isReadModified = (isReadModified) ? isReadModified : false;
|
|
14
14
|
}
|
|
15
15
|
get startTime() {
|
|
16
16
|
return this._startTime;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UaAccessLevel = void 0;
|
|
4
|
+
exports.isAccessible = isAccessible;
|
|
4
5
|
var UaAccessLevel;
|
|
5
6
|
(function (UaAccessLevel) {
|
|
6
7
|
UaAccessLevel[UaAccessLevel["None"] = 0] = "None";
|
|
@@ -12,3 +13,6 @@ var UaAccessLevel;
|
|
|
12
13
|
UaAccessLevel[UaAccessLevel["StatusWrite"] = 32] = "StatusWrite";
|
|
13
14
|
UaAccessLevel[UaAccessLevel["TimestampWrite"] = 64] = "TimestampWrite";
|
|
14
15
|
})(UaAccessLevel || (exports.UaAccessLevel = UaAccessLevel = {}));
|
|
16
|
+
function isAccessible(accessLevel, requiredAccessLevel) {
|
|
17
|
+
return (accessLevel & requiredAccessLevel) === requiredAccessLevel;
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum UaBrowseMask {
|
|
2
|
+
None = 0,
|
|
3
|
+
ReferenceTypeId = 1,
|
|
4
|
+
IsForward = 2,
|
|
5
|
+
NodeClass = 4,
|
|
6
|
+
BrowseName = 8,
|
|
7
|
+
DisplayName = 16,
|
|
8
|
+
TypeDefinition = 32,
|
|
9
|
+
All = 63
|
|
10
|
+
}
|
|
11
|
+
export declare function isBrowseMaskRequired(mask: number, requiredMask: UaBrowseMask): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaBrowseMask = void 0;
|
|
4
|
+
exports.isBrowseMaskRequired = isBrowseMaskRequired;
|
|
5
|
+
var UaBrowseMask;
|
|
6
|
+
(function (UaBrowseMask) {
|
|
7
|
+
UaBrowseMask[UaBrowseMask["None"] = 0] = "None";
|
|
8
|
+
UaBrowseMask[UaBrowseMask["ReferenceTypeId"] = 1] = "ReferenceTypeId";
|
|
9
|
+
UaBrowseMask[UaBrowseMask["IsForward"] = 2] = "IsForward";
|
|
10
|
+
UaBrowseMask[UaBrowseMask["NodeClass"] = 4] = "NodeClass";
|
|
11
|
+
UaBrowseMask[UaBrowseMask["BrowseName"] = 8] = "BrowseName";
|
|
12
|
+
UaBrowseMask[UaBrowseMask["DisplayName"] = 16] = "DisplayName";
|
|
13
|
+
UaBrowseMask[UaBrowseMask["TypeDefinition"] = 32] = "TypeDefinition";
|
|
14
|
+
UaBrowseMask[UaBrowseMask["All"] = 63] = "All";
|
|
15
|
+
})(UaBrowseMask || (exports.UaBrowseMask = UaBrowseMask = {}));
|
|
16
|
+
function isBrowseMaskRequired(mask, requiredMask) {
|
|
17
|
+
return (mask & requiredMask) === requiredMask;
|
|
18
|
+
}
|
|
@@ -20,5 +20,5 @@ export declare class UaNodeId {
|
|
|
20
20
|
equal(other: UaNodeId | null): boolean;
|
|
21
21
|
toString(): string;
|
|
22
22
|
}
|
|
23
|
-
export declare function parseUaNodeId(value: string): UaNodeId;
|
|
23
|
+
export declare function parseUaNodeId(value: string | null | undefined): UaNodeId;
|
|
24
24
|
export declare function parseUaNodeIdOrNull(value: string | null | undefined): UaNodeId | null;
|
|
@@ -97,7 +97,7 @@ const regexNamespaceS = /ns=([0-9]+);s=(.*)/;
|
|
|
97
97
|
const regexNamespaceB = /ns=([0-9]+);b=(.*)/;
|
|
98
98
|
const regexNamespaceG = /ns=([0-9]+);g=([0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12})/;
|
|
99
99
|
function parseUaNodeId(value) {
|
|
100
|
-
if (value.length <= 2)
|
|
100
|
+
if (!value || value.length <= 2)
|
|
101
101
|
throw new _1.UaError((0, _1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeIdInvalid));
|
|
102
102
|
let identifierType = UaNodeIdType.NUMERIC;
|
|
103
103
|
let idValue;
|
|
@@ -146,8 +146,6 @@ function parseUaNodeId(value) {
|
|
|
146
146
|
return new UaNodeId(idValue, nsIndex, identifierType);
|
|
147
147
|
}
|
|
148
148
|
function parseUaNodeIdOrNull(value) {
|
|
149
|
-
if (!value)
|
|
150
|
-
return null;
|
|
151
149
|
try {
|
|
152
150
|
return parseUaNodeId(value);
|
|
153
151
|
}
|
|
@@ -56,7 +56,7 @@ class UaQuery {
|
|
|
56
56
|
else if (item.operator >= opcua_webapi_1.FilterOperator.Equals && item.operator <= opcua_webapi_1.FilterOperator.InList) {
|
|
57
57
|
let query = UaQueryFilter_1.UaQueryFilter.fromContentFilterElement(item);
|
|
58
58
|
if (null == query)
|
|
59
|
-
return;
|
|
59
|
+
return null;
|
|
60
60
|
queryElements.set(index, query);
|
|
61
61
|
}
|
|
62
62
|
else if (item.operator == opcua_webapi_1.FilterOperator.Or) {
|
|
@@ -12,7 +12,7 @@ class UaStatusCode {
|
|
|
12
12
|
}
|
|
13
13
|
get name() {
|
|
14
14
|
if (null == UaStatusCode._codesDictionary) {
|
|
15
|
-
UaStatusCode._codesDictionary = new Map;
|
|
15
|
+
UaStatusCode._codesDictionary = new Map();
|
|
16
16
|
for (const key in opcua_webapi_1.StatusCodes) {
|
|
17
17
|
const value = opcua_webapi_1.StatusCodes[key];
|
|
18
18
|
UaStatusCode._codesDictionary.set(value, key);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaValueRank = void 0;
|
|
4
|
+
var UaValueRank;
|
|
5
|
+
(function (UaValueRank) {
|
|
6
|
+
UaValueRank[UaValueRank["OneDimension"] = 1] = "OneDimension";
|
|
7
|
+
UaValueRank[UaValueRank["OneOrMoreDimensions"] = 0] = "OneOrMoreDimensions";
|
|
8
|
+
UaValueRank[UaValueRank["Scalar"] = -1] = "Scalar";
|
|
9
|
+
UaValueRank[UaValueRank["Any"] = -2] = "Any";
|
|
10
|
+
UaValueRank[UaValueRank["ScalarOrOneDimension"] = -3] = "ScalarOrOneDimension";
|
|
11
|
+
})(UaValueRank || (exports.UaValueRank = UaValueRank = {}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UaWriteMask = void 0;
|
|
4
|
+
exports.isWriteMaskRequired = isWriteMaskRequired;
|
|
4
5
|
var UaWriteMask;
|
|
5
6
|
(function (UaWriteMask) {
|
|
6
7
|
UaWriteMask[UaWriteMask["AccessLevel"] = 1] = "AccessLevel";
|
|
@@ -30,3 +31,6 @@ var UaWriteMask;
|
|
|
30
31
|
UaWriteMask[UaWriteMask["AccessRestrictions"] = 16777216] = "AccessRestrictions";
|
|
31
32
|
UaWriteMask[UaWriteMask["AccessLevelEx"] = 33554432] = "AccessLevelEx";
|
|
32
33
|
})(UaWriteMask || (exports.UaWriteMask = UaWriteMask = {}));
|
|
34
|
+
function isWriteMaskRequired(mask, requiredMask) {
|
|
35
|
+
return (mask & requiredMask) === requiredMask;
|
|
36
|
+
}
|
|
@@ -31,4 +31,6 @@ __exportStar(require("./UaRequestPatameters"), exports);
|
|
|
31
31
|
__exportStar(require("./UaStatusCode"), exports);
|
|
32
32
|
__exportStar(require("./UaVariant"), exports);
|
|
33
33
|
__exportStar(require("./UaAccessLevel"), exports);
|
|
34
|
+
__exportStar(require("./UaBrowseMask"), exports);
|
|
35
|
+
__exportStar(require("./UaValueRank"), exports);
|
|
34
36
|
__exportStar(require("./UaWriteMask"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opcua-webapi-ts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "Provides OPC UA WebAPI wrapper and client based on opcua-webapi-typescript",
|
|
5
5
|
"author": "DingYan",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
"dev": "ts-node-dev --no-notify --respawn --transpile-only test/test"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"opcua-webapi": "^1.504.2"
|
|
19
|
-
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"typescript": "^4.0 || ^5.0"
|
|
18
|
+
"opcua-webapi": "^1.504.2",
|
|
19
|
+
"typescript": "^6.0.2"
|
|
22
20
|
}
|
|
23
21
|
}
|