@codefresh-io/eventbus 2.2.0 → 2.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/lib/Bus.js +0 -1
- package/lib/Store.js +27 -0
- package/package.json +2 -2
- package/yarn.lock +8 -36
package/lib/Bus.js
CHANGED
package/lib/Store.js
CHANGED
|
@@ -30,6 +30,7 @@ class Store extends EventEmitter {
|
|
|
30
30
|
this.ssl = 'POSTGRES_SSL_ENABLE' in process.env
|
|
31
31
|
? process.env.POSTGRES_SSL_ENABLE === 'true'
|
|
32
32
|
: options.ssl;
|
|
33
|
+
this.disablePostgresForEventbus = process.env.DISABLE_POSTGRES_FOR_EVENTBUS === 'true';
|
|
33
34
|
this.readyPromise = new Promise((resolve, reject) => {
|
|
34
35
|
this.readyDeferred = {
|
|
35
36
|
resolve: () => {
|
|
@@ -43,6 +44,9 @@ class Store extends EventEmitter {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
async quit() {
|
|
47
|
+
if (this.disablePostgresForEventbus) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
46
50
|
debug(`Pool client state before closing. total: ${this.pool.totalCount}. idle: ${this.pool.idleCount}. active: ${this.pool.activeCount}`);
|
|
47
51
|
await this.pool.end();
|
|
48
52
|
debug(`Pool client state after closing. total: ${this.pool.totalCount}. idle: ${this.pool.idleCount}. active: ${this.pool.activeCount}`);
|
|
@@ -50,6 +54,10 @@ class Store extends EventEmitter {
|
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
init() {
|
|
57
|
+
if (this.disablePostgresForEventbus) {
|
|
58
|
+
debug(`Store is disabled. Skipping initialization of it`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
53
61
|
const config = {
|
|
54
62
|
user: this.user,
|
|
55
63
|
database: this.database,
|
|
@@ -120,7 +128,18 @@ class Store extends EventEmitter {
|
|
|
120
128
|
}
|
|
121
129
|
}
|
|
122
130
|
|
|
131
|
+
_emptyPgCursor() {
|
|
132
|
+
return {
|
|
133
|
+
count: () => 0,
|
|
134
|
+
next: () => false,
|
|
135
|
+
close: () => {},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
123
139
|
async save(eventName, event) {
|
|
140
|
+
if (this.disablePostgresForEventbus) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
124
143
|
let data = [
|
|
125
144
|
{ field: 'event', value: eventName },
|
|
126
145
|
{ field: 'props', value: _.get(event, 'props', {}) },
|
|
@@ -156,6 +175,10 @@ class Store extends EventEmitter {
|
|
|
156
175
|
}
|
|
157
176
|
|
|
158
177
|
async getAllAggregateEvents(aggregateId, fromIndex) {
|
|
178
|
+
if (this.disablePostgresForEventbus) {
|
|
179
|
+
debug('getAllAggregateEvents: return _emptyPgCursor');
|
|
180
|
+
return this._emptyPgCursor();
|
|
181
|
+
}
|
|
159
182
|
try {
|
|
160
183
|
const queryCondition = `WHERE id >= ${fromIndex} AND aggregate_id = '${aggregateId}'`;
|
|
161
184
|
|
|
@@ -176,6 +199,10 @@ class Store extends EventEmitter {
|
|
|
176
199
|
}
|
|
177
200
|
|
|
178
201
|
async getAllEventsByName(name, fromIndex) {
|
|
202
|
+
if (this.disablePostgresForEventbus) {
|
|
203
|
+
debug('getAllEventsByName: return _emptyPgCursor');
|
|
204
|
+
return this._emptyPgCursor();
|
|
205
|
+
}
|
|
179
206
|
try {
|
|
180
207
|
const queryCondition = `WHERE id >= ${fromIndex} AND event LIKE '${name}%'`;
|
|
181
208
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefresh-io/eventbus",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/codefresh-io/cf-eventbus#readme",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"amqplib": "^0.
|
|
20
|
+
"amqplib": "^0.10.7",
|
|
21
21
|
"bluebird": "^3.5.0",
|
|
22
22
|
"cf-errors": "^0.1.16",
|
|
23
23
|
"debug": "2.6.9",
|
package/yarn.lock
CHANGED
|
@@ -18,17 +18,13 @@ amdefine@>=0.0.4:
|
|
|
18
18
|
version "1.0.1"
|
|
19
19
|
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
|
|
20
20
|
|
|
21
|
-
amqplib@^0.
|
|
22
|
-
version "0.8
|
|
23
|
-
resolved "https://registry.yarnpkg.com/amqplib/-/amqplib-0.8.
|
|
24
|
-
integrity sha512-
|
|
21
|
+
amqplib@^0.10.7:
|
|
22
|
+
version "0.10.8"
|
|
23
|
+
resolved "https://registry.yarnpkg.com/amqplib/-/amqplib-0.10.8.tgz#87f5173df65f17008ad5dd0736174724b8211b11"
|
|
24
|
+
integrity sha512-Tfn1O9sFgAP8DqeMEpt2IacsVTENBpblB3SqLdn0jK2AeX8iyCvbptBc8lyATT9bQ31MsjVwUSQ1g8f4jHOUfw==
|
|
25
25
|
dependencies:
|
|
26
|
-
bitsyntax "~0.1.0"
|
|
27
|
-
bluebird "^3.7.2"
|
|
28
26
|
buffer-more-ints "~1.0.0"
|
|
29
|
-
|
|
30
|
-
safe-buffer "~5.2.1"
|
|
31
|
-
url-parse "~1.5.1"
|
|
27
|
+
url-parse "~1.5.10"
|
|
32
28
|
|
|
33
29
|
ansi-regex@^0.2.0, ansi-regex@^0.2.1:
|
|
34
30
|
version "0.2.1"
|
|
@@ -276,15 +272,6 @@ binary-extensions@^1.0.0:
|
|
|
276
272
|
version "1.8.0"
|
|
277
273
|
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.8.0.tgz#48ec8d16df4377eae5fa5884682480af4d95c774"
|
|
278
274
|
|
|
279
|
-
bitsyntax@~0.1.0:
|
|
280
|
-
version "0.1.0"
|
|
281
|
-
resolved "https://registry.yarnpkg.com/bitsyntax/-/bitsyntax-0.1.0.tgz#b0c59acef03505de5a2ed62a2f763c56ae1d6205"
|
|
282
|
-
integrity sha512-ikAdCnrloKmFOugAfxWws89/fPc+nw0OOG1IzIE72uSOg/A3cYptKCjSUhDTuj7fhsJtzkzlv7l3b8PzRHLN0Q==
|
|
283
|
-
dependencies:
|
|
284
|
-
buffer-more-ints "~1.0.0"
|
|
285
|
-
debug "~2.6.9"
|
|
286
|
-
safe-buffer "~5.1.2"
|
|
287
|
-
|
|
288
275
|
block-stream@*:
|
|
289
276
|
version "0.0.9"
|
|
290
277
|
resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a"
|
|
@@ -295,11 +282,6 @@ bluebird@^3.5.0:
|
|
|
295
282
|
version "3.5.0"
|
|
296
283
|
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c"
|
|
297
284
|
|
|
298
|
-
bluebird@^3.7.2:
|
|
299
|
-
version "3.7.2"
|
|
300
|
-
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
|
|
301
|
-
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
|
|
302
|
-
|
|
303
285
|
boom@2.x.x:
|
|
304
286
|
version "2.10.1"
|
|
305
287
|
resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f"
|
|
@@ -533,7 +515,7 @@ debug@2.2.0, debug@~2.2.0:
|
|
|
533
515
|
dependencies:
|
|
534
516
|
ms "0.7.1"
|
|
535
517
|
|
|
536
|
-
debug@2.6.9
|
|
518
|
+
debug@2.6.9:
|
|
537
519
|
version "2.6.9"
|
|
538
520
|
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
|
539
521
|
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
|
|
@@ -2449,7 +2431,7 @@ read-all-stream@^3.0.0:
|
|
|
2449
2431
|
pinkie-promise "^2.0.0"
|
|
2450
2432
|
readable-stream "^2.0.0"
|
|
2451
2433
|
|
|
2452
|
-
readable-stream@1.1, "readable-stream
|
|
2434
|
+
readable-stream@1.1, "readable-stream@>=1.1.13-1 <1.2.0-0", readable-stream@~1.1.9:
|
|
2453
2435
|
version "1.1.14"
|
|
2454
2436
|
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9"
|
|
2455
2437
|
dependencies:
|
|
@@ -2629,16 +2611,6 @@ run-sequence@^1.1.0:
|
|
|
2629
2611
|
chalk "*"
|
|
2630
2612
|
gulp-util "*"
|
|
2631
2613
|
|
|
2632
|
-
safe-buffer@~5.1.2:
|
|
2633
|
-
version "5.1.2"
|
|
2634
|
-
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
|
|
2635
|
-
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
|
|
2636
|
-
|
|
2637
|
-
safe-buffer@~5.2.1:
|
|
2638
|
-
version "5.2.1"
|
|
2639
|
-
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
|
|
2640
|
-
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
|
2641
|
-
|
|
2642
2614
|
samsam@1.1.2, samsam@~1.1:
|
|
2643
2615
|
version "1.1.2"
|
|
2644
2616
|
resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.2.tgz#bec11fdc83a9fda063401210e40176c3024d1567"
|
|
@@ -3014,7 +2986,7 @@ update-notifier@0.5.0:
|
|
|
3014
2986
|
semver-diff "^2.0.0"
|
|
3015
2987
|
string-length "^1.0.0"
|
|
3016
2988
|
|
|
3017
|
-
url-parse@~1.5.
|
|
2989
|
+
url-parse@~1.5.10:
|
|
3018
2990
|
version "1.5.10"
|
|
3019
2991
|
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1"
|
|
3020
2992
|
integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==
|