analytics-node
Advanced tools
Comparing version 6.0.0 to 6.1.0
@@ -0,1 +1,17 @@ | ||
# v6.1.0 / 2022-07-13 | ||
- Add an errorHandler property to constructor options (#342) | ||
- Add sentAt note to readme (#340) | ||
- Update library axios to 0.27.2 (#339) | ||
- Update code snippet to match analyics-code API (#321) | ||
- Error thrown in callback function is caught by flush's promise .catch() (#317) | ||
- Fix callback called twice (#315) | ||
- Automated dependency upgrades | ||
# v6.0.0 / 2021-11-19 | ||
- Change flush threshold from 500kb to 450kb #311 | ||
- Breaking: Flush now properly returns a Promise #288 | ||
# v5.1.1 / 2021-10-20 | ||
@@ -2,0 +18,0 @@ |
18
index.js
@@ -32,2 +32,3 @@ 'use strict' | ||
* @property {Number} [retryCount] (default: 3) | ||
* @property {Function} [errorHandler] (optional) | ||
*/ | ||
@@ -54,2 +55,3 @@ | ||
this.flushed = false | ||
this.errorHandler = options.errorHandler | ||
Object.defineProperty(this, 'enable', { | ||
@@ -216,3 +218,3 @@ configurable: false, | ||
this.flushed = true | ||
this.flush(callback) | ||
this.flush() | ||
return | ||
@@ -224,3 +226,3 @@ } | ||
if (hasReachedFlushAt || hasReachedQueueSize) { | ||
this.flush(callback) | ||
this.flush() | ||
return | ||
@@ -230,3 +232,3 @@ } | ||
if (this.flushInterval && !this.timer) { | ||
this.timer = setTimeout(this.flush.bind(this, callback), this.flushInterval) | ||
this.timer = setTimeout(this.flush.bind(this), this.flushInterval) | ||
} | ||
@@ -271,4 +273,6 @@ } | ||
const done = err => { | ||
callbacks.forEach(callback => callback(err)) | ||
callback(err, data) | ||
setImmediate(() => { | ||
callbacks.forEach(callback => callback(err, data)) | ||
callback(err, data) | ||
}) | ||
} | ||
@@ -302,2 +306,6 @@ | ||
.catch(err => { | ||
if (typeof this.errorHandler === 'function') { | ||
return this.errorHandler(err) | ||
} | ||
if (err.response) { | ||
@@ -304,0 +312,0 @@ const error = new Error(err.response.statusText) |
{ | ||
"name": "analytics-node", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "The hassle-free way to integrate analytics into any Node.js application", | ||
@@ -38,3 +38,3 @@ "license": "MIT", | ||
"@segment/loosely-validate-event": "^2.0.0", | ||
"axios": "^0.21.4", | ||
"axios": "^0.27.2", | ||
"axios-retry": "3.2.0", | ||
@@ -41,0 +41,0 @@ "lodash.isstring": "^4.0.1", |
@@ -33,3 +33,3 @@ # analytics-node [![CircleCI](https://circleci.com/gh/segmentio/analytics-node.svg?style=svg&circle-token=68654e8cd0fcd16b1f3ae9943a1d8e20e36ae6c5)](https://circleci.com/gh/segmentio/analytics-node) | ||
```js | ||
analytics.track('Order Completed', { price: 99.84 }) | ||
analytics.track({ userId: '019mr8mf4r', event: 'Order Completed', properties: { price: 99.84 }}); | ||
``` | ||
@@ -68,3 +68,6 @@ Then, query the resulting data in SQL: | ||
## Notes | ||
Defining ```sentAt``` in the payload will cause the specified ```timestamp``` to be ignored | ||
## Documentation | ||
@@ -71,0 +74,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22052
289
79
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@0.27.2(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
- Removedaxios@0.21.4(transitive)
Updatedaxios@^0.27.2