node-opcua-server 2.112.0 → 2.113.1
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/addressSpace_accessor.js +1 -0
- package/dist/addressSpace_accessor.js.map +1 -1
- package/dist/monitored_item.js +11 -15
- package/dist/monitored_item.js.map +1 -1
- package/dist/node_sampler.js +1 -0
- package/dist/node_sampler.js.map +1 -1
- package/dist/server_engine.js +2 -2
- package/dist/server_engine.js.map +1 -1
- package/dist/server_publish_engine.js +2 -0
- package/dist/server_publish_engine.js.map +1 -1
- package/dist/server_session.js +1 -0
- package/dist/server_session.js.map +1 -1
- package/dist/server_subscription.js +4 -0
- package/dist/server_subscription.js.map +1 -1
- package/dist/validate_filter.js +3 -2
- package/dist/validate_filter.js.map +1 -1
- package/package.json +40 -40
- package/source/addressSpace_accessor.ts +24 -4
- package/source/monitored_item.ts +14 -17
- package/source/node_sampler.ts +1 -0
- package/source/server_engine.ts +2 -2
- package/source/server_publish_engine.ts +2 -0
- package/source/server_session.ts +1 -0
- package/source/server_subscription.ts +5 -0
- package/source/validate_filter.ts +4 -2
package/source/monitored_item.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
coerceTimestampsToReturn,
|
|
19
19
|
sameStatusCode
|
|
20
20
|
} from "node-opcua-data-value";
|
|
21
|
-
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
21
|
+
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
22
22
|
import { ExtensionObject } from "node-opcua-extension-object";
|
|
23
23
|
import { NodeId } from "node-opcua-nodeid";
|
|
24
24
|
import { NumericalRange0, NumericRange } from "node-opcua-numeric-range";
|
|
@@ -57,6 +57,8 @@ import { validateFilter } from "./validate_filter";
|
|
|
57
57
|
import { checkWhereClauseOnAdressSpace as checkWhereClauseOnAddressSpace } from "./filter/check_where_clause_on_address_space";
|
|
58
58
|
import { SamplingFunc } from "./sampling_func";
|
|
59
59
|
|
|
60
|
+
const errorLog = make_errorLog(__filename);
|
|
61
|
+
|
|
60
62
|
export type QueueItem = MonitoredItemNotification | EventFieldList;
|
|
61
63
|
|
|
62
64
|
const defaultItemToMonitor: ReadValueIdOptions = new ReadValueId({
|
|
@@ -163,7 +165,7 @@ function valueHasChanged(
|
|
|
163
165
|
rangeVariant.value as PseudoRange
|
|
164
166
|
);
|
|
165
167
|
} else {
|
|
166
|
-
|
|
168
|
+
errorLog("EURange is not of type Variable");
|
|
167
169
|
}
|
|
168
170
|
return true;
|
|
169
171
|
}
|
|
@@ -262,7 +264,7 @@ function safeGuardVerify(monitoredItem: MonitoredItem) {
|
|
|
262
264
|
if ((monitoredItem as any)._$safeGuard) {
|
|
263
265
|
const verif = s(monitoredItem.oldDataValue|| "");
|
|
264
266
|
if (verif !== (monitoredItem as any)._$safeGuard) {
|
|
265
|
-
|
|
267
|
+
errorLog(verif, (monitoredItem as any)._$safeGuard);
|
|
266
268
|
throw new Error("Internal error: DataValue has been altereed !!!");
|
|
267
269
|
}
|
|
268
270
|
}
|
|
@@ -443,6 +445,7 @@ export class MonitoredItem extends EventEmitter {
|
|
|
443
445
|
this._node = null;
|
|
444
446
|
this._semantic_version = 0;
|
|
445
447
|
|
|
448
|
+
// istanbul ignore next
|
|
446
449
|
if (doDebug) {
|
|
447
450
|
debugLog("Monitoring ", options.itemToMonitor.toString());
|
|
448
451
|
}
|
|
@@ -504,6 +507,7 @@ export class MonitoredItem extends EventEmitter {
|
|
|
504
507
|
}
|
|
505
508
|
|
|
506
509
|
public dispose(): void {
|
|
510
|
+
// istanbul ignore next
|
|
507
511
|
if (doDebug) {
|
|
508
512
|
debugLog("DISPOSING MONITORED ITEM", this._node!.nodeId.toString());
|
|
509
513
|
}
|
|
@@ -595,12 +599,7 @@ export class MonitoredItem extends EventEmitter {
|
|
|
595
599
|
|
|
596
600
|
const hasSemanticChanged = this.node && (this.node as any).semantic_version !== this._semantic_version;
|
|
597
601
|
|
|
598
|
-
|
|
599
|
-
// this.node.listenerCount("value_changed"),this.node.nodeId.toString());
|
|
600
|
-
// xx console.log("events ---- ",this.node.eventNames().join("-"));
|
|
601
|
-
// xx console.log("indexRange = ",indexRange ? indexRange.toString() :"");
|
|
602
|
-
// xx console.log("this.itemToMonitor.indexRange = ",this.itemToMonitor.indexRange.toString());
|
|
603
|
-
|
|
602
|
+
|
|
604
603
|
if (!hasSemanticChanged && indexRange && this.itemToMonitor.indexRange) {
|
|
605
604
|
// we just ignore changes that do not fall within our range
|
|
606
605
|
// ( unless semantic bit has changed )
|
|
@@ -885,7 +884,6 @@ export class MonitoredItem extends EventEmitter {
|
|
|
885
884
|
|
|
886
885
|
return;
|
|
887
886
|
}
|
|
888
|
-
// xx console.log("xxxx ON SAMPLING");
|
|
889
887
|
assert(!this._is_sampling, "sampling func shall not be re-entrant !! fix it");
|
|
890
888
|
|
|
891
889
|
// istanbul ignore next
|
|
@@ -903,7 +901,7 @@ export class MonitoredItem extends EventEmitter {
|
|
|
903
901
|
}
|
|
904
902
|
// istanbull ignore next
|
|
905
903
|
if (err) {
|
|
906
|
-
|
|
904
|
+
errorLog(" SAMPLING ERROR =>", err);
|
|
907
905
|
} else {
|
|
908
906
|
// only record value if source timestamp is newer
|
|
909
907
|
// xx if (newDataValue && isSourceNewerThan(newDataValue, this.oldDataValue)) {
|
|
@@ -1001,10 +999,10 @@ export class MonitoredItem extends EventEmitter {
|
|
|
1001
999
|
|
|
1002
1000
|
// istanbul ignore next
|
|
1003
1001
|
if (doDebug) {
|
|
1004
|
-
|
|
1005
|
-
|
|
1002
|
+
debugLog(" RECEIVED INTERNAL EVENT THAT WE ARE MONITORING");
|
|
1003
|
+
debugLog(this.filter ? this.filter.toString() : "no filter");
|
|
1006
1004
|
eventFields.forEach((e: any) => {
|
|
1007
|
-
|
|
1005
|
+
debugLog(e.toString());
|
|
1008
1006
|
});
|
|
1009
1007
|
}
|
|
1010
1008
|
|
|
@@ -1173,11 +1171,10 @@ export class MonitoredItem extends EventEmitter {
|
|
|
1173
1171
|
assert(sameStatusCode(notification.value.statusCode, StatusCodes.GoodWithOverflowBit));
|
|
1174
1172
|
assert(notification.value.statusCode.hasOverflowBit);
|
|
1175
1173
|
}
|
|
1176
|
-
// console.log(chalk.cyan("Setting Over"), !!this.$subscription, !!this.$subscription!.subscriptionDiagnostics);
|
|
1177
1174
|
if (this.$subscription && this.$subscription.subscriptionDiagnostics) {
|
|
1178
1175
|
this.$subscription.subscriptionDiagnostics.monitoringQueueOverflowCount++;
|
|
1179
1176
|
}
|
|
1180
|
-
// to do eventQueueOverFlowCount
|
|
1177
|
+
// to do: eventQueueOverFlowCount
|
|
1181
1178
|
}
|
|
1182
1179
|
|
|
1183
1180
|
private _enqueue_notification(notification: QueueItem) {
|
|
@@ -1313,6 +1310,7 @@ export class MonitoredItem extends EventEmitter {
|
|
|
1313
1310
|
}
|
|
1314
1311
|
|
|
1315
1312
|
private _enqueue_event(eventFields: any[]) {
|
|
1313
|
+
// istanbul ignore next
|
|
1316
1314
|
if (doDebug) {
|
|
1317
1315
|
debugLog(" MonitoredItem#_enqueue_event");
|
|
1318
1316
|
}
|
|
@@ -1355,7 +1353,6 @@ export class MonitoredItem extends EventEmitter {
|
|
|
1355
1353
|
this._on_sampling_timer();
|
|
1356
1354
|
}, this.samplingInterval);
|
|
1357
1355
|
}
|
|
1358
|
-
// xx console.log("MonitoredItem#_set_timer",this._samplingId);
|
|
1359
1356
|
}
|
|
1360
1357
|
|
|
1361
1358
|
private _adjust_queue_to_match_new_queue_size() {
|
package/source/node_sampler.ts
CHANGED
package/source/server_engine.ts
CHANGED
|
@@ -1552,7 +1552,7 @@ export class ServerEngine extends EventEmitter implements IAddressSpaceAccessor
|
|
|
1552
1552
|
|
|
1553
1553
|
// now check that new session has sufficient right
|
|
1554
1554
|
// if (session.authenticationToken.toString() !== subscription.authenticationToken.toString()) {
|
|
1555
|
-
//
|
|
1555
|
+
// warningLog("ServerEngine#transferSubscription => BadUserAccessDenied");
|
|
1556
1556
|
// return new TransferResult({ statusCode: StatusCodes.BadUserAccessDenied });
|
|
1557
1557
|
// }
|
|
1558
1558
|
if ((session.publishEngine as any) === subscription.publishEngine) {
|
|
@@ -1717,7 +1717,7 @@ export class ServerEngine extends EventEmitter implements IAddressSpaceAccessor
|
|
|
1717
1717
|
addElement(subscriptionDiagnostics, subscriptionDiagnosticsArray);
|
|
1718
1718
|
}
|
|
1719
1719
|
} catch (err) {
|
|
1720
|
-
|
|
1720
|
+
errorLog("_exposeSubscriptionDiagnostics err", err);
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
1723
|
|
|
@@ -651,6 +651,7 @@ export class ServerSidePublishEngine extends EventEmitter implements IServerSide
|
|
|
651
651
|
|
|
652
652
|
const invalid_published_request = parts[0];
|
|
653
653
|
for (const publishData of invalid_published_request) {
|
|
654
|
+
// istanbul ignore next
|
|
654
655
|
if (doDebug) {
|
|
655
656
|
debugLog(chalk.cyan(" CANCELING TIMEOUT PUBLISH REQUEST "));
|
|
656
657
|
}
|
|
@@ -662,6 +663,7 @@ export class ServerSidePublishEngine extends EventEmitter implements IServerSide
|
|
|
662
663
|
publishData.callback(publishData.request, response);
|
|
663
664
|
}
|
|
664
665
|
public _send_valid_response_for_request(publishData: PublishData, response: PublishResponse): void {
|
|
666
|
+
// istanbul ignore next
|
|
665
667
|
if (doDebug) {
|
|
666
668
|
debugLog("_send_response_for_request ", response.toString());
|
|
667
669
|
}
|
package/source/server_session.ts
CHANGED
|
@@ -901,6 +901,7 @@ export class ServerSession extends EventEmitter implements ISubscriber, ISession
|
|
|
901
901
|
*/
|
|
902
902
|
private _getSubscriptionDiagnosticsArray() {
|
|
903
903
|
if (!this.addressSpace) {
|
|
904
|
+
// istanbul ignore next
|
|
904
905
|
if (doDebug) {
|
|
905
906
|
console.warn("ServerSession#_getSubscriptionDiagnosticsArray : no addressSpace");
|
|
906
907
|
}
|
|
@@ -853,6 +853,7 @@ export class Subscription extends EventEmitter {
|
|
|
853
853
|
};
|
|
854
854
|
}
|
|
855
855
|
public dispose(): void {
|
|
856
|
+
// istanbul ignore next
|
|
856
857
|
if (doDebug) {
|
|
857
858
|
debugLog("Subscription#dispose", this.id, this.monitoredItemCount);
|
|
858
859
|
}
|
|
@@ -1201,11 +1202,13 @@ export class Subscription extends EventEmitter {
|
|
|
1201
1202
|
});
|
|
1202
1203
|
|
|
1203
1204
|
if (foundIndex === -1) {
|
|
1205
|
+
// istanbul ignore next
|
|
1204
1206
|
if (doDebug) {
|
|
1205
1207
|
debugLog(chalk.red("acknowledging sequence FAILED !!! "), chalk.cyan(sequenceNumber.toString()));
|
|
1206
1208
|
}
|
|
1207
1209
|
return StatusCodes.BadSequenceNumberUnknown;
|
|
1208
1210
|
} else {
|
|
1211
|
+
// istanbul ignore next
|
|
1209
1212
|
if (doDebug) {
|
|
1210
1213
|
debugLog(chalk.yellow("acknowledging sequence "), chalk.cyan(sequenceNumber.toString()));
|
|
1211
1214
|
}
|
|
@@ -1377,6 +1380,8 @@ export class Subscription extends EventEmitter {
|
|
|
1377
1380
|
|
|
1378
1381
|
this.resetLifeTimeAndKeepAliveCounters();
|
|
1379
1382
|
|
|
1383
|
+
|
|
1384
|
+
// istanbul ignore next
|
|
1380
1385
|
if (doDebug) {
|
|
1381
1386
|
debugLog(
|
|
1382
1387
|
"Subscription sending a notificationMessage subscriptionId=",
|
|
@@ -13,6 +13,9 @@ import { DeadbandType } from "node-opcua-service-subscription";
|
|
|
13
13
|
import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
14
14
|
import { ReadValueIdOptions } from "node-opcua-types";
|
|
15
15
|
import { DataType } from "node-opcua-basic-types";
|
|
16
|
+
import { make_warningLog } from "node-opcua-debug";
|
|
17
|
+
|
|
18
|
+
const warningLog = make_warningLog(__filename);
|
|
16
19
|
|
|
17
20
|
function isNumberDataType(node: UAVariable): boolean {
|
|
18
21
|
|
|
@@ -60,8 +63,7 @@ function __validateDataChangeFilter(filter: DataChangeFilter, itemToMonitor: Rea
|
|
|
60
63
|
|
|
61
64
|
// node must also have a valid euRange
|
|
62
65
|
if (!node.getChildByName("EURange", 0)) {
|
|
63
|
-
|
|
64
|
-
console.log(" node has no euRange ! Dead band Percent cannot be used on node " + node.nodeId.toString());
|
|
66
|
+
warningLog(" node has no euRange ! Dead band Percent cannot be used on node " + node.nodeId.toString());
|
|
65
67
|
return StatusCodes.BadMonitoredItemFilterUnsupported;
|
|
66
68
|
}
|
|
67
69
|
}
|