@segment/analytics-node
Advanced tools
Comparing version 1.1.4 to 1.2.0
@@ -29,3 +29,3 @@ "use strict"; | ||
maxRetries: settings.maxRetries ?? 3, | ||
maxEventsInBatch: settings.maxEventsInBatch ?? 15, | ||
flushAt: settings.flushAt ?? settings.maxEventsInBatch ?? 15, | ||
httpRequestTimeout: settings.httpRequestTimeout, | ||
@@ -32,0 +32,0 @@ disable: settings.disable, |
@@ -5,3 +5,3 @@ "use strict"; | ||
// This file is generated. | ||
exports.version = '1.1.4'; | ||
exports.version = '1.2.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -17,6 +17,6 @@ "use strict"; | ||
class Publisher { | ||
constructor({ host, path, maxRetries, maxEventsInBatch, flushInterval, writeKey, httpRequestTimeout, httpClient, disable, }, emitter) { | ||
constructor({ host, path, maxRetries, flushAt, flushInterval, writeKey, httpRequestTimeout, httpClient, disable, }, emitter) { | ||
this._emitter = emitter; | ||
this._maxRetries = maxRetries; | ||
this._maxEventsInBatch = Math.max(maxEventsInBatch, 1); | ||
this._flushAt = Math.max(flushAt, 1); | ||
this._flushInterval = flushInterval; | ||
@@ -31,3 +31,3 @@ this._auth = (0, base_64_encode_1.b64encode)(`${writeKey}:`); | ||
this.pendingFlushTimeout && clearTimeout(this.pendingFlushTimeout); | ||
const batch = new context_batch_1.ContextBatch(this._maxEventsInBatch); | ||
const batch = new context_batch_1.ContextBatch(this._flushAt); | ||
this._batch = batch; | ||
@@ -92,3 +92,3 @@ this.pendingFlushTimeout = setTimeout(() => { | ||
const isExpectingNoMoreItems = batch.length === this._closeAndFlushPendingItemsCount; | ||
const isFull = batch.length === this._maxEventsInBatch; | ||
const isFull = batch.length === this._flushAt; | ||
if (isFull || isExpectingNoMoreItems) { | ||
@@ -95,0 +95,0 @@ this.send(batch).catch(noop); |
@@ -26,3 +26,3 @@ import { bindAll, pTimeout } from '@segment/analytics-core'; | ||
maxRetries: settings.maxRetries ?? 3, | ||
maxEventsInBatch: settings.maxEventsInBatch ?? 15, | ||
flushAt: settings.flushAt ?? settings.maxEventsInBatch ?? 15, | ||
httpRequestTimeout: settings.httpRequestTimeout, | ||
@@ -29,0 +29,0 @@ disable: settings.disable, |
// This file is generated. | ||
export const version = '1.1.4'; | ||
export const version = '1.2.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -14,6 +14,6 @@ import { backoff } from '@segment/analytics-core'; | ||
export class Publisher { | ||
constructor({ host, path, maxRetries, maxEventsInBatch, flushInterval, writeKey, httpRequestTimeout, httpClient, disable, }, emitter) { | ||
constructor({ host, path, maxRetries, flushAt, flushInterval, writeKey, httpRequestTimeout, httpClient, disable, }, emitter) { | ||
this._emitter = emitter; | ||
this._maxRetries = maxRetries; | ||
this._maxEventsInBatch = Math.max(maxEventsInBatch, 1); | ||
this._flushAt = Math.max(flushAt, 1); | ||
this._flushInterval = flushInterval; | ||
@@ -28,3 +28,3 @@ this._auth = b64encode(`${writeKey}:`); | ||
this.pendingFlushTimeout && clearTimeout(this.pendingFlushTimeout); | ||
const batch = new ContextBatch(this._maxEventsInBatch); | ||
const batch = new ContextBatch(this._flushAt); | ||
this._batch = batch; | ||
@@ -89,3 +89,3 @@ this.pendingFlushTimeout = setTimeout(() => { | ||
const isExpectingNoMoreItems = batch.length === this._closeAndFlushPendingItemsCount; | ||
const isFull = batch.length === this._maxEventsInBatch; | ||
const isFull = batch.length === this._flushAt; | ||
if (isFull || isExpectingNoMoreItems) { | ||
@@ -92,0 +92,0 @@ this.send(batch).catch(noop); |
@@ -20,4 +20,9 @@ import { HTTPClient, HTTPFetchFn } from '../lib/http-client'; | ||
/** | ||
* The number of messages to enqueue before flushing. Default: 15 | ||
* The number of events to enqueue before flushing. Default: 15. | ||
*/ | ||
flushAt?: number; | ||
/** | ||
* @deprecated | ||
* The number of events to enqueue before flushing. This is deprecated in favor of `flushAt`. Default: 15. | ||
*/ | ||
maxEventsInBatch?: number; | ||
@@ -24,0 +29,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
export declare const version = "1.1.4"; | ||
export declare const version = "1.2.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -8,3 +8,3 @@ import type { Context } from '../../app/context'; | ||
flushInterval: number; | ||
maxEventsInBatch: number; | ||
flushAt: number; | ||
maxRetries: number; | ||
@@ -23,3 +23,3 @@ writeKey: string; | ||
private _flushInterval; | ||
private _maxEventsInBatch; | ||
private _flushAt; | ||
private _maxRetries; | ||
@@ -33,3 +33,3 @@ private _auth; | ||
private _httpClient; | ||
constructor({ host, path, maxRetries, maxEventsInBatch, flushInterval, writeKey, httpRequestTimeout, httpClient, disable, }: PublisherProps, emitter: NodeEmitter); | ||
constructor({ host, path, maxRetries, flushAt, flushInterval, writeKey, httpRequestTimeout, httpClient, disable, }: PublisherProps, emitter: NodeEmitter); | ||
private createBatch; | ||
@@ -36,0 +36,0 @@ private clearBatch; |
{ | ||
"name": "@segment/analytics-node", | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"main": "./dist/cjs/index.js", | ||
@@ -39,4 +39,4 @@ "module": "./dist/esm/index.js", | ||
"@lukeed/uuid": "^2.0.0", | ||
"@segment/analytics-core": "1.4.0", | ||
"@segment/analytics-generic-utils": "1.1.0", | ||
"@segment/analytics-core": "1.4.1", | ||
"@segment/analytics-generic-utils": "1.1.1", | ||
"buffer": "^6.0.3", | ||
@@ -43,0 +43,0 @@ "node-fetch": "^2.6.7", |
@@ -81,3 +81,3 @@ # @segment/analytics-node | ||
const analytics = () => new Analytics({ | ||
maxEventsInBatch: 1, | ||
flushAt: 1, | ||
writeKey: '<MY_WRITE_KEY>', | ||
@@ -109,3 +109,3 @@ }) | ||
writeKey: '<MY_WRITE_KEY>', | ||
maxEventsInBatch: 1, | ||
flushAt: 1, | ||
}) | ||
@@ -137,3 +137,3 @@ .on('error', console.error) | ||
const analytics = new Analytics({ | ||
maxEventsInBatch: 1, | ||
flushAt: 1, | ||
writeKey: '<MY_WRITE_KEY>', | ||
@@ -140,0 +140,0 @@ }).on('error', console.error); |
@@ -51,3 +51,3 @@ import { CoreAnalytics, bindAll, pTimeout } from '@segment/analytics-core' | ||
maxRetries: settings.maxRetries ?? 3, | ||
maxEventsInBatch: settings.maxEventsInBatch ?? 15, | ||
flushAt: settings.flushAt ?? settings.maxEventsInBatch ?? 15, | ||
httpRequestTimeout: settings.httpRequestTimeout, | ||
@@ -54,0 +54,0 @@ disable: settings.disable, |
@@ -22,4 +22,9 @@ import { ValidationError } from '@segment/analytics-core' | ||
/** | ||
* The number of messages to enqueue before flushing. Default: 15 | ||
* The number of events to enqueue before flushing. Default: 15. | ||
*/ | ||
flushAt?: number | ||
/** | ||
* @deprecated | ||
* The number of events to enqueue before flushing. This is deprecated in favor of `flushAt`. Default: 15. | ||
*/ | ||
maxEventsInBatch?: number | ||
@@ -26,0 +31,0 @@ /** |
// This file is generated. | ||
export const version = '1.1.4' | ||
export const version = '1.2.0' |
@@ -25,3 +25,3 @@ import { backoff } from '@segment/analytics-core' | ||
flushInterval: number | ||
maxEventsInBatch: number | ||
flushAt: number | ||
maxRetries: number | ||
@@ -42,3 +42,3 @@ writeKey: string | ||
private _flushInterval: number | ||
private _maxEventsInBatch: number | ||
private _flushAt: number | ||
private _maxRetries: number | ||
@@ -57,3 +57,3 @@ private _auth: string | ||
maxRetries, | ||
maxEventsInBatch, | ||
flushAt, | ||
flushInterval, | ||
@@ -69,3 +69,3 @@ writeKey, | ||
this._maxRetries = maxRetries | ||
this._maxEventsInBatch = Math.max(maxEventsInBatch, 1) | ||
this._flushAt = Math.max(flushAt, 1) | ||
this._flushInterval = flushInterval | ||
@@ -84,3 +84,3 @@ this._auth = b64encode(`${writeKey}:`) | ||
this.pendingFlushTimeout && clearTimeout(this.pendingFlushTimeout) | ||
const batch = new ContextBatch(this._maxEventsInBatch) | ||
const batch = new ContextBatch(this._flushAt) | ||
this._batch = batch | ||
@@ -154,3 +154,3 @@ this.pendingFlushTimeout = setTimeout(() => { | ||
batch.length === this._closeAndFlushPendingItemsCount | ||
const isFull = batch.length === this._maxEventsInBatch | ||
const isFull = batch.length === this._flushAt | ||
if (isFull || isExpectingNoMoreItems) { | ||
@@ -157,0 +157,0 @@ this.send(batch).catch(noop) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
178015
3094
+ Added@segment/analytics-core@1.4.1(transitive)
+ Added@segment/analytics-generic-utils@1.1.1(transitive)
- Removed@segment/analytics-core@1.4.0(transitive)
- Removed@segment/analytics-generic-utils@1.1.0(transitive)