Skip to content

Commit cbfa3e9

Browse files
author
Michael Ng
authored
Merge branch 'master' into dependabot/npm_and_yarn/tar-2.2.2
2 parents 0211bbc + bbd5383 commit cbfa3e9

20 files changed

+759
-845
lines changed

CODEOWNERS

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# These owners will be the default owners for everything in the repo.
5+
# Unless a later match takes precedence, @global-owner1 and @global-owner2
6+
# will be requested for review when someone opens a pull request.
7+
* @optimizely/fullstack-devs
8+
9+
# Order is important; the last matching pattern takes the most precedence.
10+
# When someone opens a pull request that only modifies JS files, only @js-owner
11+
# and not the global owner(s) will be requested for a review.
12+
#*.js @js-owner
13+
14+
# You can also use email addresses if you prefer. They'll be used to look up
15+
# users just like we do for commit author emails.
16+
#docs/* docs@example.com

packages/datafile-manager/yarn.lock

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ async-limiter@~1.0.0:
380380
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
381381
integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==
382382

383-
async@^2.5.0, async@^2.6.1:
383+
async@^2.6.1:
384384
version "2.6.2"
385385
resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381"
386386
integrity sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==
@@ -653,10 +653,10 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
653653
dependencies:
654654
delayed-stream "~1.0.0"
655655

656-
commander@~2.17.1:
657-
version "2.17.1"
658-
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
659-
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
656+
commander@~2.20.0:
657+
version "2.20.0"
658+
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
659+
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
660660

661661
compare-versions@^3.2.1:
662662
version "3.4.0"
@@ -1190,11 +1190,11 @@ growly@^1.3.0:
11901190
integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=
11911191

11921192
handlebars@^4.1.0:
1193-
version "4.1.0"
1194-
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.0.tgz#0d6a6f34ff1f63cecec8423aa4169827bf787c3a"
1195-
integrity sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==
1193+
version "4.1.2"
1194+
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67"
1195+
integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==
11961196
dependencies:
1197-
async "^2.5.0"
1197+
neo-async "^2.6.0"
11981198
optimist "^0.6.1"
11991199
source-map "^0.6.1"
12001200
optionalDependencies:
@@ -1932,9 +1932,9 @@ jest@^24.1.0:
19321932
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
19331933

19341934
js-yaml@^3.12.0:
1935-
version "3.12.2"
1936-
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.2.tgz#ef1d067c5a9d9cb65bd72f285b5d8105c77f14fc"
1937-
integrity sha512-QHn/Lh/7HhZ/Twc7vJYQTkjuCa0kaCcDcjK5Zlk2rvnUpy7DxMJ23+Jc2dcyvltwQVg1nygAVlB2oRDFHoRS5Q==
1935+
version "3.13.1"
1936+
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
1937+
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
19381938
dependencies:
19391939
argparse "^1.0.7"
19401940
esprima "^4.0.0"
@@ -2101,9 +2101,9 @@ lodash.sortby@^4.7.0:
21012101
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
21022102

21032103
lodash@^4.17.11, lodash@^4.17.5:
2104-
version "4.17.11"
2105-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
2106-
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
2104+
version "4.17.15"
2105+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
2106+
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
21072107

21082108
lolex@^2.3.2:
21092109
version "2.7.5"
@@ -2310,6 +2310,11 @@ needle@^2.2.1:
23102310
iconv-lite "^0.4.4"
23112311
sax "^1.2.4"
23122312

2313+
neo-async@^2.6.0:
2314+
version "2.6.1"
2315+
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
2316+
integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==
2317+
23132318
nice-try@^1.0.4:
23142319
version "1.0.5"
23152320
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
@@ -3371,11 +3376,11 @@ typescript@^3.3.3333:
33713376
integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==
33723377

33733378
uglify-js@^3.1.4:
3374-
version "3.4.9"
3375-
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3"
3376-
integrity sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==
3379+
version "3.6.0"
3380+
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5"
3381+
integrity sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==
33773382
dependencies:
3378-
commander "~2.17.1"
3383+
commander "~2.20.0"
33793384
source-map "~0.6.1"
33803385

33813386
union-value@^1.0.0:

packages/event-processor/CHANGELOG.MD

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [Unreleased]
88
Changes that have landed but are not yet released.
99

10+
## [0.3.0] - August 13, 2019
11+
12+
### New Features
13+
- In `AbstractEventProcessor`, validate `maxQueueSize` and `flushInterval`; ignore & use default values when invalid
14+
- `AbstractEventProcessor` can be constructed with a `notificationCenter`. When `notificationCenter` is provided, it triggers a log event notification after the event is sent to the event dispatcher
15+
16+
### Changed
17+
- Removed transformers, interceptors, and callbacks from `AbstractEventProcessor`
18+
- Removed grouping events by context and dispatching one event per group at flush time. Instead, only maintain one group and flush immediately when an incompatible event is processed.
19+
1020
## [0.2.1] - June 6, 2019
1121

1222
- Wrap the `callback` in `try/catch` when implementing a custom `eventDispatcher`. This ensures invoking the `callback` will always cleanup any pending retry tasks.
@@ -18,4 +28,4 @@ events that did not send successfully due to page navigation
1828

1929
## [0.1.0] - March 1, 2019
2030

21-
Initial release
31+
Initial release

packages/event-processor/__tests__/eventQueue.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ describe('eventQueue', () => {
5656
flushInterval: 100,
5757
maxQueueSize: -1,
5858
sink: sinkFn,
59+
batchComparator: () => true
5960
})
6061

6162
queue.start()
@@ -76,6 +77,7 @@ describe('eventQueue', () => {
7677
flushInterval: 100,
7778
maxQueueSize: 0,
7879
sink: sinkFn,
80+
batchComparator: () => true
7981
})
8082

8183
queue.start()
@@ -96,6 +98,7 @@ describe('eventQueue', () => {
9698
flushInterval: 100,
9799
maxQueueSize: 3,
98100
sink: sinkFn,
101+
batchComparator: () => true
99102
})
100103

101104
queue.start()
@@ -123,6 +126,7 @@ describe('eventQueue', () => {
123126
flushInterval: 100,
124127
maxQueueSize: 100,
125128
sink: sinkFn,
129+
batchComparator: () => true
126130
})
127131

128132
queue.start()
@@ -145,12 +149,37 @@ describe('eventQueue', () => {
145149
queue.stop()
146150
})
147151

152+
it('should invoke the sink function when an item incompatable with the current batch (according to batchComparator) is received', () => {
153+
const sinkFn = jest.fn()
154+
const queue = new DefaultEventQueue<string>({
155+
flushInterval: 100,
156+
maxQueueSize: 100,
157+
sink: sinkFn,
158+
// This batchComparator returns true when the argument strings start with the same letter
159+
batchComparator: (s1, s2) => s1[0] === s2[0]
160+
})
161+
162+
queue.start()
163+
164+
queue.enqueue('a1')
165+
queue.enqueue('a2')
166+
// After enqueuing these strings, both starting with 'a', the sinkFn should not yet be called. Thus far all the items enqueued are
167+
// compatible according to the batchComparator.
168+
expect(sinkFn).not.toHaveBeenCalled()
169+
170+
// Enqueuing a string starting with 'b' should cause the sinkFn to be called
171+
queue.enqueue('b1')
172+
expect(sinkFn).toHaveBeenCalledTimes(1)
173+
expect(sinkFn).toHaveBeenCalledWith(['a1', 'a2'])
174+
})
175+
148176
it('stop() should flush the existing queue and call timer.stop()', () => {
149177
const sinkFn = jest.fn()
150178
const queue = new DefaultEventQueue<number>({
151179
flushInterval: 100,
152180
maxQueueSize: 100,
153181
sink: sinkFn,
182+
batchComparator: () => true
154183
})
155184

156185
jest.spyOn(queue.timer, 'stop')
@@ -174,6 +203,7 @@ describe('eventQueue', () => {
174203
flushInterval: 100,
175204
maxQueueSize: 100,
176205
sink: sinkFn,
206+
batchComparator: () => true
177207
})
178208

179209
jest.spyOn(queue.timer, 'refresh')
@@ -196,6 +226,7 @@ describe('eventQueue', () => {
196226
flushInterval: 100,
197227
maxQueueSize: 100,
198228
sink: sinkFn,
229+
batchComparator: () => true
199230
})
200231

201232
expect(queue.stop()).toBe(promise)
@@ -207,6 +238,7 @@ describe('eventQueue', () => {
207238
flushInterval: 100,
208239
maxQueueSize: 100,
209240
sink: sinkFn,
241+
batchComparator: () => true
210242
})
211243

212244
queue.start()

0 commit comments

Comments
 (0)