nodejs-poolcontroller 8.3.0 → 8.4.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/.eslintrc.json +36 -36
- package/.github/ISSUE_TEMPLATE/1-bug-report.yml +84 -84
- package/.github/ISSUE_TEMPLATE/2-docs.md +12 -12
- package/.github/ISSUE_TEMPLATE/3-proposal.md +28 -28
- package/.github/ISSUE_TEMPLATE/config.yml +8 -8
- package/.github/copilot-instructions.md +63 -63
- package/.github/workflows/ghcr-publish.yml +67 -67
- package/AGENTS.md +597 -0
- package/CONTRIBUTING.md +74 -74
- package/Changelog +292 -284
- package/Dockerfile +62 -62
- package/Gruntfile.js +40 -40
- package/LICENSE +661 -661
- package/README.md +318 -309
- package/anslq25/MessagesMock.ts +221 -221
- package/anslq25/boards/MockBoardFactory.ts +49 -49
- package/anslq25/boards/MockEasyTouchBoard.ts +696 -696
- package/anslq25/boards/MockSystemBoard.ts +216 -216
- package/anslq25/chemistry/MockChlorinator.ts +98 -98
- package/anslq25/pumps/MockPump.ts +83 -83
- package/app.ts +115 -115
- package/config/Config.ts +0 -0
- package/config/VersionCheck.ts +0 -0
- package/controller/Constants.ts +809 -805
- package/controller/Equipment.ts +2688 -2664
- package/controller/Errors.ts +181 -181
- package/controller/Lockouts.ts +549 -549
- package/controller/State.ts +3738 -3701
- package/controller/boards/AquaLinkBoard.ts +1003 -1003
- package/controller/boards/BoardFactory.ts +53 -53
- package/controller/boards/EasyTouchBoard.ts +3202 -3202
- package/controller/boards/IntelliCenterBoard.ts +4393 -3899
- package/controller/boards/IntelliComBoard.ts +69 -69
- package/controller/boards/IntelliTouchBoard.ts +382 -382
- package/controller/boards/NixieBoard.ts +1944 -1944
- package/controller/boards/SunTouchBoard.ts +400 -400
- package/controller/boards/SystemBoard.ts +5268 -5268
- package/controller/comms/Comms.ts +1272 -1255
- package/controller/comms/ScreenLogic.ts +1665 -1665
- package/controller/comms/messages/Messages.ts +1433 -1406
- package/controller/comms/messages/config/ChlorinatorMessage.ts +5 -0
- package/controller/comms/messages/config/CircuitGroupMessage.ts +0 -0
- package/controller/comms/messages/config/CircuitMessage.ts +0 -0
- package/controller/comms/messages/config/ConfigMessage.ts +6 -0
- package/controller/comms/messages/config/CoverMessage.ts +0 -0
- package/controller/comms/messages/config/CustomNameMessage.ts +31 -31
- package/controller/comms/messages/config/EquipmentMessage.ts +216 -210
- package/controller/comms/messages/config/ExternalMessage.ts +96 -10
- package/controller/comms/messages/config/FeatureMessage.ts +0 -0
- package/controller/comms/messages/config/GeneralMessage.ts +0 -0
- package/controller/comms/messages/config/HeaterMessage.ts +0 -0
- package/controller/comms/messages/config/IntellichemMessage.ts +0 -0
- package/controller/comms/messages/config/OptionsMessage.ts +194 -174
- package/controller/comms/messages/config/PumpMessage.ts +0 -0
- package/controller/comms/messages/config/RemoteMessage.ts +0 -0
- package/controller/comms/messages/config/ScheduleMessage.ts +401 -390
- package/controller/comms/messages/config/SecurityMessage.ts +0 -0
- package/controller/comms/messages/config/ValveMessage.ts +0 -0
- package/controller/comms/messages/status/ChlorinatorStateMessage.ts +0 -0
- package/controller/comms/messages/status/EquipmentStateMessage.ts +1158 -822
- package/controller/comms/messages/status/HeaterStateMessage.ts +135 -135
- package/controller/comms/messages/status/IntelliChemStateMessage.ts +448 -448
- package/controller/comms/messages/status/IntelliValveStateMessage.ts +36 -36
- package/controller/comms/messages/status/PumpStateMessage.ts +0 -0
- package/controller/comms/messages/status/RegalModbusStateMessage.ts +410 -410
- package/controller/comms/messages/status/VersionMessage.ts +103 -41
- package/controller/nixie/Nixie.ts +173 -173
- package/controller/nixie/NixieEquipment.ts +104 -104
- package/controller/nixie/bodies/Body.ts +120 -120
- package/controller/nixie/bodies/Filter.ts +135 -135
- package/controller/nixie/chemistry/ChemController.ts +2724 -2724
- package/controller/nixie/chemistry/ChemDoser.ts +806 -806
- package/controller/nixie/chemistry/Chlorinator.ts +367 -367
- package/controller/nixie/circuits/Circuit.ts +478 -478
- package/controller/nixie/heaters/Heater.ts +834 -834
- package/controller/nixie/pumps/Pump.ts +1193 -1193
- package/controller/nixie/schedules/Schedule.ts +401 -401
- package/controller/nixie/valves/Valve.ts +170 -170
- package/defaultConfig.json +352 -352
- package/docker-compose.yml +31 -31
- package/logger/DataLogger.ts +448 -448
- package/logger/Logger.ts +448 -436
- package/package.json +58 -58
- package/sendSocket.js +32 -32
- package/tsconfig.json +25 -25
- package/types/express-multer.d.ts +32 -32
- package/web/Server.ts +1937 -1927
- package/web/bindings/aqualinkD.json +559 -559
- package/web/bindings/influxDB.json +1066 -1066
- package/web/bindings/mqtt.json +721 -721
- package/web/bindings/mqttAlt.json +746 -746
- package/web/bindings/rulesManager.json +54 -54
- package/web/bindings/smartThings-Hubitat.json +31 -31
- package/web/bindings/valveRelays.json +20 -20
- package/web/bindings/vera.json +25 -25
- package/web/interfaces/baseInterface.ts +188 -188
- package/web/interfaces/httpInterface.ts +148 -148
- package/web/interfaces/influxInterface.ts +283 -283
- package/web/interfaces/mqttInterface.ts +695 -695
- package/web/interfaces/ruleInterface.ts +101 -87
- package/web/services/config/Config.ts +1063 -1053
- package/web/services/config/ConfigSocket.ts +0 -0
- package/web/services/state/State.ts +0 -0
- package/web/services/state/StateSocket.ts +0 -0
- package/web/services/utilities/Utilities.ts +233 -233
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
/* nodejs-poolController. An application to control pool equipment.
|
|
2
|
-
Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021, 2022.
|
|
3
|
-
Russell Goldin, tagyoureit. russ.goldin@gmail.com
|
|
4
|
-
|
|
5
|
-
This program is free software: you can redistribute it and/or modify
|
|
6
|
-
it under the terms of the GNU Affero General Public License as
|
|
7
|
-
published by the Free Software Foundation, either version 3 of the
|
|
8
|
-
License, or (at your option) any later version.
|
|
9
|
-
|
|
10
|
-
This program is distributed in the hope that it will be useful,
|
|
11
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
GNU Affero General Public License for more details.
|
|
14
|
-
|
|
15
|
-
You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
import { HttpInterfaceServer } from "../../web/Server";
|
|
19
|
-
import * as http2 from "http2";
|
|
20
|
-
import * as http from "http";
|
|
21
|
-
import * as https from "https";
|
|
22
|
-
import extend=require("extend");
|
|
23
|
-
import { logger } from "../../logger/Logger";
|
|
24
|
-
import { PoolSystem, sys } from "../../controller/Equipment";
|
|
25
|
-
import { State, state } from "../../controller/State";
|
|
26
|
-
import { InterfaceContext, InterfaceEvent, BaseInterfaceBindings } from "./baseInterface";
|
|
27
|
-
|
|
28
|
-
export class HttpInterfaceBindings extends BaseInterfaceBindings {
|
|
29
|
-
constructor(cfg) {
|
|
30
|
-
super(cfg);
|
|
31
|
-
}
|
|
32
|
-
declare sockets: HttpInterfaceSocketEvent[];
|
|
33
|
-
public bindEvent(evt: string, ...data: any) {
|
|
34
|
-
// Find the binding by first looking for the specific event name.
|
|
35
|
-
// If that doesn't exist then look for the "*" (all events).
|
|
36
|
-
if (typeof this.events !== 'undefined') {
|
|
37
|
-
let evts = this.events.filter(elem => elem.name === evt);
|
|
38
|
-
// If we don't have an explicitly defined event then see if there is a default.
|
|
39
|
-
if (evts.length === 0) {
|
|
40
|
-
let e = this.events.find(elem => elem.name === '*');
|
|
41
|
-
evts = e ? [e] : [];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
let baseOpts = extend(true, { headers: {} }, this.cfg.options, this.context.options);
|
|
45
|
-
if ((typeof baseOpts.hostname === 'undefined' || !baseOpts.hostname) && (typeof baseOpts.host === 'undefined' || !baseOpts.host || baseOpts.host === '*')) {
|
|
46
|
-
logger.warn(`Interface: ${ this.cfg.name } has not resolved to a valid host.`);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (evts.length > 0) {
|
|
50
|
-
let toks = {};
|
|
51
|
-
for (let i = 0; i < evts.length; i++) {
|
|
52
|
-
let e = evts[i];
|
|
53
|
-
if (typeof e.enabled !== 'undefined' && !e.enabled) continue;
|
|
54
|
-
let opts = extend(true, baseOpts, e.options);
|
|
55
|
-
// Figure out whether we need to check the filter.
|
|
56
|
-
if (typeof e.filter !== 'undefined') {
|
|
57
|
-
this.buildTokens(e.filter, evt, toks, e, data[0]);
|
|
58
|
-
if (eval(this.replaceTokens(e.filter, toks)) === false) continue;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// If we are still waiting on mdns then blow this off.
|
|
62
|
-
if ((typeof opts.hostname === 'undefined' || !opts.hostname) && (typeof opts.host === 'undefined' || !opts.host || opts.host === '*')) {
|
|
63
|
-
logger.warn(`Interface: ${ this.cfg.name } Event: ${ e.name } has not resolved to a valid host.`);
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Put together the data object.
|
|
68
|
-
let sbody = '';
|
|
69
|
-
switch (this.cfg.contentType) {
|
|
70
|
-
//case 'application/json':
|
|
71
|
-
//case 'json':
|
|
72
|
-
default:
|
|
73
|
-
sbody = typeof e.body !== 'undefined' ? JSON.stringify(e.body) : '';
|
|
74
|
-
break;
|
|
75
|
-
// We may need an XML output and can add transforms for that
|
|
76
|
-
// later. There isn't a native xslt processor in node and most
|
|
77
|
-
// of them that I looked at seemed pretty amatuer hour or overbearing
|
|
78
|
-
// as they used SAX. => Need down and clean not down and dirty... we aren't building
|
|
79
|
-
// a web client at this point.
|
|
80
|
-
}
|
|
81
|
-
this.buildTokens(sbody, evt, toks, e, data[0]);
|
|
82
|
-
sbody = this.replaceTokens(sbody, toks);
|
|
83
|
-
for (let prop in opts) {
|
|
84
|
-
if (prop === 'headers') {
|
|
85
|
-
for (let header in opts.headers) {
|
|
86
|
-
this.buildTokens(opts.headers[header], evt, toks, e, data[0]);
|
|
87
|
-
opts.headers[header] = this.replaceTokens(opts.headers[header], toks);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else if (typeof opts[prop] === 'string') {
|
|
91
|
-
this.buildTokens(opts[prop], evt, toks, e, data[0]);
|
|
92
|
-
opts[prop] = this.replaceTokens(opts[prop] || '', toks);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (typeof opts.path !== 'undefined') opts.path = encodeURI(opts.path); // Encode the data just in case we have spaces.
|
|
96
|
-
// opts.headers["CONTENT-LENGTH"] = Buffer.byteLength(sbody || '');
|
|
97
|
-
logger.debug(`Sending [${evt}] request to ${this.cfg.name}: ${JSON.stringify(opts)}`);
|
|
98
|
-
let req: http.ClientRequest;
|
|
99
|
-
// We should now have all the tokens. Put together the request.
|
|
100
|
-
if (typeof sbody !== 'undefined') {
|
|
101
|
-
if (sbody.charAt(0) === '"' && sbody.charAt(sbody.length - 1) === '"') sbody = sbody.substr(1, sbody.length - 2);
|
|
102
|
-
opts.headers["CONTENT-LENGTH"] = Buffer.byteLength(sbody || '');
|
|
103
|
-
}
|
|
104
|
-
if (opts.port === 443 || (opts.protocol || '').startsWith('https')) {
|
|
105
|
-
opts.protocol = 'https:';
|
|
106
|
-
req = https.request(opts, (response: http.IncomingMessage) => {
|
|
107
|
-
//console.log(response);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
opts.protocol = 'http:';
|
|
112
|
-
req = http.request(opts, (response: http.IncomingMessage) => {
|
|
113
|
-
//console.log(response.statusCode);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
req.on('error', (err, req, res) => {
|
|
117
|
-
logger.error(`Error sending request for event ${evt}: ${err.message}`);
|
|
118
|
-
});
|
|
119
|
-
if (typeof sbody !== 'undefined') {
|
|
120
|
-
req.write(sbody);
|
|
121
|
-
}
|
|
122
|
-
req.end();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
class HttpInterfaceSocketEvent {
|
|
129
|
-
event: string;
|
|
130
|
-
description: string;
|
|
131
|
-
processor: (sock: HttpInterfaceSocketEvent, sys: PoolSystem, state: State, value: any) => void;
|
|
132
|
-
constructor(sock: any) {
|
|
133
|
-
this.event = sock.event;
|
|
134
|
-
if (typeof sock.processor !== 'undefined') {
|
|
135
|
-
let fnBody = Array.isArray(sock.processor) ? sock.processor.join('\n') : sock.processor;
|
|
136
|
-
try {
|
|
137
|
-
this.processor = new Function('sock', 'sys', 'state', 'value', fnBody) as (sock: HttpInterfaceSocketEvent, sys: PoolSystem, state: State, value: any) => void;
|
|
138
|
-
} catch (err) { logger.error(`Error compiling socket event processor: ${err} -- ${fnBody}`); }
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
export interface IHTTPInterfaceSocketEvent {
|
|
143
|
-
event: string,
|
|
144
|
-
description: string,
|
|
145
|
-
processor?: string
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
1
|
+
/* nodejs-poolController. An application to control pool equipment.
|
|
2
|
+
Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021, 2022.
|
|
3
|
+
Russell Goldin, tagyoureit. russ.goldin@gmail.com
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as
|
|
7
|
+
published by the Free Software Foundation, either version 3 of the
|
|
8
|
+
License, or (at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { HttpInterfaceServer } from "../../web/Server";
|
|
19
|
+
import * as http2 from "http2";
|
|
20
|
+
import * as http from "http";
|
|
21
|
+
import * as https from "https";
|
|
22
|
+
import extend=require("extend");
|
|
23
|
+
import { logger } from "../../logger/Logger";
|
|
24
|
+
import { PoolSystem, sys } from "../../controller/Equipment";
|
|
25
|
+
import { State, state } from "../../controller/State";
|
|
26
|
+
import { InterfaceContext, InterfaceEvent, BaseInterfaceBindings } from "./baseInterface";
|
|
27
|
+
|
|
28
|
+
export class HttpInterfaceBindings extends BaseInterfaceBindings {
|
|
29
|
+
constructor(cfg) {
|
|
30
|
+
super(cfg);
|
|
31
|
+
}
|
|
32
|
+
declare sockets: HttpInterfaceSocketEvent[];
|
|
33
|
+
public bindEvent(evt: string, ...data: any) {
|
|
34
|
+
// Find the binding by first looking for the specific event name.
|
|
35
|
+
// If that doesn't exist then look for the "*" (all events).
|
|
36
|
+
if (typeof this.events !== 'undefined') {
|
|
37
|
+
let evts = this.events.filter(elem => elem.name === evt);
|
|
38
|
+
// If we don't have an explicitly defined event then see if there is a default.
|
|
39
|
+
if (evts.length === 0) {
|
|
40
|
+
let e = this.events.find(elem => elem.name === '*');
|
|
41
|
+
evts = e ? [e] : [];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let baseOpts = extend(true, { headers: {} }, this.cfg.options, this.context.options);
|
|
45
|
+
if ((typeof baseOpts.hostname === 'undefined' || !baseOpts.hostname) && (typeof baseOpts.host === 'undefined' || !baseOpts.host || baseOpts.host === '*')) {
|
|
46
|
+
logger.warn(`Interface: ${ this.cfg.name } has not resolved to a valid host.`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (evts.length > 0) {
|
|
50
|
+
let toks = {};
|
|
51
|
+
for (let i = 0; i < evts.length; i++) {
|
|
52
|
+
let e = evts[i];
|
|
53
|
+
if (typeof e.enabled !== 'undefined' && !e.enabled) continue;
|
|
54
|
+
let opts = extend(true, baseOpts, e.options);
|
|
55
|
+
// Figure out whether we need to check the filter.
|
|
56
|
+
if (typeof e.filter !== 'undefined') {
|
|
57
|
+
this.buildTokens(e.filter, evt, toks, e, data[0]);
|
|
58
|
+
if (eval(this.replaceTokens(e.filter, toks)) === false) continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// If we are still waiting on mdns then blow this off.
|
|
62
|
+
if ((typeof opts.hostname === 'undefined' || !opts.hostname) && (typeof opts.host === 'undefined' || !opts.host || opts.host === '*')) {
|
|
63
|
+
logger.warn(`Interface: ${ this.cfg.name } Event: ${ e.name } has not resolved to a valid host.`);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Put together the data object.
|
|
68
|
+
let sbody = '';
|
|
69
|
+
switch (this.cfg.contentType) {
|
|
70
|
+
//case 'application/json':
|
|
71
|
+
//case 'json':
|
|
72
|
+
default:
|
|
73
|
+
sbody = typeof e.body !== 'undefined' ? JSON.stringify(e.body) : '';
|
|
74
|
+
break;
|
|
75
|
+
// We may need an XML output and can add transforms for that
|
|
76
|
+
// later. There isn't a native xslt processor in node and most
|
|
77
|
+
// of them that I looked at seemed pretty amatuer hour or overbearing
|
|
78
|
+
// as they used SAX. => Need down and clean not down and dirty... we aren't building
|
|
79
|
+
// a web client at this point.
|
|
80
|
+
}
|
|
81
|
+
this.buildTokens(sbody, evt, toks, e, data[0]);
|
|
82
|
+
sbody = this.replaceTokens(sbody, toks);
|
|
83
|
+
for (let prop in opts) {
|
|
84
|
+
if (prop === 'headers') {
|
|
85
|
+
for (let header in opts.headers) {
|
|
86
|
+
this.buildTokens(opts.headers[header], evt, toks, e, data[0]);
|
|
87
|
+
opts.headers[header] = this.replaceTokens(opts.headers[header], toks);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else if (typeof opts[prop] === 'string') {
|
|
91
|
+
this.buildTokens(opts[prop], evt, toks, e, data[0]);
|
|
92
|
+
opts[prop] = this.replaceTokens(opts[prop] || '', toks);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (typeof opts.path !== 'undefined') opts.path = encodeURI(opts.path); // Encode the data just in case we have spaces.
|
|
96
|
+
// opts.headers["CONTENT-LENGTH"] = Buffer.byteLength(sbody || '');
|
|
97
|
+
logger.debug(`Sending [${evt}] request to ${this.cfg.name}: ${JSON.stringify(opts)}`);
|
|
98
|
+
let req: http.ClientRequest;
|
|
99
|
+
// We should now have all the tokens. Put together the request.
|
|
100
|
+
if (typeof sbody !== 'undefined') {
|
|
101
|
+
if (sbody.charAt(0) === '"' && sbody.charAt(sbody.length - 1) === '"') sbody = sbody.substr(1, sbody.length - 2);
|
|
102
|
+
opts.headers["CONTENT-LENGTH"] = Buffer.byteLength(sbody || '');
|
|
103
|
+
}
|
|
104
|
+
if (opts.port === 443 || (opts.protocol || '').startsWith('https')) {
|
|
105
|
+
opts.protocol = 'https:';
|
|
106
|
+
req = https.request(opts, (response: http.IncomingMessage) => {
|
|
107
|
+
//console.log(response);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
opts.protocol = 'http:';
|
|
112
|
+
req = http.request(opts, (response: http.IncomingMessage) => {
|
|
113
|
+
//console.log(response.statusCode);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
req.on('error', (err, req, res) => {
|
|
117
|
+
logger.error(`Error sending request for event ${evt}: ${err.message}`);
|
|
118
|
+
});
|
|
119
|
+
if (typeof sbody !== 'undefined') {
|
|
120
|
+
req.write(sbody);
|
|
121
|
+
}
|
|
122
|
+
req.end();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
class HttpInterfaceSocketEvent {
|
|
129
|
+
event: string;
|
|
130
|
+
description: string;
|
|
131
|
+
processor: (sock: HttpInterfaceSocketEvent, sys: PoolSystem, state: State, value: any) => void;
|
|
132
|
+
constructor(sock: any) {
|
|
133
|
+
this.event = sock.event;
|
|
134
|
+
if (typeof sock.processor !== 'undefined') {
|
|
135
|
+
let fnBody = Array.isArray(sock.processor) ? sock.processor.join('\n') : sock.processor;
|
|
136
|
+
try {
|
|
137
|
+
this.processor = new Function('sock', 'sys', 'state', 'value', fnBody) as (sock: HttpInterfaceSocketEvent, sys: PoolSystem, state: State, value: any) => void;
|
|
138
|
+
} catch (err) { logger.error(`Error compiling socket event processor: ${err} -- ${fnBody}`); }
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export interface IHTTPInterfaceSocketEvent {
|
|
143
|
+
event: string,
|
|
144
|
+
description: string,
|
|
145
|
+
processor?: string
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|