elasticio-sailor-nodejs 3.0.0-sailor-proxy-dev6 → 3.0.0-sailor-proxy-dev8
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/.editorconfig +11 -0
- package/.eslintrc +73 -0
- package/lib/component_reader.js +2 -2
- package/lib/emitter.js +1 -2
- package/lib/encryptor.js +0 -1
- package/lib/executor.js +1 -2
- package/lib/hooksData.js +0 -2
- package/lib/logging.js +1 -2
- package/lib/proxy-client.js +10 -9
- package/lib/sailor.js +8 -10
- package/lib/service.js +2 -4
- package/lib/settings.js +2 -2
- package/package.json +59 -52
- package/run.js +3 -3
- package/run.local.js +3 -3
- package/.eslintrc.js +0 -16
package/.editorconfig
ADDED
package/.eslintrc
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"parserOptions": {
|
|
4
|
+
"ecmaVersion": 2018,
|
|
5
|
+
"sourceType": "script",
|
|
6
|
+
"ecmaFeatures": {
|
|
7
|
+
"impliedStrict": true
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"plugins": [
|
|
11
|
+
"eslint-plugin-mocha",
|
|
12
|
+
"security",
|
|
13
|
+
"node"
|
|
14
|
+
],
|
|
15
|
+
"extends": [
|
|
16
|
+
"standard",
|
|
17
|
+
"plugin:security/recommended"
|
|
18
|
+
],
|
|
19
|
+
"globals": {
|
|
20
|
+
"BigInt": true
|
|
21
|
+
},
|
|
22
|
+
"rules": {
|
|
23
|
+
"array-bracket-spacing": ["warn", "never"],
|
|
24
|
+
"no-prototype-builtins": "warn",
|
|
25
|
+
"object-curly-newline": ["warn", { "multiline": true, "consistent": true }],
|
|
26
|
+
"quote-props": ["warn", "as-needed"],
|
|
27
|
+
"lines-between-class-members": 0,
|
|
28
|
+
"dot-notation": ["warn", { "allowKeywords": true }],
|
|
29
|
+
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
|
|
30
|
+
"mocha/no-exclusive-tests": "error",
|
|
31
|
+
"mocha/no-skipped-tests": "error",
|
|
32
|
+
"mocha/no-identical-title": "error",
|
|
33
|
+
"node/no-deprecated-api": "warn",
|
|
34
|
+
"semi": [
|
|
35
|
+
"error",
|
|
36
|
+
"always"
|
|
37
|
+
],
|
|
38
|
+
"indent": [
|
|
39
|
+
"error",
|
|
40
|
+
4,
|
|
41
|
+
{ "SwitchCase": 1 }
|
|
42
|
+
],
|
|
43
|
+
"max-len": [
|
|
44
|
+
"warn",
|
|
45
|
+
120,
|
|
46
|
+
4,
|
|
47
|
+
{
|
|
48
|
+
"ignoreUrls": true,
|
|
49
|
+
"ignoreTemplateLiterals": true
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"space-before-function-paren": [
|
|
53
|
+
"warn",
|
|
54
|
+
{
|
|
55
|
+
"anonymous": "always",
|
|
56
|
+
"named": "never",
|
|
57
|
+
"asyncArrow": "always"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"curly": [
|
|
61
|
+
2,
|
|
62
|
+
"all"
|
|
63
|
+
],
|
|
64
|
+
"brace-style": [
|
|
65
|
+
"error",
|
|
66
|
+
"1tbs",
|
|
67
|
+
{
|
|
68
|
+
"allowSingleLine": false
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
package/lib/component_reader.js
CHANGED
|
@@ -82,8 +82,8 @@ ComponentReader.prototype.loadTriggerOrAction = async function loadTriggerOrActi
|
|
|
82
82
|
message = 'Failed to load file \'%s\': %s';
|
|
83
83
|
err.message = util.format(message, filename, err.message);
|
|
84
84
|
} else {
|
|
85
|
-
message = 'Trigger or action \'%s\' is found, but can not be loaded. '
|
|
86
|
-
|
|
85
|
+
message = 'Trigger or action \'%s\' is found, but can not be loaded. ' +
|
|
86
|
+
'Please check if the file \'%s\' is correct.';
|
|
87
87
|
err.message = util.format(message, name, filename);
|
|
88
88
|
}
|
|
89
89
|
|
package/lib/emitter.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* Object#toString reference.
|
|
6
5
|
*/
|
|
@@ -65,7 +64,7 @@ EventEmitter.prototype.once = function once(name, fn) {
|
|
|
65
64
|
|
|
66
65
|
function on() {
|
|
67
66
|
that.removeListener(name, on);
|
|
68
|
-
//eslint-disable-next-line no-invalid-this
|
|
67
|
+
// eslint-disable-next-line no-invalid-this
|
|
69
68
|
fn.apply(this, arguments);
|
|
70
69
|
}
|
|
71
70
|
|
package/lib/encryptor.js
CHANGED
package/lib/executor.js
CHANGED
|
@@ -14,7 +14,7 @@ class TaskExec extends EventEmitter {
|
|
|
14
14
|
this._services = services;
|
|
15
15
|
assert(this._services, 'TaskExec should be created with services');
|
|
16
16
|
assert(this._services.apiClient, 'TaskExec should be created with api client');
|
|
17
|
-
assert(this._services.config
|
|
17
|
+
assert(this._services.config, 'TaskExec should be created with config');
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
process(triggerOrAction, payload, cfg, snapshot) {
|
|
@@ -61,5 +61,4 @@ class TaskExec extends EventEmitter {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
65
64
|
exports.TaskExec = TaskExec;
|
package/lib/hooksData.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const { axiosReqWithRetryOnServerError } = require('elasticio-rest-node');
|
|
4
4
|
|
|
5
5
|
class HooksData {
|
|
6
|
-
|
|
7
6
|
constructor({
|
|
8
7
|
FLOW_ID: taskId,
|
|
9
8
|
API_USERNAME: user,
|
|
@@ -58,7 +57,6 @@ class HooksData {
|
|
|
58
57
|
delete() {
|
|
59
58
|
return this.request('DELETE');
|
|
60
59
|
}
|
|
61
|
-
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
module.exports.startup = function startup(settings) {
|
package/lib/logging.js
CHANGED
|
@@ -69,7 +69,7 @@ function ComponentLogger(options) {
|
|
|
69
69
|
.child(options);
|
|
70
70
|
|
|
71
71
|
function decorateLogger(destination, logger) {
|
|
72
|
-
for (
|
|
72
|
+
for (const type of ['trace', 'debug', 'info', 'warn', 'error', 'fatal']) {
|
|
73
73
|
const originalMethod = logger[type];
|
|
74
74
|
destination[type] = function log() {
|
|
75
75
|
const args = Array.prototype.slice.call(arguments);
|
|
@@ -91,7 +91,6 @@ function ComponentLogger(options) {
|
|
|
91
91
|
decorateLogger(this, logger);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
95
94
|
module.exports = log;
|
|
96
95
|
module.exports.ComponentLogger = ComponentLogger;
|
|
97
96
|
module.exports.criticalErrorAndExit = criticalErrorAndExit;
|
package/lib/proxy-client.js
CHANGED
|
@@ -91,7 +91,9 @@ class ProxyClient {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
_setupConnectionListeners() {
|
|
94
|
-
if (!this.clientSession)
|
|
94
|
+
if (!this.clientSession) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
95
97
|
|
|
96
98
|
// Handle connection errors
|
|
97
99
|
this.clientSession.on('error', (err) => {
|
|
@@ -380,7 +382,7 @@ class ProxyClient {
|
|
|
380
382
|
|
|
381
383
|
postMessageStream.on('end', () => {
|
|
382
384
|
if (!responseData) {
|
|
383
|
-
return
|
|
385
|
+
return;
|
|
384
386
|
}
|
|
385
387
|
try {
|
|
386
388
|
const responseJson = JSON.parse(responseData);
|
|
@@ -482,7 +484,7 @@ class ProxyClient {
|
|
|
482
484
|
log.info('Stopping listening for messages');
|
|
483
485
|
await Promise.all(Array.from(this.getMessageStreams).map(stream => {
|
|
484
486
|
if (stream.closed || stream.destroyed) {
|
|
485
|
-
log.debug({ closed: stream.closed, destroyed: stream.destroyed
|
|
487
|
+
log.debug({ closed: stream.closed, destroyed: stream.destroyed }, 'Message stream is already closed or destroyed');
|
|
486
488
|
return Promise.resolve();
|
|
487
489
|
}
|
|
488
490
|
return new Promise((resolve) => {
|
|
@@ -502,10 +504,9 @@ class ProxyClient {
|
|
|
502
504
|
} else if (type === 'http-reply') {
|
|
503
505
|
protocolVersion = 1;
|
|
504
506
|
}
|
|
505
|
-
let preparedData;
|
|
507
|
+
let preparedData = data;
|
|
506
508
|
if (protocolVersion) {
|
|
507
509
|
preparedData = this.encryptMessageContent(data, protocolVersion);
|
|
508
|
-
proxyHeaders.protocolVersion = protocolVersion;
|
|
509
510
|
}
|
|
510
511
|
const proxyHeaders = this._createProxyHeaders({ ...headers, protocolVersion });
|
|
511
512
|
return {
|
|
@@ -530,10 +531,10 @@ class ProxyClient {
|
|
|
530
531
|
|
|
531
532
|
log.debug({ incomingMessageId, type, headers }, 'Sending message to proxy');
|
|
532
533
|
log.trace({ data }, 'Message data to send to proxy');
|
|
533
|
-
const { proxyHeaders, preparedData }
|
|
534
|
+
const { proxyHeaders, preparedData } = this._prepareData(data, headers, type);
|
|
534
535
|
if (preparedData.length > this.settings.OUTGOING_MESSAGE_SIZE_LIMIT) {
|
|
535
|
-
const error = new Error(`Outgoing message size ${preparedData.length}`
|
|
536
|
-
|
|
536
|
+
const error = new Error(`Outgoing message size ${preparedData.length}` +
|
|
537
|
+
` exceeds limit of ${this.settings.OUTGOING_MESSAGE_SIZE_LIMIT}.`);
|
|
537
538
|
log.error(error);
|
|
538
539
|
throw error;
|
|
539
540
|
}
|
|
@@ -693,7 +694,7 @@ class ProxyClient {
|
|
|
693
694
|
}
|
|
694
695
|
const errorPayload = JSON.stringify(payload);
|
|
695
696
|
|
|
696
|
-
|
|
697
|
+
const result = await this.sendMessage({
|
|
697
698
|
incomingMessageId: incomingHeaders ? incomingHeaders.messageId : undefined,
|
|
698
699
|
type: 'error',
|
|
699
700
|
data: errorPayload,
|
package/lib/sailor.js
CHANGED
|
@@ -32,7 +32,7 @@ class Sailor {
|
|
|
32
32
|
this.stepData = {};
|
|
33
33
|
this.shutdownCallback = null;
|
|
34
34
|
// TODO move endpoint to proxy
|
|
35
|
-
//eslint-disable-next-line new-cap
|
|
35
|
+
// eslint-disable-next-line new-cap
|
|
36
36
|
this.apiClient = RestApiClient(
|
|
37
37
|
settings.API_USERNAME,
|
|
38
38
|
settings.API_KEY,
|
|
@@ -97,7 +97,7 @@ class Sailor {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
startup() {
|
|
100
|
-
return co(function* doStartup() {
|
|
100
|
+
return co(function * doStartup() {
|
|
101
101
|
log.debug('Starting up component');
|
|
102
102
|
const result = yield this.invokeModuleFunction('startup');
|
|
103
103
|
log.trace('Startup data received');
|
|
@@ -121,7 +121,7 @@ class Sailor {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
runHookShutdown() {
|
|
124
|
-
return co(function* doShutdown() {
|
|
124
|
+
return co(function * doShutdown() {
|
|
125
125
|
log.debug('About to shut down');
|
|
126
126
|
const handle = hooksData.startup(this.settings);
|
|
127
127
|
const state = yield handle.retrieve();
|
|
@@ -132,7 +132,7 @@ class Sailor {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
runHookInit() {
|
|
135
|
-
return co(function* doInit() {
|
|
135
|
+
return co(function * doInit() {
|
|
136
136
|
log.debug('About to initialize component for execution');
|
|
137
137
|
const res = yield this.invokeModuleFunction('init');
|
|
138
138
|
log.debug('Component execution initialized successfully');
|
|
@@ -143,7 +143,7 @@ class Sailor {
|
|
|
143
143
|
invokeModuleFunction(moduleFunction, data) {
|
|
144
144
|
const settings = this.settings;
|
|
145
145
|
const stepData = this.stepData;
|
|
146
|
-
return co(function* gen() {
|
|
146
|
+
return co(function * gen() {
|
|
147
147
|
const module = yield this.componentReader.loadTriggerOrAction(settings.FUNCTION);
|
|
148
148
|
if (!module[moduleFunction]) {
|
|
149
149
|
log.warn(`invokeModuleFunction – ${moduleFunction} is not found`);
|
|
@@ -318,7 +318,6 @@ class Sailor {
|
|
|
318
318
|
[OBJECT_ID_HEADER]: bodyId
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
|
-
|
|
322
321
|
} else {
|
|
323
322
|
logger.trace(
|
|
324
323
|
'Message size is below threshold.',
|
|
@@ -410,7 +409,7 @@ class Sailor {
|
|
|
410
409
|
async function onSnapshot(data) {
|
|
411
410
|
const headers = _.clone(outgoingMessageHeaders);
|
|
412
411
|
headers.snapshotEvent = 'snapshot';
|
|
413
|
-
that.snapshot = data; //replacing `local` snapshot
|
|
412
|
+
that.snapshot = data; // replacing `local` snapshot
|
|
414
413
|
return that.proxyClient.sendSnapshot(data, headers);
|
|
415
414
|
}
|
|
416
415
|
|
|
@@ -422,7 +421,7 @@ class Sailor {
|
|
|
422
421
|
if (data.$set) {
|
|
423
422
|
return log.warn('ERROR: $set is not supported any more in `updateSnapshot` event');
|
|
424
423
|
}
|
|
425
|
-
_.extend(that.snapshot, data); //updating `local` snapshot
|
|
424
|
+
_.extend(that.snapshot, data); // updating `local` snapshot
|
|
426
425
|
return that.proxyClient.sendSnapshot(data, headers);
|
|
427
426
|
} else {
|
|
428
427
|
log.error('You should pass an object to the `updateSnapshot` event');
|
|
@@ -471,7 +470,6 @@ class Sailor {
|
|
|
471
470
|
}
|
|
472
471
|
});
|
|
473
472
|
|
|
474
|
-
|
|
475
473
|
function formatError(err) {
|
|
476
474
|
if (err instanceof Error || (_.isObject(err) && _.has(err, 'message'))) {
|
|
477
475
|
return {
|
|
@@ -490,7 +488,7 @@ class Sailor {
|
|
|
490
488
|
}
|
|
491
489
|
|
|
492
490
|
async processMessage(headers, payload) {
|
|
493
|
-
//eslint-disable-next-line consistent-this
|
|
491
|
+
// eslint-disable-next-line consistent-this
|
|
494
492
|
const self = this;
|
|
495
493
|
const settings = this.settings;
|
|
496
494
|
|
package/lib/service.js
CHANGED
|
@@ -36,7 +36,6 @@ class ServiceExec extends EventEmitter {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function processService(serviceMethod, env) {
|
|
39
|
-
|
|
40
39
|
var ALLOWED_METHODS = {
|
|
41
40
|
verifyCredentials: verifyCredentials,
|
|
42
41
|
getMetaModel: getMetaModel,
|
|
@@ -95,7 +94,7 @@ function processService(serviceMethod, env) {
|
|
|
95
94
|
triggerOrAction: ACTION_OR_TRIGGER,
|
|
96
95
|
getModelMethod: GET_MODEL_METHOD
|
|
97
96
|
};
|
|
98
|
-
//eslint-disable-next-line new-cap
|
|
97
|
+
// eslint-disable-next-line new-cap
|
|
99
98
|
apiClient = RestApiClient(API_USERNAME, API_KEY, {
|
|
100
99
|
retryCount: parseInt(env.ELASTICIO_API_REQUEST_RETRY_ATTEMPTS),
|
|
101
100
|
retryDelay: parseInt(env.ELASTICIO_API_REQUEST_RETRY_DELAY)
|
|
@@ -162,9 +161,8 @@ function processService(serviceMethod, env) {
|
|
|
162
161
|
.then(() => responseBody);
|
|
163
162
|
|
|
164
163
|
function checkStatusCode(response) {
|
|
165
|
-
//eslint-disable-next-line eqeqeq
|
|
164
|
+
// eslint-disable-next-line eqeqeq
|
|
166
165
|
if (response.statusCode != '200') {
|
|
167
|
-
|
|
168
166
|
debug('Unable to reach API :(');
|
|
169
167
|
|
|
170
168
|
var error = new Error(util.format(
|
package/lib/settings.js
CHANGED
|
@@ -36,7 +36,7 @@ function getOptionalEnvVars(envVars) {
|
|
|
36
36
|
NO_SELF_PASSTRHOUGH: false,
|
|
37
37
|
PROTOCOL_VERSION: 1,
|
|
38
38
|
INPUT_FORMAT: 'default',
|
|
39
|
-
EMIT_LIGHTWEIGHT_MESSAGE: false
|
|
39
|
+
EMIT_LIGHTWEIGHT_MESSAGE: false
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const result = {};
|
|
@@ -48,7 +48,7 @@ function getOptionalEnvVars(envVars) {
|
|
|
48
48
|
if (envVars[envVarName] === undefined) {
|
|
49
49
|
result[key] = defaultValue;
|
|
50
50
|
} else {
|
|
51
|
-
result[key] = (!envVars[envVarName] || envVars[envVarName] === 'false')
|
|
51
|
+
result[key] = !((!envVars[envVarName] || envVars[envVarName] === 'false'));
|
|
52
52
|
}
|
|
53
53
|
} else {
|
|
54
54
|
result[key] = envVars[envVarName] || defaultValue;
|
package/package.json
CHANGED
|
@@ -1,54 +1,61 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
2
|
+
"name": "elasticio-sailor-nodejs",
|
|
3
|
+
"description": "The official elastic.io library for bootstrapping and executing for Node.js connectors",
|
|
4
|
+
"version": "3.0.0-sailor-proxy-dev8",
|
|
5
|
+
"main": "run.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"audit": "better-npm-audit audit --level high --production",
|
|
9
|
+
"pretest": "npm run lint",
|
|
10
|
+
"lint": "eslint --ext ts,js .",
|
|
11
|
+
"test": "npm run test:jasmine && npm run test:mocha",
|
|
12
|
+
"test:jasmine": "NODE_ENV=test jasmine-node spec",
|
|
13
|
+
"test:mocha": "NODE_ENV=test node_modules/.bin/mocha --recursive mocha_spec",
|
|
14
|
+
"postpublish": "./postpublish.js",
|
|
15
|
+
"dev:local": "node run.local.js | bunyan"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=12.13.0"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"bunyan": "1.8.10",
|
|
22
|
+
"co": "4.6.0",
|
|
23
|
+
"debug": "3.1.0",
|
|
24
|
+
"elasticio-rest-node": "2.0.0",
|
|
25
|
+
"event-to-promise": "0.8.0",
|
|
26
|
+
"lodash": "4.17.21",
|
|
27
|
+
"p-throttle": "2.1.0",
|
|
28
|
+
"q": "1.5.1",
|
|
29
|
+
"uuid": "3.0.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"better-npm-audit": "3.7.3",
|
|
33
|
+
"chai": "4.2.0",
|
|
34
|
+
"del": "2.2.2",
|
|
35
|
+
"eslint": "6.2.2",
|
|
36
|
+
"eslint-plugin-mocha": "4.12.1",
|
|
37
|
+
"eslint-config-standard": "14.1.0",
|
|
38
|
+
"eslint-plugin-import": "2.20.1",
|
|
39
|
+
"eslint-plugin-mocha": "6.3.0",
|
|
40
|
+
"eslint-plugin-node": "11.0.0",
|
|
41
|
+
"eslint-plugin-promise": "4.2.1",
|
|
42
|
+
"eslint-plugin-security": "1.4.0",
|
|
43
|
+
"eslint-plugin-standard": "4.0.1",
|
|
44
|
+
"express": "4.16.4",
|
|
45
|
+
"gulp": "3.9.1",
|
|
46
|
+
"gulp-istanbul": "1.1.3",
|
|
47
|
+
"gulp-jasmine": "0.2.0",
|
|
48
|
+
"jasmine-node": "3.0.0",
|
|
49
|
+
"mocha": "7.1.2",
|
|
50
|
+
"nock": "12.0.3",
|
|
51
|
+
"rabbitmq-stats": "1.2.4",
|
|
52
|
+
"request": "2.88.0",
|
|
53
|
+
"request-promise-native": "1.0.5",
|
|
54
|
+
"sinon": "9.0.2",
|
|
55
|
+
"sinon-chai": "3.5.0",
|
|
56
|
+
"ts-node": "10.4.0",
|
|
57
|
+
"typescript": "4.4.4"
|
|
58
|
+
},
|
|
59
|
+
"repository": "elasticio/sailor-nodejs",
|
|
60
|
+
"license": "Apache-2.0"
|
|
54
61
|
}
|
package/run.js
CHANGED
|
@@ -30,11 +30,11 @@ async function putOutToSea(settings, ipc) {
|
|
|
30
30
|
sailorInit = deferred.promise;
|
|
31
31
|
sailor = new Sailor(settings);
|
|
32
32
|
|
|
33
|
-
//eslint-disable-next-line no-extra-boolean-cast
|
|
33
|
+
// eslint-disable-next-line no-extra-boolean-cast
|
|
34
34
|
if (!!settings.HOOK_SHUTDOWN) {
|
|
35
35
|
logger.trace('Running hook shutdown');
|
|
36
36
|
disconnectRequired = false;
|
|
37
|
-
//eslint-disable-next-line no-empty-function
|
|
37
|
+
// eslint-disable-next-line no-empty-function
|
|
38
38
|
sailor.reportError = () => {
|
|
39
39
|
};
|
|
40
40
|
await sailor.prepare();
|
|
@@ -46,7 +46,7 @@ async function putOutToSea(settings, ipc) {
|
|
|
46
46
|
await sailor.connect();
|
|
47
47
|
await sailor.prepare();
|
|
48
48
|
|
|
49
|
-
//eslint-disable-next-line no-extra-boolean-cast
|
|
49
|
+
// eslint-disable-next-line no-extra-boolean-cast
|
|
50
50
|
if (!!settings.STARTUP_REQUIRED) {
|
|
51
51
|
await sailor.startup();
|
|
52
52
|
}
|
package/run.local.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const config = require('./config/local.json');
|
|
2
2
|
|
|
3
3
|
function setEnvVars() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
for (const [key, value] of Object.entries(config)) {
|
|
5
|
+
process.env[key] = value;
|
|
6
|
+
}
|
|
7
7
|
}
|
|
8
8
|
setEnvVars();
|
|
9
9
|
|
package/.eslintrc.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
globals: {
|
|
3
|
-
NodeJS: 'readonly',
|
|
4
|
-
BufferEncoding: 'readonly',
|
|
5
|
-
},
|
|
6
|
-
parser: '@typescript-eslint/parser',
|
|
7
|
-
extends: [
|
|
8
|
-
'plugin:@typescript-eslint/recommended',
|
|
9
|
-
],
|
|
10
|
-
plugins: ['@typescript-eslint'],
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaVersion: 2018,
|
|
13
|
-
sourceType: 'module'
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|