elasticio-sailor-nodejs 2.7.1-dev3 → 2.7.1-dev5
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.js +150 -150
- package/.github/CODEOWNERS +8 -8
- package/.nsprc +18 -18
- package/CHANGELOG.md +144 -144
- package/README.md +247 -247
- package/lib/amqp.js +584 -584
- package/lib/component_reader.js +109 -109
- package/lib/emitter.js +198 -198
- package/lib/encryptor.js +114 -114
- package/lib/executor.js +74 -74
- package/lib/hooksData.js +68 -68
- package/lib/ipc.js +13 -13
- package/lib/logging.js +97 -97
- package/lib/sailor.js +669 -665
- package/lib/service.js +294 -294
- package/lib/settings.js +126 -126
- package/package.json +53 -53
- package/postpublish.js +24 -24
- package/run.js +139 -139
- package/runService.js +19 -19
- package/test.json +51 -0
- package/testOk.json +51 -0
- package/testOk1.json +51 -0
package/lib/encryptor.js
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
const crypto = require('crypto');
|
|
2
|
-
const log = require('./logging.js');
|
|
3
|
-
|
|
4
|
-
class Encryptor {
|
|
5
|
-
constructor(password, iv) {
|
|
6
|
-
this._cryptoPassword = password;
|
|
7
|
-
this._cryptoIV = iv;
|
|
8
|
-
if (this._cryptoPassword) {
|
|
9
|
-
this._encryptionKey = crypto
|
|
10
|
-
.createHash('sha256')
|
|
11
|
-
.update(this._cryptoPassword, 'utf-8')
|
|
12
|
-
.digest();
|
|
13
|
-
if (!this._cryptoIV) {
|
|
14
|
-
throw new Error(
|
|
15
|
-
`missing crypt initialiazation vector,
|
|
16
|
-
most likely ELASTICIO_MESSAGE_CRYPTO_PASSWORD env var is not set
|
|
17
|
-
`
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
this._algorithm = 'aes-256-cbc';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
createCipher() {
|
|
25
|
-
return crypto.createCipheriv(
|
|
26
|
-
this._algorithm,
|
|
27
|
-
this._encryptionKey,
|
|
28
|
-
this._cryptoIV
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
createDecipher() {
|
|
33
|
-
return crypto.createDecipheriv(
|
|
34
|
-
this._algorithm,
|
|
35
|
-
this._encryptionKey,
|
|
36
|
-
this._cryptoIV
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Encrypt message to proper format
|
|
43
|
-
* @param {*} messagePayload anything json-stringifiable
|
|
44
|
-
* @param {'hex'|'base64'|'utf-8',undefined} outputEncoding
|
|
45
|
-
* @returns {Buffer}
|
|
46
|
-
*/
|
|
47
|
-
encryptMessageContent(messagePayload, outputEncoding) {
|
|
48
|
-
const encryptedBuffer = this._encryptToBuffer(JSON.stringify(messagePayload));
|
|
49
|
-
if (outputEncoding) {
|
|
50
|
-
return Buffer.from(encryptedBuffer.toString(outputEncoding));
|
|
51
|
-
} else {
|
|
52
|
-
return encryptedBuffer;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Encrypt message to proper format
|
|
58
|
-
* @param {Buffer} messagePayload
|
|
59
|
-
* @param {'hex'|'base64'|'utf-8',undefined} inputEncoding
|
|
60
|
-
* @returns {*} anything, what have been encrypted
|
|
61
|
-
*/
|
|
62
|
-
decryptMessageContent(messagePayload, inputEncoding) {
|
|
63
|
-
if (!messagePayload || messagePayload.length === 0) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
let encryptedBuffer;
|
|
67
|
-
if (inputEncoding) {
|
|
68
|
-
encryptedBuffer = Buffer.from(messagePayload.toString(), inputEncoding);
|
|
69
|
-
} else {
|
|
70
|
-
encryptedBuffer = messagePayload;
|
|
71
|
-
}
|
|
72
|
-
try {
|
|
73
|
-
const decryptedMessage = this._decryptFromBuffer(encryptedBuffer);
|
|
74
|
-
return JSON.parse(decryptedMessage);
|
|
75
|
-
} catch (err) {
|
|
76
|
-
log.error(err, 'Failed to decrypt message');
|
|
77
|
-
throw Error('Failed to decrypt message: ' + err.message);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Encrypt payload.
|
|
83
|
-
* @param {Buffer|String} message
|
|
84
|
-
* @returns {Buffer}
|
|
85
|
-
*/
|
|
86
|
-
_encryptToBuffer(message) {
|
|
87
|
-
if (!this._encryptionKey) {
|
|
88
|
-
return Buffer.from(message);
|
|
89
|
-
}
|
|
90
|
-
const cipher = this.createCipher();
|
|
91
|
-
return Buffer.concat([
|
|
92
|
-
cipher.update(message),
|
|
93
|
-
cipher.final()
|
|
94
|
-
]);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Decrypt payload.
|
|
99
|
-
* @param {Buffer} message
|
|
100
|
-
* @returns {String}
|
|
101
|
-
*/
|
|
102
|
-
_decryptFromBuffer(message) {
|
|
103
|
-
if (!this._encryptionKey) {
|
|
104
|
-
return message.toString();
|
|
105
|
-
}
|
|
106
|
-
const decipher = this.createDecipher();
|
|
107
|
-
|
|
108
|
-
return Buffer.concat([
|
|
109
|
-
decipher.update(message),
|
|
110
|
-
decipher.final()
|
|
111
|
-
]).toString('utf8');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
module.exports = Encryptor;
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
const log = require('./logging.js');
|
|
3
|
+
|
|
4
|
+
class Encryptor {
|
|
5
|
+
constructor(password, iv) {
|
|
6
|
+
this._cryptoPassword = password;
|
|
7
|
+
this._cryptoIV = iv;
|
|
8
|
+
if (this._cryptoPassword) {
|
|
9
|
+
this._encryptionKey = crypto
|
|
10
|
+
.createHash('sha256')
|
|
11
|
+
.update(this._cryptoPassword, 'utf-8')
|
|
12
|
+
.digest();
|
|
13
|
+
if (!this._cryptoIV) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
`missing crypt initialiazation vector,
|
|
16
|
+
most likely ELASTICIO_MESSAGE_CRYPTO_PASSWORD env var is not set
|
|
17
|
+
`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
this._algorithm = 'aes-256-cbc';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
createCipher() {
|
|
25
|
+
return crypto.createCipheriv(
|
|
26
|
+
this._algorithm,
|
|
27
|
+
this._encryptionKey,
|
|
28
|
+
this._cryptoIV
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
createDecipher() {
|
|
33
|
+
return crypto.createDecipheriv(
|
|
34
|
+
this._algorithm,
|
|
35
|
+
this._encryptionKey,
|
|
36
|
+
this._cryptoIV
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Encrypt message to proper format
|
|
43
|
+
* @param {*} messagePayload anything json-stringifiable
|
|
44
|
+
* @param {'hex'|'base64'|'utf-8',undefined} outputEncoding
|
|
45
|
+
* @returns {Buffer}
|
|
46
|
+
*/
|
|
47
|
+
encryptMessageContent(messagePayload, outputEncoding) {
|
|
48
|
+
const encryptedBuffer = this._encryptToBuffer(JSON.stringify(messagePayload));
|
|
49
|
+
if (outputEncoding) {
|
|
50
|
+
return Buffer.from(encryptedBuffer.toString(outputEncoding));
|
|
51
|
+
} else {
|
|
52
|
+
return encryptedBuffer;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Encrypt message to proper format
|
|
58
|
+
* @param {Buffer} messagePayload
|
|
59
|
+
* @param {'hex'|'base64'|'utf-8',undefined} inputEncoding
|
|
60
|
+
* @returns {*} anything, what have been encrypted
|
|
61
|
+
*/
|
|
62
|
+
decryptMessageContent(messagePayload, inputEncoding) {
|
|
63
|
+
if (!messagePayload || messagePayload.length === 0) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
let encryptedBuffer;
|
|
67
|
+
if (inputEncoding) {
|
|
68
|
+
encryptedBuffer = Buffer.from(messagePayload.toString(), inputEncoding);
|
|
69
|
+
} else {
|
|
70
|
+
encryptedBuffer = messagePayload;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const decryptedMessage = this._decryptFromBuffer(encryptedBuffer);
|
|
74
|
+
return JSON.parse(decryptedMessage);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
log.error(err, 'Failed to decrypt message');
|
|
77
|
+
throw Error('Failed to decrypt message: ' + err.message);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Encrypt payload.
|
|
83
|
+
* @param {Buffer|String} message
|
|
84
|
+
* @returns {Buffer}
|
|
85
|
+
*/
|
|
86
|
+
_encryptToBuffer(message) {
|
|
87
|
+
if (!this._encryptionKey) {
|
|
88
|
+
return Buffer.from(message);
|
|
89
|
+
}
|
|
90
|
+
const cipher = this.createCipher();
|
|
91
|
+
return Buffer.concat([
|
|
92
|
+
cipher.update(message),
|
|
93
|
+
cipher.final()
|
|
94
|
+
]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Decrypt payload.
|
|
99
|
+
* @param {Buffer} message
|
|
100
|
+
* @returns {String}
|
|
101
|
+
*/
|
|
102
|
+
_decryptFromBuffer(message) {
|
|
103
|
+
if (!this._encryptionKey) {
|
|
104
|
+
return message.toString();
|
|
105
|
+
}
|
|
106
|
+
const decipher = this.createDecipher();
|
|
107
|
+
|
|
108
|
+
return Buffer.concat([
|
|
109
|
+
decipher.update(message),
|
|
110
|
+
decipher.final()
|
|
111
|
+
]).toString('utf8');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
module.exports = Encryptor;
|
package/lib/executor.js
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
const assert = require('assert');
|
|
2
|
-
const _ = require('lodash');
|
|
3
|
-
const EventEmitter = require('./emitter').EventEmitter;
|
|
4
|
-
|
|
5
|
-
const { ComponentLogger } = require('./logging');
|
|
6
|
-
|
|
7
|
-
class TaskExec extends EventEmitter {
|
|
8
|
-
constructor({ loggerOptions, variables, services } = {}) {
|
|
9
|
-
super();
|
|
10
|
-
this.errorCount = 0;
|
|
11
|
-
this.logger = new ComponentLogger(loggerOptions);
|
|
12
|
-
// copy variables to protect from outside changes;
|
|
13
|
-
this._variables = Object.assign({}, variables || {});
|
|
14
|
-
this._services = services;
|
|
15
|
-
assert(this._services, 'TaskExec should be created with services');
|
|
16
|
-
assert(this._services.apiClient, 'TaskExec should be created with api client');
|
|
17
|
-
assert(this._services.config , 'TaskExec should be created with config');
|
|
18
|
-
assert(this._services.amqp, 'TaskExec should be created with ampq');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
process(triggerOrAction, payload, cfg, snapshot) {
|
|
22
|
-
const onError = async (err) => {
|
|
23
|
-
this.logger.error('Error occurred during trigger or action processing');
|
|
24
|
-
await this.emit('error', err);
|
|
25
|
-
await this.emit('end');
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
if (!_.isFunction(triggerOrAction.process)) {
|
|
29
|
-
return onError(new Error('Process function is not found'));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
new Promise(resolve => {
|
|
33
|
-
const result = triggerOrAction.process.bind(this)(payload, cfg, snapshot);
|
|
34
|
-
if (result) {
|
|
35
|
-
resolve(result);
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
.then(async (data) => {
|
|
39
|
-
if (data) {
|
|
40
|
-
this.logger.debug('Process function is a Promise/generator/etc');
|
|
41
|
-
await this.emit('data', data);
|
|
42
|
-
}
|
|
43
|
-
await this.emit('end');
|
|
44
|
-
})
|
|
45
|
-
.catch(onError);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
getApiClient() {
|
|
49
|
-
return this._services.apiClient;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
getConfig() {
|
|
53
|
-
return this._services.config;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Get amqp connection wrapper. Internal.
|
|
58
|
-
* Should be used only or really special cases
|
|
59
|
-
*/
|
|
60
|
-
__getAmqp() {
|
|
61
|
-
return this._services.amqp;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Returns flow variables or empty object
|
|
66
|
-
* @returns {Object<String, String>}
|
|
67
|
-
*/
|
|
68
|
-
getFlowVariables() {
|
|
69
|
-
return this._variables;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
exports.TaskExec = TaskExec;
|
|
1
|
+
const assert = require('assert');
|
|
2
|
+
const _ = require('lodash');
|
|
3
|
+
const EventEmitter = require('./emitter').EventEmitter;
|
|
4
|
+
|
|
5
|
+
const { ComponentLogger } = require('./logging');
|
|
6
|
+
|
|
7
|
+
class TaskExec extends EventEmitter {
|
|
8
|
+
constructor({ loggerOptions, variables, services } = {}) {
|
|
9
|
+
super();
|
|
10
|
+
this.errorCount = 0;
|
|
11
|
+
this.logger = new ComponentLogger(loggerOptions);
|
|
12
|
+
// copy variables to protect from outside changes;
|
|
13
|
+
this._variables = Object.assign({}, variables || {});
|
|
14
|
+
this._services = services;
|
|
15
|
+
assert(this._services, 'TaskExec should be created with services');
|
|
16
|
+
assert(this._services.apiClient, 'TaskExec should be created with api client');
|
|
17
|
+
assert(this._services.config , 'TaskExec should be created with config');
|
|
18
|
+
assert(this._services.amqp, 'TaskExec should be created with ampq');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
process(triggerOrAction, payload, cfg, snapshot) {
|
|
22
|
+
const onError = async (err) => {
|
|
23
|
+
this.logger.error('Error occurred during trigger or action processing');
|
|
24
|
+
await this.emit('error', err);
|
|
25
|
+
await this.emit('end');
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
if (!_.isFunction(triggerOrAction.process)) {
|
|
29
|
+
return onError(new Error('Process function is not found'));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
new Promise(resolve => {
|
|
33
|
+
const result = triggerOrAction.process.bind(this)(payload, cfg, snapshot);
|
|
34
|
+
if (result) {
|
|
35
|
+
resolve(result);
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
.then(async (data) => {
|
|
39
|
+
if (data) {
|
|
40
|
+
this.logger.debug('Process function is a Promise/generator/etc');
|
|
41
|
+
await this.emit('data', data);
|
|
42
|
+
}
|
|
43
|
+
await this.emit('end');
|
|
44
|
+
})
|
|
45
|
+
.catch(onError);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getApiClient() {
|
|
49
|
+
return this._services.apiClient;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getConfig() {
|
|
53
|
+
return this._services.config;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get amqp connection wrapper. Internal.
|
|
58
|
+
* Should be used only or really special cases
|
|
59
|
+
*/
|
|
60
|
+
__getAmqp() {
|
|
61
|
+
return this._services.amqp;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns flow variables or empty object
|
|
66
|
+
* @returns {Object<String, String>}
|
|
67
|
+
*/
|
|
68
|
+
getFlowVariables() {
|
|
69
|
+
return this._variables;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
exports.TaskExec = TaskExec;
|
package/lib/hooksData.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const request = require('requestretry');
|
|
4
|
-
|
|
5
|
-
class HooksData {
|
|
6
|
-
|
|
7
|
-
constructor({
|
|
8
|
-
FLOW_ID: taskId,
|
|
9
|
-
API_USERNAME: user,
|
|
10
|
-
API_KEY: pass,
|
|
11
|
-
API_URI: basePath,
|
|
12
|
-
API_REQUEST_RETRY_ATTEMPTS: maxAttempts,
|
|
13
|
-
API_REQUEST_RETRY_DELAY: retryDelay
|
|
14
|
-
}) {
|
|
15
|
-
this.taskId = taskId;
|
|
16
|
-
this.user = user;
|
|
17
|
-
this.pass = pass;
|
|
18
|
-
this.basePath = basePath;
|
|
19
|
-
this.maxAttempts = maxAttempts;
|
|
20
|
-
this.retryDelay = retryDelay;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async request(method, data) {
|
|
24
|
-
const options = {
|
|
25
|
-
url: `${this.basePath}/sailor-support/hooks/task/${this.taskId}/startup/data`,
|
|
26
|
-
method,
|
|
27
|
-
auth: {
|
|
28
|
-
user: this.user,
|
|
29
|
-
pass: this.pass
|
|
30
|
-
},
|
|
31
|
-
json: true,
|
|
32
|
-
forever: true,
|
|
33
|
-
headers: {
|
|
34
|
-
Connection: 'Keep-Alive'
|
|
35
|
-
},
|
|
36
|
-
maxAttempts: this.maxAttempts,
|
|
37
|
-
retryDelay: this.retryDelay,
|
|
38
|
-
retryStrategy: request.RetryStrategies.HTTPOrNetworkError
|
|
39
|
-
};
|
|
40
|
-
if (data) {
|
|
41
|
-
options.body = data;
|
|
42
|
-
}
|
|
43
|
-
const { statusCode, body } = await request(options);
|
|
44
|
-
|
|
45
|
-
if (statusCode >= 400) {
|
|
46
|
-
throw Object.assign(new Error(body.error), { statusCode });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return body;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
create(data) {
|
|
53
|
-
return this.request('POST', data);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
retrieve() {
|
|
57
|
-
return this.request('GET');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
delete() {
|
|
61
|
-
return this.request('DELETE');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
module.exports.startup = function startup(settings) {
|
|
67
|
-
return new HooksData(settings);
|
|
68
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const request = require('requestretry');
|
|
4
|
+
|
|
5
|
+
class HooksData {
|
|
6
|
+
|
|
7
|
+
constructor({
|
|
8
|
+
FLOW_ID: taskId,
|
|
9
|
+
API_USERNAME: user,
|
|
10
|
+
API_KEY: pass,
|
|
11
|
+
API_URI: basePath,
|
|
12
|
+
API_REQUEST_RETRY_ATTEMPTS: maxAttempts,
|
|
13
|
+
API_REQUEST_RETRY_DELAY: retryDelay
|
|
14
|
+
}) {
|
|
15
|
+
this.taskId = taskId;
|
|
16
|
+
this.user = user;
|
|
17
|
+
this.pass = pass;
|
|
18
|
+
this.basePath = basePath;
|
|
19
|
+
this.maxAttempts = maxAttempts;
|
|
20
|
+
this.retryDelay = retryDelay;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async request(method, data) {
|
|
24
|
+
const options = {
|
|
25
|
+
url: `${this.basePath}/sailor-support/hooks/task/${this.taskId}/startup/data`,
|
|
26
|
+
method,
|
|
27
|
+
auth: {
|
|
28
|
+
user: this.user,
|
|
29
|
+
pass: this.pass
|
|
30
|
+
},
|
|
31
|
+
json: true,
|
|
32
|
+
forever: true,
|
|
33
|
+
headers: {
|
|
34
|
+
Connection: 'Keep-Alive'
|
|
35
|
+
},
|
|
36
|
+
maxAttempts: this.maxAttempts,
|
|
37
|
+
retryDelay: this.retryDelay,
|
|
38
|
+
retryStrategy: request.RetryStrategies.HTTPOrNetworkError
|
|
39
|
+
};
|
|
40
|
+
if (data) {
|
|
41
|
+
options.body = data;
|
|
42
|
+
}
|
|
43
|
+
const { statusCode, body } = await request(options);
|
|
44
|
+
|
|
45
|
+
if (statusCode >= 400) {
|
|
46
|
+
throw Object.assign(new Error(body.error), { statusCode });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return body;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
create(data) {
|
|
53
|
+
return this.request('POST', data);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
retrieve() {
|
|
57
|
+
return this.request('GET');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
delete() {
|
|
61
|
+
return this.request('DELETE');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports.startup = function startup(settings) {
|
|
67
|
+
return new HooksData(settings);
|
|
68
|
+
};
|
package/lib/ipc.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Used to communicate with parent processes.
|
|
3
|
-
*/
|
|
4
|
-
class IPC {
|
|
5
|
-
send(event, data) {
|
|
6
|
-
if (!process.send) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
process.send({ event, data });
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
exports.IPC = IPC;
|
|
1
|
+
/**
|
|
2
|
+
* Used to communicate with parent processes.
|
|
3
|
+
*/
|
|
4
|
+
class IPC {
|
|
5
|
+
send(event, data) {
|
|
6
|
+
if (!process.send) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
process.send({ event, data });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.IPC = IPC;
|