opcua-webapi-ts 1.1.4 → 1.1.5
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 +24 -2
- package/dist/cjs/common/structure/UaReadProcessedDetails.js +70 -0
- package/dist/cjs/common/structure/index.js +2 -1
- package/dist/client/UaWebClient.d.ts +1 -0
- package/dist/client/UaWebClient.js +24 -2
- package/dist/common/structure/UaReadProcessedDetails.d.ts +18 -0
- package/dist/common/structure/UaReadProcessedDetails.js +70 -0
- package/dist/common/structure/index.d.ts +2 -1
- package/dist/common/structure/index.js +2 -1
- package/package.json +1 -1
|
@@ -288,7 +288,7 @@ class UaWebClient {
|
|
|
288
288
|
let details = new common_2.UaReadRawModifiedDetails(startTime, endTime, (numValuesPerNode) ? numValuesPerNode : 0, (returnBounds) ? returnBounds : false, (isReadModified) ? isReadModified : false);
|
|
289
289
|
let historyReadDetails = details.toExtensionObject();
|
|
290
290
|
let nodesToRead = [nodeToRead];
|
|
291
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.
|
|
291
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Both, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
292
292
|
if (results[0].statusCode.isNotGood())
|
|
293
293
|
throw new common_1.UaError(results[0].statusCode);
|
|
294
294
|
let extensionObject = results[0].historyData;
|
|
@@ -309,7 +309,29 @@ class UaWebClient {
|
|
|
309
309
|
let details = new common_2.UaReadAtTimeDetails(requiredTimes, useSimpleBounds);
|
|
310
310
|
let historyReadDetails = details.toExtensionObject();
|
|
311
311
|
let nodesToRead = [nodeToRead];
|
|
312
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.
|
|
312
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Both, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
313
|
+
if (results[0].statusCode.isNotGood())
|
|
314
|
+
throw new common_1.UaError(results[0].statusCode);
|
|
315
|
+
let extensionObject = results[0].historyData;
|
|
316
|
+
if (!extensionObject)
|
|
317
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
318
|
+
let historyData = common_1.UaHistoryData.fromExtensionObject(extensionObject);
|
|
319
|
+
if (null == historyData)
|
|
320
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
321
|
+
let ret = new common_1.UaHistoryDataResult(historyData.dataValues, results[0].continuationPoint);
|
|
322
|
+
return ret;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
historyReadProcessed(nodeId, startTime, endTime, processingInterval, aggregateType, continuationPoint, timestampsToReturn, releaseContinuationPoints) {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
+
let nodeToRead = new common_1.UaHistoryReadValueId(nodeId, continuationPoint);
|
|
328
|
+
let aggregateTypeId = (aggregateType) ?
|
|
329
|
+
aggregateType :
|
|
330
|
+
common_1.UaNodeId.from(common_1.ObjectIds.AggregateFunction_Interpolative);
|
|
331
|
+
let details = new common_1.UaReadProcessedDetails(startTime, endTime, processingInterval, [aggregateTypeId]);
|
|
332
|
+
let historyReadDetails = details.toExtensionObject();
|
|
333
|
+
let nodesToRead = [nodeToRead];
|
|
334
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Both, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
313
335
|
if (results[0].statusCode.isNotGood())
|
|
314
336
|
throw new common_1.UaError(results[0].statusCode);
|
|
315
337
|
let extensionObject = results[0].historyData;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaReadProcessedDetails = void 0;
|
|
4
|
+
const opcua_webapi_1 = require("opcua-webapi");
|
|
5
|
+
const nodes_1 = require("../nodes");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
class UaReadProcessedDetails {
|
|
8
|
+
constructor(startTime, endTime, processingInterval, aggregateType) {
|
|
9
|
+
this._startTime = startTime;
|
|
10
|
+
this._endTime = endTime;
|
|
11
|
+
this._processingInterval = processingInterval;
|
|
12
|
+
this._aggregateType = (aggregateType) ? aggregateType : null;
|
|
13
|
+
}
|
|
14
|
+
get startTime() {
|
|
15
|
+
return this._startTime;
|
|
16
|
+
}
|
|
17
|
+
get endTime() {
|
|
18
|
+
return this._endTime;
|
|
19
|
+
}
|
|
20
|
+
get processingInterval() {
|
|
21
|
+
return this._processingInterval;
|
|
22
|
+
}
|
|
23
|
+
get aggregateType() {
|
|
24
|
+
return this._aggregateType;
|
|
25
|
+
}
|
|
26
|
+
toStruct() {
|
|
27
|
+
let aggregateType = [];
|
|
28
|
+
if (this._aggregateType) {
|
|
29
|
+
for (let item of this._aggregateType) {
|
|
30
|
+
aggregateType.push(item.toString());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let details = {
|
|
34
|
+
StartTime: this.startTime,
|
|
35
|
+
EndTime: this.endTime,
|
|
36
|
+
ProcessingInterval: this.processingInterval,
|
|
37
|
+
AggregateType: aggregateType
|
|
38
|
+
};
|
|
39
|
+
return details;
|
|
40
|
+
}
|
|
41
|
+
static fromStruct(details) {
|
|
42
|
+
let startTime = details.StartTime;
|
|
43
|
+
let endTime = details.EndTime;
|
|
44
|
+
let processingInterval = details.ProcessingInterval;
|
|
45
|
+
let aggregateType = null;
|
|
46
|
+
if (details.AggregateType && details.AggregateType.length > 0) {
|
|
47
|
+
aggregateType = [];
|
|
48
|
+
for (let item of details.AggregateType) {
|
|
49
|
+
let aggregateTypeId = (0, types_1.parseUaNodeIdOrNull)(item);
|
|
50
|
+
if (null == aggregateTypeId)
|
|
51
|
+
continue;
|
|
52
|
+
aggregateType.push(aggregateTypeId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (null == startTime || null == endTime || null == processingInterval)
|
|
56
|
+
return null;
|
|
57
|
+
return new UaReadProcessedDetails(startTime, endTime, processingInterval, aggregateType);
|
|
58
|
+
}
|
|
59
|
+
toExtensionObject() {
|
|
60
|
+
return new types_1.UaExtensionObject(UaReadProcessedDetails.dataTypeId, (0, opcua_webapi_1.ReadProcessedDetailsToJSONTyped)(this.toStruct()));
|
|
61
|
+
}
|
|
62
|
+
static fromExtensionObject(extensionObject) {
|
|
63
|
+
if (!UaReadProcessedDetails.dataTypeId.equal(extensionObject.typeId))
|
|
64
|
+
return null;
|
|
65
|
+
let details = (0, opcua_webapi_1.ReadProcessedDetailsFromJSON)(extensionObject.body);
|
|
66
|
+
return UaReadProcessedDetails.fromStruct(details);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.UaReadProcessedDetails = UaReadProcessedDetails;
|
|
70
|
+
UaReadProcessedDetails.dataTypeId = new types_1.UaNodeId(nodes_1.DataTypeIds.ReadProcessedDetails);
|
|
@@ -26,6 +26,7 @@ __exportStar(require("./UaHistoryEvent"), exports);
|
|
|
26
26
|
__exportStar(require("./UaLiteralOperand"), exports);
|
|
27
27
|
__exportStar(require("./UaRange"), exports);
|
|
28
28
|
__exportStar(require("./UaReadAtTimeDetails"), exports);
|
|
29
|
-
__exportStar(require("./UaReadEventDetails"), exports);
|
|
30
29
|
__exportStar(require("./UaReadRawModifiedDetails"), exports);
|
|
30
|
+
__exportStar(require("./UaReadProcessedDetails"), exports);
|
|
31
|
+
__exportStar(require("./UaReadEventDetails"), exports);
|
|
31
32
|
__exportStar(require("./UaSimpleAttributeOperand"), exports);
|
|
@@ -22,6 +22,7 @@ export declare class UaWebClient {
|
|
|
22
22
|
getGeneratedEventType(typeId: UaNodeId): Promise<Array<UaNodeId>>;
|
|
23
23
|
historyReadRawData(nodeId: UaNodeId, startTime: Date, endTime: Date, numValuesPerNode?: number | null, continuationPoint?: string | null, returnBounds?: boolean | null, isReadModified?: boolean | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
|
|
24
24
|
historyReadAtTime(nodeId: UaNodeId, requiredTimes: Array<Date>, useSimpleBounds?: boolean | null, continuationPoint?: string | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
|
|
25
|
+
historyReadProcessed(nodeId: UaNodeId, startTime: Date, endTime: Date, processingInterval: number, aggregateType?: UaNodeId | null, continuationPoint?: string | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
|
|
25
26
|
historyReadEvent(nodeId: UaNodeId, startTime: Date, endTime: Date, select: Array<string>, where?: UaQuery | null, numValuesPerNode?: number | null, continuationPoint?: string | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryEventResult>;
|
|
26
27
|
browse(nodesToBrowse: Array<UaBrowseDescription>, maxReferencesPerNode?: number, view?: ViewDescription, additionalParameters?: UaClientParameters): Promise<Array<UaBrowseResult>>;
|
|
27
28
|
browseNext(continuationPoints: Array<string>, releaseContinuationPoints: boolean, additionalParameters?: UaClientParameters): Promise<Array<UaBrowseResult>>;
|
|
@@ -288,7 +288,7 @@ class UaWebClient {
|
|
|
288
288
|
let details = new common_2.UaReadRawModifiedDetails(startTime, endTime, (numValuesPerNode) ? numValuesPerNode : 0, (returnBounds) ? returnBounds : false, (isReadModified) ? isReadModified : false);
|
|
289
289
|
let historyReadDetails = details.toExtensionObject();
|
|
290
290
|
let nodesToRead = [nodeToRead];
|
|
291
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.
|
|
291
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Both, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
292
292
|
if (results[0].statusCode.isNotGood())
|
|
293
293
|
throw new common_1.UaError(results[0].statusCode);
|
|
294
294
|
let extensionObject = results[0].historyData;
|
|
@@ -309,7 +309,29 @@ class UaWebClient {
|
|
|
309
309
|
let details = new common_2.UaReadAtTimeDetails(requiredTimes, useSimpleBounds);
|
|
310
310
|
let historyReadDetails = details.toExtensionObject();
|
|
311
311
|
let nodesToRead = [nodeToRead];
|
|
312
|
-
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.
|
|
312
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Both, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
313
|
+
if (results[0].statusCode.isNotGood())
|
|
314
|
+
throw new common_1.UaError(results[0].statusCode);
|
|
315
|
+
let extensionObject = results[0].historyData;
|
|
316
|
+
if (!extensionObject)
|
|
317
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
318
|
+
let historyData = common_1.UaHistoryData.fromExtensionObject(extensionObject);
|
|
319
|
+
if (null == historyData)
|
|
320
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
321
|
+
let ret = new common_1.UaHistoryDataResult(historyData.dataValues, results[0].continuationPoint);
|
|
322
|
+
return ret;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
historyReadProcessed(nodeId, startTime, endTime, processingInterval, aggregateType, continuationPoint, timestampsToReturn, releaseContinuationPoints) {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
+
let nodeToRead = new common_1.UaHistoryReadValueId(nodeId, continuationPoint);
|
|
328
|
+
let aggregateTypeId = (aggregateType) ?
|
|
329
|
+
aggregateType :
|
|
330
|
+
common_1.UaNodeId.from(common_1.ObjectIds.AggregateFunction_Interpolative);
|
|
331
|
+
let details = new common_1.UaReadProcessedDetails(startTime, endTime, processingInterval, [aggregateTypeId]);
|
|
332
|
+
let historyReadDetails = details.toExtensionObject();
|
|
333
|
+
let nodesToRead = [nodeToRead];
|
|
334
|
+
let results = yield this.historyRead(nodesToRead, historyReadDetails, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Both, (releaseContinuationPoints) ? releaseContinuationPoints : false);
|
|
313
335
|
if (results[0].statusCode.isNotGood())
|
|
314
336
|
throw new common_1.UaError(results[0].statusCode);
|
|
315
337
|
let extensionObject = results[0].historyData;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReadProcessedDetails } from "opcua-webapi";
|
|
2
|
+
import { UaExtensionObject, UaNodeId } from "../types";
|
|
3
|
+
export declare class UaReadProcessedDetails {
|
|
4
|
+
static dataTypeId: UaNodeId;
|
|
5
|
+
private _startTime;
|
|
6
|
+
private _endTime;
|
|
7
|
+
private _processingInterval;
|
|
8
|
+
private _aggregateType;
|
|
9
|
+
constructor(startTime: Date, endTime: Date, processingInterval: number, aggregateType?: Array<UaNodeId> | null);
|
|
10
|
+
get startTime(): Date;
|
|
11
|
+
get endTime(): Date;
|
|
12
|
+
get processingInterval(): number;
|
|
13
|
+
get aggregateType(): Array<UaNodeId> | null;
|
|
14
|
+
toStruct(): ReadProcessedDetails;
|
|
15
|
+
static fromStruct(details: ReadProcessedDetails): UaReadProcessedDetails | null;
|
|
16
|
+
toExtensionObject(): UaExtensionObject;
|
|
17
|
+
static fromExtensionObject(extensionObject: UaExtensionObject): UaReadProcessedDetails | null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UaReadProcessedDetails = void 0;
|
|
4
|
+
const opcua_webapi_1 = require("opcua-webapi");
|
|
5
|
+
const nodes_1 = require("../nodes");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
class UaReadProcessedDetails {
|
|
8
|
+
constructor(startTime, endTime, processingInterval, aggregateType) {
|
|
9
|
+
this._startTime = startTime;
|
|
10
|
+
this._endTime = endTime;
|
|
11
|
+
this._processingInterval = processingInterval;
|
|
12
|
+
this._aggregateType = (aggregateType) ? aggregateType : null;
|
|
13
|
+
}
|
|
14
|
+
get startTime() {
|
|
15
|
+
return this._startTime;
|
|
16
|
+
}
|
|
17
|
+
get endTime() {
|
|
18
|
+
return this._endTime;
|
|
19
|
+
}
|
|
20
|
+
get processingInterval() {
|
|
21
|
+
return this._processingInterval;
|
|
22
|
+
}
|
|
23
|
+
get aggregateType() {
|
|
24
|
+
return this._aggregateType;
|
|
25
|
+
}
|
|
26
|
+
toStruct() {
|
|
27
|
+
let aggregateType = [];
|
|
28
|
+
if (this._aggregateType) {
|
|
29
|
+
for (let item of this._aggregateType) {
|
|
30
|
+
aggregateType.push(item.toString());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let details = {
|
|
34
|
+
StartTime: this.startTime,
|
|
35
|
+
EndTime: this.endTime,
|
|
36
|
+
ProcessingInterval: this.processingInterval,
|
|
37
|
+
AggregateType: aggregateType
|
|
38
|
+
};
|
|
39
|
+
return details;
|
|
40
|
+
}
|
|
41
|
+
static fromStruct(details) {
|
|
42
|
+
let startTime = details.StartTime;
|
|
43
|
+
let endTime = details.EndTime;
|
|
44
|
+
let processingInterval = details.ProcessingInterval;
|
|
45
|
+
let aggregateType = null;
|
|
46
|
+
if (details.AggregateType && details.AggregateType.length > 0) {
|
|
47
|
+
aggregateType = [];
|
|
48
|
+
for (let item of details.AggregateType) {
|
|
49
|
+
let aggregateTypeId = (0, types_1.parseUaNodeIdOrNull)(item);
|
|
50
|
+
if (null == aggregateTypeId)
|
|
51
|
+
continue;
|
|
52
|
+
aggregateType.push(aggregateTypeId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (null == startTime || null == endTime || null == processingInterval)
|
|
56
|
+
return null;
|
|
57
|
+
return new UaReadProcessedDetails(startTime, endTime, processingInterval, aggregateType);
|
|
58
|
+
}
|
|
59
|
+
toExtensionObject() {
|
|
60
|
+
return new types_1.UaExtensionObject(UaReadProcessedDetails.dataTypeId, (0, opcua_webapi_1.ReadProcessedDetailsToJSONTyped)(this.toStruct()));
|
|
61
|
+
}
|
|
62
|
+
static fromExtensionObject(extensionObject) {
|
|
63
|
+
if (!UaReadProcessedDetails.dataTypeId.equal(extensionObject.typeId))
|
|
64
|
+
return null;
|
|
65
|
+
let details = (0, opcua_webapi_1.ReadProcessedDetailsFromJSON)(extensionObject.body);
|
|
66
|
+
return UaReadProcessedDetails.fromStruct(details);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.UaReadProcessedDetails = UaReadProcessedDetails;
|
|
70
|
+
UaReadProcessedDetails.dataTypeId = new types_1.UaNodeId(nodes_1.DataTypeIds.ReadProcessedDetails);
|
|
@@ -10,6 +10,7 @@ export * from "./UaHistoryEvent";
|
|
|
10
10
|
export * from "./UaLiteralOperand";
|
|
11
11
|
export * from "./UaRange";
|
|
12
12
|
export * from "./UaReadAtTimeDetails";
|
|
13
|
-
export * from "./UaReadEventDetails";
|
|
14
13
|
export * from "./UaReadRawModifiedDetails";
|
|
14
|
+
export * from "./UaReadProcessedDetails";
|
|
15
|
+
export * from "./UaReadEventDetails";
|
|
15
16
|
export * from "./UaSimpleAttributeOperand";
|
|
@@ -26,6 +26,7 @@ __exportStar(require("./UaHistoryEvent"), exports);
|
|
|
26
26
|
__exportStar(require("./UaLiteralOperand"), exports);
|
|
27
27
|
__exportStar(require("./UaRange"), exports);
|
|
28
28
|
__exportStar(require("./UaReadAtTimeDetails"), exports);
|
|
29
|
-
__exportStar(require("./UaReadEventDetails"), exports);
|
|
30
29
|
__exportStar(require("./UaReadRawModifiedDetails"), exports);
|
|
30
|
+
__exportStar(require("./UaReadProcessedDetails"), exports);
|
|
31
|
+
__exportStar(require("./UaReadEventDetails"), exports);
|
|
31
32
|
__exportStar(require("./UaSimpleAttributeOperand"), exports);
|