posthog-node 2.0.1 → 2.0.2

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/lib/index.d.ts CHANGED
@@ -135,7 +135,7 @@ declare type PostHogOptions = PosthogCoreOptions & {
135
135
  requestTimeout?: number;
136
136
  maxCacheSize?: number;
137
137
  };
138
- declare class PostHogGlobal implements PostHogNodeV1 {
138
+ declare class PostHog implements PostHogNodeV1 {
139
139
  private _sharedClient;
140
140
  private featureFlagsPoller?;
141
141
  private maxCacheSize;
@@ -178,4 +178,4 @@ declare class PostHogGlobal implements PostHogNodeV1 {
178
178
  debug(enabled?: boolean): void;
179
179
  }
180
180
 
181
- export { PostHogGlobal, PostHogOptions, PostHogGlobal as default };
181
+ export { PostHog, PostHogOptions };
package/lib/index.esm.js CHANGED
@@ -143,7 +143,7 @@ function __spreadArray(to, from, pack) {
143
143
  return to.concat(ar || Array.prototype.slice.call(from));
144
144
  }
145
145
 
146
- var version = "2.0.1";
146
+ var version = "2.0.2";
147
147
 
148
148
  var PostHogPersistedProperty;
149
149
  (function (PostHogPersistedProperty) {
@@ -1769,12 +1769,12 @@ function isValidRegex(regex) {
1769
1769
  var THIRTY_SECONDS = 30 * 1000;
1770
1770
  var MAX_CACHE_SIZE = 50 * 1000;
1771
1771
 
1772
- var PostHog =
1772
+ var PostHogClient =
1773
1773
  /** @class */
1774
1774
  function (_super) {
1775
- __extends(PostHog, _super);
1775
+ __extends(PostHogClient, _super);
1776
1776
 
1777
- function PostHog(apiKey, options) {
1777
+ function PostHogClient(apiKey, options) {
1778
1778
  if (options === void 0) {
1779
1779
  options = {};
1780
1780
  }
@@ -1791,48 +1791,48 @@ function (_super) {
1791
1791
  return _this;
1792
1792
  }
1793
1793
 
1794
- PostHog.prototype.getPersistedProperty = function (key) {
1794
+ PostHogClient.prototype.getPersistedProperty = function (key) {
1795
1795
  return this._memoryStorage.getProperty(key);
1796
1796
  };
1797
1797
 
1798
- PostHog.prototype.setPersistedProperty = function (key, value) {
1798
+ PostHogClient.prototype.setPersistedProperty = function (key, value) {
1799
1799
  return this._memoryStorage.setProperty(key, value);
1800
1800
  };
1801
1801
 
1802
- PostHog.prototype.getSessionId = function () {
1802
+ PostHogClient.prototype.getSessionId = function () {
1803
1803
  // Sessions don't make sense for Node
1804
1804
  return undefined;
1805
1805
  };
1806
1806
 
1807
- PostHog.prototype.fetch = function (url, options) {
1807
+ PostHogClient.prototype.fetch = function (url, options) {
1808
1808
  return undici.fetch(url, options);
1809
1809
  };
1810
1810
 
1811
- PostHog.prototype.getLibraryId = function () {
1811
+ PostHogClient.prototype.getLibraryId = function () {
1812
1812
  return 'posthog-node';
1813
1813
  };
1814
1814
 
1815
- PostHog.prototype.getLibraryVersion = function () {
1815
+ PostHogClient.prototype.getLibraryVersion = function () {
1816
1816
  return version;
1817
1817
  };
1818
1818
 
1819
- PostHog.prototype.getCustomUserAgent = function () {
1819
+ PostHogClient.prototype.getCustomUserAgent = function () {
1820
1820
  return "posthog-node/".concat(version);
1821
1821
  };
1822
1822
 
1823
- return PostHog;
1823
+ return PostHogClient;
1824
1824
  }(PostHogCore); // The actual exported Nodejs API.
1825
1825
 
1826
1826
 
1827
- var PostHogGlobal =
1827
+ var PostHog =
1828
1828
  /** @class */
1829
1829
  function () {
1830
- function PostHogGlobal(apiKey, options) {
1830
+ function PostHog(apiKey, options) {
1831
1831
  if (options === void 0) {
1832
1832
  options = {};
1833
1833
  }
1834
1834
 
1835
- this._sharedClient = new PostHog(apiKey, options);
1835
+ this._sharedClient = new PostHogClient(apiKey, options);
1836
1836
 
1837
1837
  if (options.personalApiKey) {
1838
1838
  this.featureFlagsPoller = new FeatureFlagsPoller({
@@ -1848,22 +1848,22 @@ function () {
1848
1848
  this.maxCacheSize = options.maxCacheSize || MAX_CACHE_SIZE;
1849
1849
  }
1850
1850
 
1851
- PostHogGlobal.prototype.reInit = function (distinctId) {
1851
+ PostHog.prototype.reInit = function (distinctId) {
1852
1852
  // Certain properties we want to persist. Queue is persisted always by default.
1853
1853
  this._sharedClient.reset([PostHogPersistedProperty.OptedOut]);
1854
1854
 
1855
1855
  this._sharedClient.setPersistedProperty(PostHogPersistedProperty.DistinctId, distinctId);
1856
1856
  };
1857
1857
 
1858
- PostHogGlobal.prototype.enable = function () {
1858
+ PostHog.prototype.enable = function () {
1859
1859
  return this._sharedClient.optIn();
1860
1860
  };
1861
1861
 
1862
- PostHogGlobal.prototype.disable = function () {
1862
+ PostHog.prototype.disable = function () {
1863
1863
  return this._sharedClient.optOut();
1864
1864
  };
1865
1865
 
1866
- PostHogGlobal.prototype.capture = function (_a) {
1866
+ PostHog.prototype.capture = function (_a) {
1867
1867
  var distinctId = _a.distinctId,
1868
1868
  event = _a.event,
1869
1869
  properties = _a.properties,
@@ -1878,7 +1878,7 @@ function () {
1878
1878
  this._sharedClient.capture(event, properties, sendFeatureFlags || false);
1879
1879
  };
1880
1880
 
1881
- PostHogGlobal.prototype.identify = function (_a) {
1881
+ PostHog.prototype.identify = function (_a) {
1882
1882
  var distinctId = _a.distinctId,
1883
1883
  properties = _a.properties;
1884
1884
  this.reInit(distinctId);
@@ -1886,13 +1886,13 @@ function () {
1886
1886
  this._sharedClient.identify(distinctId, properties);
1887
1887
  };
1888
1888
 
1889
- PostHogGlobal.prototype.alias = function (data) {
1889
+ PostHog.prototype.alias = function (data) {
1890
1890
  this.reInit(data.distinctId);
1891
1891
 
1892
1892
  this._sharedClient.alias(data.alias);
1893
1893
  };
1894
1894
 
1895
- PostHogGlobal.prototype.getFeatureFlag = function (key, distinctId, options) {
1895
+ PostHog.prototype.getFeatureFlag = function (key, distinctId, options) {
1896
1896
  var _a;
1897
1897
 
1898
1898
  return __awaiter(this, void 0, void 0, function () {
@@ -1980,7 +1980,7 @@ function () {
1980
1980
  });
1981
1981
  };
1982
1982
 
1983
- PostHogGlobal.prototype.isFeatureEnabled = function (key, distinctId, options) {
1983
+ PostHog.prototype.isFeatureEnabled = function (key, distinctId, options) {
1984
1984
  return __awaiter(this, void 0, void 0, function () {
1985
1985
  var feat;
1986
1986
  return __generator(this, function (_a) {
@@ -2007,7 +2007,7 @@ function () {
2007
2007
  });
2008
2008
  };
2009
2009
 
2010
- PostHogGlobal.prototype.getAllFlags = function (distinctId, options) {
2010
+ PostHog.prototype.getAllFlags = function (distinctId, options) {
2011
2011
  var _a;
2012
2012
 
2013
2013
  return __awaiter(this, void 0, void 0, function () {
@@ -2075,7 +2075,7 @@ function () {
2075
2075
  });
2076
2076
  };
2077
2077
 
2078
- PostHogGlobal.prototype.groupIdentify = function (_a) {
2078
+ PostHog.prototype.groupIdentify = function (_a) {
2079
2079
  var groupType = _a.groupType,
2080
2080
  groupKey = _a.groupKey,
2081
2081
  properties = _a.properties;
@@ -2083,7 +2083,7 @@ function () {
2083
2083
  this._sharedClient.groupIdentify(groupType, groupKey, properties);
2084
2084
  };
2085
2085
 
2086
- PostHogGlobal.prototype.reloadFeatureFlags = function () {
2086
+ PostHog.prototype.reloadFeatureFlags = function () {
2087
2087
  var _a;
2088
2088
 
2089
2089
  return __awaiter(this, void 0, void 0, function () {
@@ -2105,15 +2105,15 @@ function () {
2105
2105
  });
2106
2106
  };
2107
2107
 
2108
- PostHogGlobal.prototype.flush = function () {
2108
+ PostHog.prototype.flush = function () {
2109
2109
  this._sharedClient.flush();
2110
2110
  };
2111
2111
 
2112
- PostHogGlobal.prototype.shutdown = function () {
2112
+ PostHog.prototype.shutdown = function () {
2113
2113
  void this.shutdownAsync();
2114
2114
  };
2115
2115
 
2116
- PostHogGlobal.prototype.shutdownAsync = function () {
2116
+ PostHog.prototype.shutdownAsync = function () {
2117
2117
  var _a;
2118
2118
 
2119
2119
  return __awaiter(this, void 0, void 0, function () {
@@ -2126,12 +2126,12 @@ function () {
2126
2126
  });
2127
2127
  };
2128
2128
 
2129
- PostHogGlobal.prototype.debug = function (enabled) {
2129
+ PostHog.prototype.debug = function (enabled) {
2130
2130
  return this._sharedClient.debug(enabled);
2131
2131
  };
2132
2132
 
2133
- return PostHogGlobal;
2133
+ return PostHog;
2134
2134
  }();
2135
2135
 
2136
- export { PostHogGlobal, PostHogGlobal as default };
2136
+ export { PostHog };
2137
2137
  //# sourceMappingURL=index.esm.js.map