node-opcua-utils 2.56.0 → 2.62.7
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/LICENSE +20 -20
- package/dist/watchdog.d.ts +1 -0
- package/dist/watchdog.js +4 -1
- package/dist/watchdog.js.map +1 -1
- package/package.json +4 -4
- package/source/buffer_ellipsis.ts +13 -13
- package/source/compare_buffers.ts +23 -23
- package/source/watchdog.ts +6 -1
- package/.mocharc.yml +0 -10
package/LICENSE
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2014-2021 Etienne Rossignon
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
-
subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2021 Etienne Rossignon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/watchdog.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface ISubscriber {
|
|
|
20
20
|
onClientSeen?: () => void;
|
|
21
21
|
}
|
|
22
22
|
export declare class WatchDog extends EventEmitter {
|
|
23
|
+
static lastSeenToDuration(lastSeen: number): number;
|
|
23
24
|
static emptyKeepAlive: () => void;
|
|
24
25
|
/**
|
|
25
26
|
* returns the number of subscribers using the WatchDog object.
|
package/dist/watchdog.js
CHANGED
|
@@ -48,6 +48,9 @@ class WatchDog extends events_1.EventEmitter {
|
|
|
48
48
|
this._visitSubscriberB = this._visit_subscriber.bind(this);
|
|
49
49
|
this._timer = null; // as NodeJS.Timer;
|
|
50
50
|
}
|
|
51
|
+
static lastSeenToDuration(lastSeen) {
|
|
52
|
+
return _getCurrentSystemTick() - lastSeen;
|
|
53
|
+
}
|
|
51
54
|
/**
|
|
52
55
|
* returns the number of subscribers using the WatchDog object.
|
|
53
56
|
*/
|
|
@@ -110,7 +113,7 @@ class WatchDog extends events_1.EventEmitter {
|
|
|
110
113
|
(0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(this._watchdogDataMap, subscriber._watchDogData.key));
|
|
111
114
|
delete this._watchdogDataMap[subscriber._watchDogData.key];
|
|
112
115
|
delete subscriber._watchDog;
|
|
113
|
-
delete subscriber._watchDogData;
|
|
116
|
+
// leave it as it might be usefull, delete subscriber._watchDogData;
|
|
114
117
|
subscriber.keepAlive = WatchDog.emptyKeepAlive;
|
|
115
118
|
// delete timer when the last subscriber comes out
|
|
116
119
|
if (this.subscriberCount === 0) {
|
package/dist/watchdog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchdog.js","sourceRoot":"","sources":["../source/watchdog.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mCAAsC;AACtC,yDAA2C;AAK3C;;;;GAIG;AACH,SAAS,qBAAqB;IAC1B,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE;QAC3B,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;QACzB,IAAA,0BAAM,EAAC,CAAC,IAAI,IAAI,CAAC,CAAC;QAClB,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;KAC1B;SAAM;QACH,kDAAkD;QAClD,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;KACrB;AACL,CAAC;AAmBD,SAAS,UAAU,CAAC,YAA4B,EAAE,WAA+B;IAC7E,MAAM,WAAW,GA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AAgB,CAAC,CAAC,MAAM,CAAC,CAAC,YAA4B,EAAE,EAAE;YACpG,YAAY,CAAC,UAAU,IAAI,CAAC,CAAC;YAC7B,OAAO,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,IAAI,kBAAkB,CAAC,MAAM,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;SAC5C;QACD,kBAAkB,CAAC,OAAO,CAAC,CAAC,YAA4B,EAAE,EAAE;YACxD,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;YAC/C,YAAY,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,YAAY;QAChB,IAAA,0BAAM,EAAC,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,+BAA+B,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;IAEO,WAAW;QACf,IAAA,0BAAM,EAAC,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,8BAA8B,CAAC,CAAC;QAC7D,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;YACtB,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;SACtB;IACL,CAAC;;AA9IL,4BA+IC;AAzIU,uBAAc,GAAG,GAAS,EAAE;IAC/B,KAAK;AACT,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.62.7",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -utils",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"node-opcua-assert": "2.55.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@types/node": "16.
|
|
20
|
+
"@types/node": "16.11.11",
|
|
21
21
|
"should": "^13.2.3",
|
|
22
|
-
"sinon": "^
|
|
22
|
+
"sinon": "^12.0.1"
|
|
23
23
|
},
|
|
24
24
|
"author": "Etienne Rossignon",
|
|
25
25
|
"license": "MIT",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"internet of things"
|
|
37
37
|
],
|
|
38
38
|
"homepage": "http://node-opcua.github.io/",
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "90bb9139261a0edbb531081afcc6904c74e9ee52"
|
|
40
40
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-utils
|
|
3
|
-
*/
|
|
4
|
-
export function buffer_ellipsis(buffer: Buffer, start?: number, end?: number): string {
|
|
5
|
-
start = start || 0;
|
|
6
|
-
end = end || buffer.length;
|
|
7
|
-
if (end - start < 40) {
|
|
8
|
-
return buffer.slice(start, end).toString("hex");
|
|
9
|
-
}
|
|
10
|
-
return buffer.slice(start, start + 10).toString("hex") + " ... " + buffer.slice(end - 10, end).toString("hex");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
exports.buffer_ellipsis = buffer_ellipsis;
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-utils
|
|
3
|
+
*/
|
|
4
|
+
export function buffer_ellipsis(buffer: Buffer, start?: number, end?: number): string {
|
|
5
|
+
start = start || 0;
|
|
6
|
+
end = end || buffer.length;
|
|
7
|
+
if (end - start < 40) {
|
|
8
|
+
return buffer.slice(start, end).toString("hex");
|
|
9
|
+
}
|
|
10
|
+
return buffer.slice(start, start + 10).toString("hex") + " ... " + buffer.slice(end - 10, end).toString("hex");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.buffer_ellipsis = buffer_ellipsis;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-utils
|
|
3
|
-
*/
|
|
4
|
-
// tslint:disable:no-console
|
|
5
|
-
import * as chalk from "chalk";
|
|
6
|
-
import { buffer_ellipsis } from "./buffer_ellipsis";
|
|
7
|
-
|
|
8
|
-
export function compare_buffers(buf1: Buffer, buf2: Buffer, max_length?: number): void {
|
|
9
|
-
max_length = max_length || buf2.length;
|
|
10
|
-
const block_length = 80;
|
|
11
|
-
let cursor = 0;
|
|
12
|
-
while (cursor < max_length) {
|
|
13
|
-
const slice1 = buf1.slice(cursor, cursor + block_length);
|
|
14
|
-
const slice2 = buf2.slice(cursor, cursor + block_length);
|
|
15
|
-
if (slice2.toString("hex") !== slice1.toString("hex")) {
|
|
16
|
-
console.log("pos = ", cursor);
|
|
17
|
-
console.log("slice1 :", chalk.yellow(buffer_ellipsis(slice1)));
|
|
18
|
-
console.log("slice2 :", chalk.blue(buffer_ellipsis(slice2)));
|
|
19
|
-
}
|
|
20
|
-
cursor += block_length;
|
|
21
|
-
}
|
|
22
|
-
// xx buf1.length.should.equal(max_length);
|
|
23
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-utils
|
|
3
|
+
*/
|
|
4
|
+
// tslint:disable:no-console
|
|
5
|
+
import * as chalk from "chalk";
|
|
6
|
+
import { buffer_ellipsis } from "./buffer_ellipsis";
|
|
7
|
+
|
|
8
|
+
export function compare_buffers(buf1: Buffer, buf2: Buffer, max_length?: number): void {
|
|
9
|
+
max_length = max_length || buf2.length;
|
|
10
|
+
const block_length = 80;
|
|
11
|
+
let cursor = 0;
|
|
12
|
+
while (cursor < max_length) {
|
|
13
|
+
const slice1 = buf1.slice(cursor, cursor + block_length);
|
|
14
|
+
const slice2 = buf2.slice(cursor, cursor + block_length);
|
|
15
|
+
if (slice2.toString("hex") !== slice1.toString("hex")) {
|
|
16
|
+
console.log("pos = ", cursor);
|
|
17
|
+
console.log("slice1 :", chalk.yellow(buffer_ellipsis(slice1)));
|
|
18
|
+
console.log("slice2 :", chalk.blue(buffer_ellipsis(slice2)));
|
|
19
|
+
}
|
|
20
|
+
cursor += block_length;
|
|
21
|
+
}
|
|
22
|
+
// xx buf1.length.should.equal(max_length);
|
|
23
|
+
}
|
package/source/watchdog.ts
CHANGED
|
@@ -60,6 +60,11 @@ function keepAliveFunc(this: ISubscriber) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export class WatchDog extends EventEmitter {
|
|
63
|
+
|
|
64
|
+
static lastSeenToDuration(lastSeen: number): number {
|
|
65
|
+
return _getCurrentSystemTick() - lastSeen;
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
static emptyKeepAlive = (): void => {
|
|
64
69
|
/* */
|
|
65
70
|
};
|
|
@@ -151,7 +156,7 @@ export class WatchDog extends EventEmitter {
|
|
|
151
156
|
|
|
152
157
|
delete this._watchdogDataMap[subscriber._watchDogData.key];
|
|
153
158
|
delete subscriber._watchDog;
|
|
154
|
-
delete subscriber._watchDogData;
|
|
159
|
+
// leave it as it might be usefull, delete subscriber._watchDogData;
|
|
155
160
|
subscriber.keepAlive = WatchDog.emptyKeepAlive;
|
|
156
161
|
|
|
157
162
|
// delete timer when the last subscriber comes out
|