Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit c7d3078

Browse files
authored
Merge branch 'master' into using-axios-instance
2 parents c0af20a + 47ce7ae commit c7d3078

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

History.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
v4.0.0 / 2021-2-17
2+
==========================
3+
* BREAKING: throws error when message is over 32kb #268
4+
* Allow passing in Axios instance in options #270
5+
* Fix data parameter always undefined on callback for track method #231
6+
* Allow to update endpoint to send batch events #246
7+
* Vulnerability fixes #264, #243, #263, #226, #227, #228, #247, #248, #252, #253, #257, #261
8+
* Fixed a typo to reflect actual code behaviour #233
9+
110
v3.5.0 / 2021-1-5
211
==========================
312
* Update axios to fix the Server-Side Request Forgery vulnerability (#259)

index.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,7 @@ class Analytics {
6161
}
6262

6363
_validate (message, type) {
64-
try {
65-
looselyValidate(message, type)
66-
} catch (e) {
67-
if (e.message === 'Your message must be < 32kb.') {
68-
console.log('Your message must be < 32kb. This is currently surfaced as a warning to allow clients to update. Versions released after August 1, 2018 will throw an error instead. Please update your code before then.', message)
69-
return
70-
}
71-
throw e
72-
}
64+
looselyValidate(message, type)
7365
}
7466

7567
/**
@@ -212,16 +204,16 @@ class Analytics {
212204

213205
if (!this.flushed) {
214206
this.flushed = true
215-
this.flush()
207+
this.flush(callback)
216208
return
217209
}
218210

219211
if (this.queue.length >= this.flushAt) {
220-
this.flush()
212+
this.flush(callback)
221213
}
222214

223215
if (this.flushInterval && !this.timer) {
224-
this.timer = setTimeout(this.flush.bind(this), this.flushInterval)
216+
this.timer = setTimeout(this.flush.bind(this, callback), this.flushInterval)
225217
}
226218
}
227219

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "analytics-node",
3-
"version": "3.5.0",
3+
"version": "4.0.0",
44
"description": "The hassle-free way to integrate analytics into any Node.js application",
55
"license": "MIT",
66
"repository": "segmentio/analytics-node",

test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ test('isErrorRetryable', t => {
561561
t.false(client._isErrorRetryable({ response: { status: 200 } }))
562562
})
563563

564-
test('allows messages > 32kb', t => {
564+
test('dont allow messages > 32kb', t => {
565565
const client = createClient()
566566

567567
const event = {
@@ -573,7 +573,7 @@ test('allows messages > 32kb', t => {
573573
event.properties[i] = 'a'
574574
}
575575

576-
t.notThrows(() => {
576+
t.throws(() => {
577577
client.track(event, noop)
578578
})
579579
})

0 commit comments

Comments
 (0)