opcua-webapi-ts 1.0.23 → 1.0.24
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 +7 -5
- package/dist/cjs/common/payload/UaCallMethodRequest.js +5 -3
- package/dist/cjs/common/payload/UaCallMethodResult.js +4 -2
- package/dist/cjs/common/payload/UaHistoryReadResult.d.ts +3 -3
- package/dist/cjs/common/payload/UaHistoryReadResult.js +4 -1
- package/dist/cjs/common/payload/UaPayloadMapper.js +2 -2
- package/dist/client/UaWebClient.js +7 -5
- package/dist/common/payload/UaCallMethodRequest.js +5 -3
- package/dist/common/payload/UaCallMethodResult.js +4 -2
- package/dist/common/payload/UaHistoryReadResult.d.ts +3 -3
- package/dist/common/payload/UaHistoryReadResult.js +4 -1
- package/dist/common/payload/UaPayloadMapper.js +2 -2
- package/package.json +1 -1
|
@@ -364,11 +364,13 @@ class UaWebClient {
|
|
|
364
364
|
if (!response.Results || nodesToBrowse.length != response.Results.length)
|
|
365
365
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
366
366
|
let results = [];
|
|
367
|
-
|
|
368
|
-
let
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
367
|
+
if (response.Results) {
|
|
368
|
+
for (let item of response.Results) {
|
|
369
|
+
let result = common_1.UaBrowseResult.fromStruct(item);
|
|
370
|
+
if (null == result)
|
|
371
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
372
|
+
results.push(result);
|
|
373
|
+
}
|
|
372
374
|
}
|
|
373
375
|
return results;
|
|
374
376
|
});
|
|
@@ -37,9 +37,11 @@ class UaCallMethodRequest {
|
|
|
37
37
|
let inputArguments = [];
|
|
38
38
|
if (null == objectId || null == methodId)
|
|
39
39
|
return null;
|
|
40
|
-
|
|
41
|
-
let
|
|
42
|
-
|
|
40
|
+
if (callMethodRequest.InputArguments) {
|
|
41
|
+
for (let item of callMethodRequest.InputArguments) {
|
|
42
|
+
let variant = _1.UaPayloadMapper.variantFromWebApi(item);
|
|
43
|
+
inputArguments.push(variant);
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
46
|
return new UaCallMethodRequest(objectId, methodId, inputArguments);
|
|
45
47
|
}
|
|
@@ -42,8 +42,10 @@ class UaCallMethodResult {
|
|
|
42
42
|
static fromStruct(callMethodResult) {
|
|
43
43
|
let statusCode = _1.UaPayloadMapper.statusCodeFromWebApi(callMethodResult.StatusCode);
|
|
44
44
|
let outputArguments = [];
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
if (callMethodResult.OutputArguments) {
|
|
46
|
+
for (let item of callMethodResult.OutputArguments) {
|
|
47
|
+
outputArguments.push(_1.UaPayloadMapper.variantFromWebApi(item));
|
|
48
|
+
}
|
|
47
49
|
}
|
|
48
50
|
let inputArgumentResults = undefined;
|
|
49
51
|
if (callMethodResult.InputArgumentResults) {
|
|
@@ -3,11 +3,11 @@ import { UaExtensionObject, UaNodeId, UaStatusCode } from "../types";
|
|
|
3
3
|
export declare class UaHistoryReadResult {
|
|
4
4
|
static dataTypeId: UaNodeId;
|
|
5
5
|
private _statusCode;
|
|
6
|
-
private _historyData
|
|
6
|
+
private _historyData?;
|
|
7
7
|
private _continuationPoint?;
|
|
8
|
-
constructor(statusCode: UaStatusCode, historyData
|
|
8
|
+
constructor(statusCode: UaStatusCode, historyData?: UaExtensionObject, continuationPoint?: string);
|
|
9
9
|
get statusCode(): UaStatusCode;
|
|
10
|
-
get historyData(): UaExtensionObject;
|
|
10
|
+
get historyData(): UaExtensionObject | undefined;
|
|
11
11
|
get continuationPoint(): string | undefined;
|
|
12
12
|
toStruct(): HistoryReadResult;
|
|
13
13
|
static fromStruct(historyReadResult: HistoryReadResult): UaHistoryReadResult | null;
|
|
@@ -29,8 +29,11 @@ class UaHistoryReadResult {
|
|
|
29
29
|
}
|
|
30
30
|
static fromStruct(historyReadResult) {
|
|
31
31
|
let statusCode = _1.UaPayloadMapper.statusCodeFromWebApi(historyReadResult.StatusCode);
|
|
32
|
-
let historyData =
|
|
32
|
+
let historyData = undefined;
|
|
33
33
|
let continuationPoint = historyReadResult.ContinuationPoint;
|
|
34
|
+
if (historyReadResult.HistoryData) {
|
|
35
|
+
historyData = _1.UaPayloadMapper.extensionObjectFromWebApi(historyReadResult.HistoryData);
|
|
36
|
+
}
|
|
34
37
|
return new UaHistoryReadResult(statusCode, historyData, continuationPoint);
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -15,9 +15,9 @@ class UaPayloadMapper {
|
|
|
15
15
|
return { Code: statusCode.value };
|
|
16
16
|
}
|
|
17
17
|
static localizedTextFromWebApi(text) {
|
|
18
|
-
if (!text
|
|
18
|
+
if (!text)
|
|
19
19
|
return null;
|
|
20
|
-
return new types_2.UaLocalizedText(text.Text, text.Locale);
|
|
20
|
+
return new types_2.UaLocalizedText((text.Text) ? text.Text : "", (text.Locale) ? text.Locale : undefined);
|
|
21
21
|
}
|
|
22
22
|
static localizedTextToWebApi(text) {
|
|
23
23
|
return {
|
|
@@ -364,11 +364,13 @@ class UaWebClient {
|
|
|
364
364
|
if (!response.Results || nodesToBrowse.length != response.Results.length)
|
|
365
365
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
366
366
|
let results = [];
|
|
367
|
-
|
|
368
|
-
let
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
367
|
+
if (response.Results) {
|
|
368
|
+
for (let item of response.Results) {
|
|
369
|
+
let result = common_1.UaBrowseResult.fromStruct(item);
|
|
370
|
+
if (null == result)
|
|
371
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
372
|
+
results.push(result);
|
|
373
|
+
}
|
|
372
374
|
}
|
|
373
375
|
return results;
|
|
374
376
|
});
|
|
@@ -37,9 +37,11 @@ class UaCallMethodRequest {
|
|
|
37
37
|
let inputArguments = [];
|
|
38
38
|
if (null == objectId || null == methodId)
|
|
39
39
|
return null;
|
|
40
|
-
|
|
41
|
-
let
|
|
42
|
-
|
|
40
|
+
if (callMethodRequest.InputArguments) {
|
|
41
|
+
for (let item of callMethodRequest.InputArguments) {
|
|
42
|
+
let variant = _1.UaPayloadMapper.variantFromWebApi(item);
|
|
43
|
+
inputArguments.push(variant);
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
46
|
return new UaCallMethodRequest(objectId, methodId, inputArguments);
|
|
45
47
|
}
|
|
@@ -42,8 +42,10 @@ class UaCallMethodResult {
|
|
|
42
42
|
static fromStruct(callMethodResult) {
|
|
43
43
|
let statusCode = _1.UaPayloadMapper.statusCodeFromWebApi(callMethodResult.StatusCode);
|
|
44
44
|
let outputArguments = [];
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
if (callMethodResult.OutputArguments) {
|
|
46
|
+
for (let item of callMethodResult.OutputArguments) {
|
|
47
|
+
outputArguments.push(_1.UaPayloadMapper.variantFromWebApi(item));
|
|
48
|
+
}
|
|
47
49
|
}
|
|
48
50
|
let inputArgumentResults = undefined;
|
|
49
51
|
if (callMethodResult.InputArgumentResults) {
|
|
@@ -3,11 +3,11 @@ import { UaExtensionObject, UaNodeId, UaStatusCode } from "../types";
|
|
|
3
3
|
export declare class UaHistoryReadResult {
|
|
4
4
|
static dataTypeId: UaNodeId;
|
|
5
5
|
private _statusCode;
|
|
6
|
-
private _historyData
|
|
6
|
+
private _historyData?;
|
|
7
7
|
private _continuationPoint?;
|
|
8
|
-
constructor(statusCode: UaStatusCode, historyData
|
|
8
|
+
constructor(statusCode: UaStatusCode, historyData?: UaExtensionObject, continuationPoint?: string);
|
|
9
9
|
get statusCode(): UaStatusCode;
|
|
10
|
-
get historyData(): UaExtensionObject;
|
|
10
|
+
get historyData(): UaExtensionObject | undefined;
|
|
11
11
|
get continuationPoint(): string | undefined;
|
|
12
12
|
toStruct(): HistoryReadResult;
|
|
13
13
|
static fromStruct(historyReadResult: HistoryReadResult): UaHistoryReadResult | null;
|
|
@@ -29,8 +29,11 @@ class UaHistoryReadResult {
|
|
|
29
29
|
}
|
|
30
30
|
static fromStruct(historyReadResult) {
|
|
31
31
|
let statusCode = _1.UaPayloadMapper.statusCodeFromWebApi(historyReadResult.StatusCode);
|
|
32
|
-
let historyData =
|
|
32
|
+
let historyData = undefined;
|
|
33
33
|
let continuationPoint = historyReadResult.ContinuationPoint;
|
|
34
|
+
if (historyReadResult.HistoryData) {
|
|
35
|
+
historyData = _1.UaPayloadMapper.extensionObjectFromWebApi(historyReadResult.HistoryData);
|
|
36
|
+
}
|
|
34
37
|
return new UaHistoryReadResult(statusCode, historyData, continuationPoint);
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -15,9 +15,9 @@ class UaPayloadMapper {
|
|
|
15
15
|
return { Code: statusCode.value };
|
|
16
16
|
}
|
|
17
17
|
static localizedTextFromWebApi(text) {
|
|
18
|
-
if (!text
|
|
18
|
+
if (!text)
|
|
19
19
|
return null;
|
|
20
|
-
return new types_2.UaLocalizedText(text.Text, text.Locale);
|
|
20
|
+
return new types_2.UaLocalizedText((text.Text) ? text.Text : "", (text.Locale) ? text.Locale : undefined);
|
|
21
21
|
}
|
|
22
22
|
static localizedTextToWebApi(text) {
|
|
23
23
|
return {
|