posthog-node 4.1.1 → 4.2.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/CHANGELOG.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # Next
2
2
 
3
+ # 4.2.0 - 2024-08-26
4
+
5
+ 1. Added `historicalMigration` option for use in tools that are migrating large data to PostHog
6
+
3
7
  # 4.1.1 - 2024-08-20
4
8
 
5
9
  1. Local evaluation returns correct results on `undefined/null` values
10
+
6
11
  # 4.1.0 - 2024-08-14
7
12
 
8
13
  1. chore: change host to new address.
package/lib/index.cjs.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var rusha = require('rusha');
6
6
 
7
- var version = "4.1.1";
7
+ var version = "4.2.0";
8
8
 
9
9
  var PostHogPersistedProperty;
10
10
  (function (PostHogPersistedProperty) {
@@ -952,6 +952,7 @@ class PostHogCoreStateless {
952
952
  constructor(apiKey, options) {
953
953
  this.flushPromise = null;
954
954
  this.disableGeoip = true;
955
+ this.historicalMigration = false;
955
956
  this.disabled = false;
956
957
  this.defaultOptIn = true;
957
958
  this.pendingPromises = {};
@@ -977,6 +978,7 @@ class PostHogCoreStateless {
977
978
  this.featureFlagsRequestTimeoutMs = options?.featureFlagsRequestTimeoutMs ?? 3000; // 3 seconds
978
979
  this.disableGeoip = options?.disableGeoip ?? true;
979
980
  this.disabled = options?.disabled ?? false;
981
+ this.historicalMigration = options?.historicalMigration ?? false;
980
982
  // Init promise allows the derived class to block calls until it is ready
981
983
  this._initPromise = Promise.resolve();
982
984
  this._isInitialized = true;
@@ -1291,6 +1293,9 @@ class PostHogCoreStateless {
1291
1293
  batch: messages,
1292
1294
  sent_at: currentISOTime(),
1293
1295
  };
1296
+ if (this.historicalMigration) {
1297
+ data.historical_migration = true;
1298
+ }
1294
1299
  const payload = JSON.stringify(data);
1295
1300
  const url = this.captureMode === 'form'
1296
1301
  ? `${this.host}/e/?ip=1&_=${currentTimestamp()}&v=${this.getLibraryVersion()}`