node-opcua-utils 2.54.0 → 2.60.0
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/.mocharc.yml +10 -10
- package/LICENSE +20 -20
- package/dist/function_variadic.d.ts +1 -0
- package/dist/function_variadic.js +3 -0
- package/dist/function_variadic.js.map +1 -0
- package/dist/get_function_parameters_name.d.ts +2 -1
- package/dist/get_function_parameters_name.js +0 -1
- package/dist/get_function_parameters_name.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/line_file.d.ts +1 -1
- package/dist/line_file.js +3 -3
- package/dist/line_file.js.map +1 -1
- package/dist/object_classname.d.ts +1 -1
- package/dist/object_classname.js.map +1 -1
- package/dist/replace_buffer_with_hex_dump.d.ts +3 -1
- package/dist/replace_buffer_with_hex_dump.js +1 -1
- package/dist/replace_buffer_with_hex_dump.js.map +1 -1
- package/dist/set_deprecated.d.ts +2 -1
- package/dist/set_deprecated.js +2 -2
- package/dist/set_deprecated.js.map +1 -1
- package/dist/string_utils.d.ts +4 -4
- package/dist/string_utils.js +5 -5
- package/dist/string_utils.js.map +1 -1
- package/dist/timestamp.js +1 -4
- package/dist/timestamp.js.map +1 -1
- package/dist/watchdog.d.ts +1 -0
- package/dist/watchdog.js +5 -2
- package/dist/watchdog.js.map +1 -1
- package/package.json +7 -5
- package/source/buffer_ellipsis.ts +13 -13
- package/source/compare_buffers.ts +23 -23
- package/source/function_variadic.ts +1 -0
- package/source/get_clock_tick.ts +18 -18
- package/source/get_function_parameters_name.ts +15 -13
- package/source/index.ts +46 -46
- package/source/line_file.ts +24 -24
- package/source/match_uri.ts +19 -19
- package/source/object_classname.ts +11 -11
- package/source/replace_buffer_with_hex_dump.ts +15 -15
- package/source/set_deprecated.ts +29 -28
- package/source/string_utils.ts +12 -12
- package/source/timestamp.ts +11 -15
- package/source/watchdog.ts +205 -200
- package/dist/construct_filename.d.ts +0 -4
- package/dist/construct_filename.js +0 -14
- package/dist/construct_filename.js.map +0 -1
- package/dist/linefile.d.ts +0 -8
- package/dist/linefile.js +0 -37
- package/dist/linefile.js.map +0 -1
- package/dist/nodejs-only/index.d.ts +0 -2
- package/dist/nodejs-only/index.js +0 -15
- package/dist/nodejs-only/index.js.map +0 -1
- package/dist/nodejs-only/linefile.d.ts +0 -8
- package/dist/nodejs-only/linefile.js +0 -37
- package/dist/nodejs-only/linefile.js.map +0 -1
- package/dist/nodejs-only/normalize_require_file.d.ts +0 -10
- package/dist/nodejs-only/normalize_require_file.js +0 -26
- package/dist/nodejs-only/normalize_require_file.js.map +0 -1
package/source/watchdog.ts
CHANGED
|
@@ -1,200 +1,205 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-utils
|
|
3
|
-
*/
|
|
4
|
-
import { EventEmitter } from "events";
|
|
5
|
-
import { assert } from "node-opcua-assert";
|
|
6
|
-
|
|
7
|
-
type ArbitraryClockTick = number; // in millisecond
|
|
8
|
-
type DurationInMillisecond = number;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* a arbitrary clock which is system dependant and
|
|
12
|
-
* insensible to clock drifts ....
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
function _getCurrentSystemTick(): ArbitraryClockTick {
|
|
16
|
-
if (process && process.hrtime) {
|
|
17
|
-
const h = process.hrtime();
|
|
18
|
-
const n = h[1] / 1000000;
|
|
19
|
-
assert(n <= 1000);
|
|
20
|
-
return h[0] * 1000 + n;
|
|
21
|
-
} else {
|
|
22
|
-
// fallback to Date as process.hrtime doesn't exit
|
|
23
|
-
return Date.now();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface IWatchdogData2 {
|
|
28
|
-
key: number;
|
|
29
|
-
subscriber: ISubscriber;
|
|
30
|
-
timeout: DurationInMillisecond;
|
|
31
|
-
lastSeen: ArbitraryClockTick;
|
|
32
|
-
visitCount: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ISubscriber {
|
|
36
|
-
_watchDog?: WatchDog;
|
|
37
|
-
_watchDogData?: IWatchdogData2;
|
|
38
|
-
|
|
39
|
-
watchdogReset: () => void;
|
|
40
|
-
keepAlive?: () => void;
|
|
41
|
-
onClientSeen?: () => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function hasExpired(watchDogData: IWatchdogData2, currentTime: ArbitraryClockTick) {
|
|
45
|
-
const elapsedTime = currentTime - watchDogData.lastSeen;
|
|
46
|
-
return elapsedTime > watchDogData.timeout;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function keepAliveFunc(this: ISubscriber) {
|
|
50
|
-
assert(this._watchDog instanceof WatchDog);
|
|
51
|
-
// istanbul ignore next
|
|
52
|
-
if (!this._watchDogData || !this._watchDog) {
|
|
53
|
-
throw new Error("Internal error");
|
|
54
|
-
}
|
|
55
|
-
assert(typeof this._watchDogData.key === "number");
|
|
56
|
-
this._watchDogData.lastSeen = this._watchDog.getCurrentSystemTick();
|
|
57
|
-
if (this.onClientSeen) {
|
|
58
|
-
this.onClientSeen();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export class WatchDog extends EventEmitter {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
subscriber.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
private
|
|
194
|
-
assert(this._timer
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-utils
|
|
3
|
+
*/
|
|
4
|
+
import { EventEmitter } from "events";
|
|
5
|
+
import { assert } from "node-opcua-assert";
|
|
6
|
+
|
|
7
|
+
type ArbitraryClockTick = number; // in millisecond
|
|
8
|
+
type DurationInMillisecond = number;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* a arbitrary clock which is system dependant and
|
|
12
|
+
* insensible to clock drifts ....
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
function _getCurrentSystemTick(): ArbitraryClockTick {
|
|
16
|
+
if (process && process.hrtime) {
|
|
17
|
+
const h = process.hrtime();
|
|
18
|
+
const n = h[1] / 1000000;
|
|
19
|
+
assert(n <= 1000);
|
|
20
|
+
return h[0] * 1000 + n;
|
|
21
|
+
} else {
|
|
22
|
+
// fallback to Date as process.hrtime doesn't exit
|
|
23
|
+
return Date.now();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IWatchdogData2 {
|
|
28
|
+
key: number;
|
|
29
|
+
subscriber: ISubscriber;
|
|
30
|
+
timeout: DurationInMillisecond;
|
|
31
|
+
lastSeen: ArbitraryClockTick;
|
|
32
|
+
visitCount: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ISubscriber {
|
|
36
|
+
_watchDog?: WatchDog;
|
|
37
|
+
_watchDogData?: IWatchdogData2;
|
|
38
|
+
|
|
39
|
+
watchdogReset: () => void;
|
|
40
|
+
keepAlive?: () => void;
|
|
41
|
+
onClientSeen?: () => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function hasExpired(watchDogData: IWatchdogData2, currentTime: ArbitraryClockTick) {
|
|
45
|
+
const elapsedTime = currentTime - watchDogData.lastSeen;
|
|
46
|
+
return elapsedTime > watchDogData.timeout;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function keepAliveFunc(this: ISubscriber) {
|
|
50
|
+
assert(this._watchDog instanceof WatchDog);
|
|
51
|
+
// istanbul ignore next
|
|
52
|
+
if (!this._watchDogData || !this._watchDog) {
|
|
53
|
+
throw new Error("Internal error");
|
|
54
|
+
}
|
|
55
|
+
assert(typeof this._watchDogData.key === "number");
|
|
56
|
+
this._watchDogData.lastSeen = this._watchDog.getCurrentSystemTick();
|
|
57
|
+
if (this.onClientSeen) {
|
|
58
|
+
this.onClientSeen();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export class WatchDog extends EventEmitter {
|
|
63
|
+
|
|
64
|
+
static lastSeenToDuration(lastSeen: number): number {
|
|
65
|
+
return _getCurrentSystemTick() - lastSeen;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static emptyKeepAlive = (): void => {
|
|
69
|
+
/* */
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* returns the number of subscribers using the WatchDog object.
|
|
73
|
+
*/
|
|
74
|
+
get subscriberCount(): number {
|
|
75
|
+
return Object.keys(this._watchdogDataMap).length;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private readonly _watchdogDataMap: { [id: number]: IWatchdogData2 };
|
|
79
|
+
private _counter: number;
|
|
80
|
+
private _currentTime: ArbitraryClockTick;
|
|
81
|
+
private _timer: NodeJS.Timer | null;
|
|
82
|
+
private readonly _visitSubscriberB: (...args: any[]) => void;
|
|
83
|
+
|
|
84
|
+
constructor() {
|
|
85
|
+
super();
|
|
86
|
+
|
|
87
|
+
this._watchdogDataMap = {};
|
|
88
|
+
this._counter = 0;
|
|
89
|
+
this._currentTime = this.getCurrentSystemTick();
|
|
90
|
+
this._visitSubscriberB = this._visit_subscriber.bind(this);
|
|
91
|
+
this._timer = null; // as NodeJS.Timer;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* add a subscriber to the WatchDog.
|
|
96
|
+
* @method addSubscriber
|
|
97
|
+
*
|
|
98
|
+
* add a subscriber to the WatchDog.
|
|
99
|
+
*
|
|
100
|
+
* This method modifies the subscriber be adding a
|
|
101
|
+
* new method to it called 'keepAlive'
|
|
102
|
+
* The subscriber must also provide a "watchdogReset". watchdogReset will be called
|
|
103
|
+
* if the subscriber failed to call keepAlive withing the timeout period.
|
|
104
|
+
* @param subscriber
|
|
105
|
+
* @param timeout
|
|
106
|
+
* @return the numerical key associated with this subscriber
|
|
107
|
+
*/
|
|
108
|
+
public addSubscriber(subscriber: ISubscriber, timeout: number): number {
|
|
109
|
+
this._currentTime = this.getCurrentSystemTick();
|
|
110
|
+
timeout = timeout || 1000;
|
|
111
|
+
assert(typeof timeout === "number", " invalid timeout ");
|
|
112
|
+
assert(typeof subscriber.watchdogReset === "function", " the subscriber must provide a watchdogReset method ");
|
|
113
|
+
assert(typeof subscriber.keepAlive !== "function" || subscriber.keepAlive === WatchDog.emptyKeepAlive);
|
|
114
|
+
|
|
115
|
+
this._counter += 1;
|
|
116
|
+
const key = this._counter;
|
|
117
|
+
|
|
118
|
+
subscriber._watchDog = this;
|
|
119
|
+
subscriber._watchDogData = {
|
|
120
|
+
key,
|
|
121
|
+
lastSeen: this._currentTime,
|
|
122
|
+
subscriber,
|
|
123
|
+
timeout,
|
|
124
|
+
visitCount: 0
|
|
125
|
+
} as IWatchdogData2;
|
|
126
|
+
|
|
127
|
+
this._watchdogDataMap[key] = subscriber._watchDogData;
|
|
128
|
+
|
|
129
|
+
if (subscriber.onClientSeen) {
|
|
130
|
+
subscriber.onClientSeen();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
subscriber.keepAlive = keepAliveFunc.bind(subscriber);
|
|
134
|
+
|
|
135
|
+
// start timer when the first subscriber comes in
|
|
136
|
+
if (this.subscriberCount === 1) {
|
|
137
|
+
assert(this._timer === null);
|
|
138
|
+
this._start_timer();
|
|
139
|
+
}
|
|
140
|
+
assert(this._timer !== null);
|
|
141
|
+
return key;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
public removeSubscriber(subscriber: ISubscriber): void {
|
|
145
|
+
if (!subscriber._watchDog) {
|
|
146
|
+
return; // already removed !!!
|
|
147
|
+
}
|
|
148
|
+
if (!subscriber._watchDogData) {
|
|
149
|
+
throw new Error("Internal error");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
assert(subscriber._watchDog instanceof WatchDog);
|
|
153
|
+
assert(typeof subscriber._watchDogData.key === "number");
|
|
154
|
+
assert(typeof subscriber.keepAlive === "function");
|
|
155
|
+
assert(Object.prototype.hasOwnProperty.call(this._watchdogDataMap, subscriber._watchDogData.key));
|
|
156
|
+
|
|
157
|
+
delete this._watchdogDataMap[subscriber._watchDogData.key];
|
|
158
|
+
delete subscriber._watchDog;
|
|
159
|
+
// leave it as it might be usefull, delete subscriber._watchDogData;
|
|
160
|
+
subscriber.keepAlive = WatchDog.emptyKeepAlive;
|
|
161
|
+
|
|
162
|
+
// delete timer when the last subscriber comes out
|
|
163
|
+
if (this.subscriberCount === 0) {
|
|
164
|
+
this._stop_timer();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public shutdown(): void {
|
|
169
|
+
assert(this._timer === null && Object.keys(this._watchdogDataMap).length === 0, " leaking subscriber in watchdog");
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
public getCurrentSystemTick(): ArbitraryClockTick {
|
|
173
|
+
return _getCurrentSystemTick();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private _visit_subscriber() {
|
|
177
|
+
this._currentTime = this.getCurrentSystemTick();
|
|
178
|
+
|
|
179
|
+
const expiredSubscribers = Object.values(this._watchdogDataMap).filter((watchDogData: IWatchdogData2) => {
|
|
180
|
+
watchDogData.visitCount += 1;
|
|
181
|
+
return hasExpired(watchDogData, this._currentTime);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
if (expiredSubscribers.length) {
|
|
185
|
+
this.emit("timeout", expiredSubscribers);
|
|
186
|
+
}
|
|
187
|
+
expiredSubscribers.forEach((watchDogData: IWatchdogData2) => {
|
|
188
|
+
this.removeSubscriber(watchDogData.subscriber);
|
|
189
|
+
watchDogData.subscriber.watchdogReset();
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private _start_timer(): void {
|
|
194
|
+
assert(this._timer === null, " setInterval already called ?");
|
|
195
|
+
this._timer = setInterval(this._visitSubscriberB, 1000);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private _stop_timer(): void {
|
|
199
|
+
assert(this._timer !== null, "_stop_timer already called ?");
|
|
200
|
+
if (this._timer !== null) {
|
|
201
|
+
clearInterval(this._timer);
|
|
202
|
+
this._timer = null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.constructFilename = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-utils
|
|
6
|
-
*/
|
|
7
|
-
function constructFilename(filename) {
|
|
8
|
-
throw new Error("constructFilename has been deprecated ! use node-opcua-nodesets.constructFilename or ....");
|
|
9
|
-
// xx var dirname = $_$.dirname;
|
|
10
|
-
// xx var file = path.join(dirname, filename);
|
|
11
|
-
// xx return file;
|
|
12
|
-
}
|
|
13
|
-
exports.constructFilename = constructFilename;
|
|
14
|
-
//# sourceMappingURL=construct_filename.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"construct_filename.js","sourceRoot":"","sources":["../source/construct_filename.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,iBAAiB,CAAC,QAAgB;IAC9C,MAAM,IAAI,KAAK,CAAC,2FAA2F,CAAC,CAAC;IAC7G,mCAAmC;IACnC,iDAAiD;IACjD,qBAAqB;AACzB,CAAC;AALD,8CAKC"}
|
package/dist/linefile.d.ts
DELETED
package/dist/linefile.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LineFile = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-utils
|
|
6
|
-
*/
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const os = require("os");
|
|
9
|
-
class LineFile {
|
|
10
|
-
constructor() {
|
|
11
|
-
this._line = [];
|
|
12
|
-
this.write("// --------- This code has been automatically generated !!! " + new Date().toISOString());
|
|
13
|
-
this.write("/**");
|
|
14
|
-
this.write(" * @module node-opcua-types");
|
|
15
|
-
this.write(" */");
|
|
16
|
-
}
|
|
17
|
-
write(...arg) {
|
|
18
|
-
let str = "";
|
|
19
|
-
// tslint:disable:prefer-for-of
|
|
20
|
-
for (let i = 0; i < arguments.length; i++) {
|
|
21
|
-
str += arguments[i];
|
|
22
|
-
}
|
|
23
|
-
this._line.push(str);
|
|
24
|
-
}
|
|
25
|
-
toString() {
|
|
26
|
-
return this._line.join(os.EOL);
|
|
27
|
-
}
|
|
28
|
-
save(filename) {
|
|
29
|
-
fs_1.writeFileSync(filename, this.toString(), "ascii");
|
|
30
|
-
}
|
|
31
|
-
saveFormat(filename, formatter) {
|
|
32
|
-
const code = formatter(this.toString());
|
|
33
|
-
fs_1.writeFileSync(filename, code, "ascii");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.LineFile = LineFile;
|
|
37
|
-
//# sourceMappingURL=linefile.js.map
|
package/dist/linefile.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linefile.js","sourceRoot":"","sources":["../source/linefile.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,2BAAmC;AACnC,yBAAyB;AAEzB,MAAa,QAAQ;IAIjB;QACI,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,8DAA8D,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QACtG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,GAAG,GAAa;QACzB,IAAI,GAAG,GAAG,EAAE,CAAC;QAEb,+BAA+B;QAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;SACvB;QACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAEM,IAAI,CAAC,QAAgB;QACxB,kBAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAEM,UAAU,CAAC,QAAgB,EAAE,SAAmC;QACnE,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxC,kBAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CACJ;AAlCD,4BAkCC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./linefile"), exports);
|
|
14
|
-
__exportStar(require("./normalize_require_file"), exports);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/nodejs-only/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA2B;AAC3B,2DAAyC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LineFile = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-utils
|
|
6
|
-
*/
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const os = require("os");
|
|
9
|
-
class LineFile {
|
|
10
|
-
constructor() {
|
|
11
|
-
this._line = [];
|
|
12
|
-
this.write("// --------- This code has been automatically generated !!! " + new Date().toISOString());
|
|
13
|
-
this.write("/**");
|
|
14
|
-
this.write(" * @module node-opcua-types");
|
|
15
|
-
this.write(" */");
|
|
16
|
-
}
|
|
17
|
-
write(...arg) {
|
|
18
|
-
let str = "";
|
|
19
|
-
// tslint:disable:prefer-for-of
|
|
20
|
-
for (let i = 0; i < arguments.length; i++) {
|
|
21
|
-
str += arguments[i];
|
|
22
|
-
}
|
|
23
|
-
this._line.push(str);
|
|
24
|
-
}
|
|
25
|
-
toString() {
|
|
26
|
-
return this._line.join(os.EOL);
|
|
27
|
-
}
|
|
28
|
-
save(filename) {
|
|
29
|
-
fs_1.writeFileSync(filename, this.toString(), "ascii");
|
|
30
|
-
}
|
|
31
|
-
saveFormat(filename, formatter) {
|
|
32
|
-
const code = formatter(this.toString());
|
|
33
|
-
fs_1.writeFileSync(filename, code, "ascii");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.LineFile = LineFile;
|
|
37
|
-
//# sourceMappingURL=linefile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linefile.js","sourceRoot":"","sources":["../../source/nodejs-only/linefile.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,2BAAmC;AACnC,yBAAyB;AAEzB,MAAa,QAAQ;IAIjB;QACI,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,8DAA8D,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QACtG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,GAAG,GAAa;QACzB,IAAI,GAAG,GAAG,EAAE,CAAC;QAEb,+BAA+B;QAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACvC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;SACvB;QACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAEM,IAAI,CAAC,QAAgB;QACxB,kBAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAEM,UAAU,CAAC,QAAgB,EAAE,SAAmC;QACnE,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxC,kBAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CACJ;AAlCD,4BAkCC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @method normalize_require_file
|
|
3
|
-
* @param baseFolder
|
|
4
|
-
* @param fullPathToFile
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @example:
|
|
8
|
-
* normalize_require_file("/home/bob/folder1/","/home/bob/folder1/folder2/toto.js").should.eql("./folder2/toto");
|
|
9
|
-
*/
|
|
10
|
-
export declare function normalize_require_file(baseFolder: string, fullPathToFile: string): string;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalize_require_file = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
6
|
-
/**
|
|
7
|
-
* @method normalize_require_file
|
|
8
|
-
* @param baseFolder
|
|
9
|
-
* @param fullPathToFile
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @example:
|
|
13
|
-
* normalize_require_file("/home/bob/folder1/","/home/bob/folder1/folder2/toto.js").should.eql("./folder2/toto");
|
|
14
|
-
*/
|
|
15
|
-
function normalize_require_file(baseFolder, fullPathToFile) {
|
|
16
|
-
let localFile = path.relative(baseFolder, fullPathToFile).replace(/\\/g, "/");
|
|
17
|
-
// append ./ if necessary
|
|
18
|
-
if (localFile.substr(0, 1) !== ".") {
|
|
19
|
-
localFile = "./" + localFile;
|
|
20
|
-
}
|
|
21
|
-
// remove extension
|
|
22
|
-
localFile = localFile.substr(0, localFile.length - path.extname(localFile).length);
|
|
23
|
-
return localFile;
|
|
24
|
-
}
|
|
25
|
-
exports.normalize_require_file = normalize_require_file;
|
|
26
|
-
//# sourceMappingURL=normalize_require_file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize_require_file.js","sourceRoot":"","sources":["../../source/nodejs-only/normalize_require_file.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,wHAAwH;AACxH;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CAAC,UAAkB,EAAE,cAAsB;IAC7E,IAAI,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC9E,yBAAyB;IACzB,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,EAAE;QAChC,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;KAChC;IACD,mBAAmB;IACnB,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACnF,OAAO,SAAS,CAAC;AACrB,CAAC;AATD,wDASC"}
|