posthog-node 4.13.0 → 4.14.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,3 +1,7 @@
1
+ # 4.14.0 - 2025-04-24
2
+
3
+ 1. feat: Add super properties as a concept to the Node SDK
4
+
1
5
  # 4.13.0 - 2025-04-21
2
6
 
3
7
  1. feat: Add method to wait for local evaluation feature flag definitions to be loaded
package/lib/index.cjs.js CHANGED
@@ -22,7 +22,7 @@ function _interopNamespace(e) {
22
22
  return Object.freeze(n);
23
23
  }
24
24
 
25
- var version = "4.13.0";
25
+ var version = "4.14.0";
26
26
 
27
27
  var PostHogPersistedProperty;
28
28
  (function (PostHogPersistedProperty) {
@@ -327,7 +327,7 @@ function safeSetTimeout(fn, timeout) {
327
327
  return t;
328
328
  }
329
329
  function getFetch() {
330
- return typeof fetch !== 'undefined' ? fetch : typeof global.fetch !== 'undefined' ? global.fetch : undefined;
330
+ return typeof fetch !== 'undefined' ? fetch : typeof globalThis.fetch !== 'undefined' ? globalThis.fetch : undefined;
331
331
  }
332
332
  // FNV-1a hash function
333
333
  // https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
@@ -1595,6 +1595,30 @@ class PostHogCoreStateless {
1595
1595
  }
1596
1596
  return newSurveys ?? [];
1597
1597
  }
1598
+ get props() {
1599
+ if (!this._props) {
1600
+ this._props = this.getPersistedProperty(PostHogPersistedProperty.Props);
1601
+ }
1602
+ return this._props || {};
1603
+ }
1604
+ set props(val) {
1605
+ this._props = val;
1606
+ }
1607
+ async register(properties) {
1608
+ this.wrap(() => {
1609
+ this.props = {
1610
+ ...this.props,
1611
+ ...properties,
1612
+ };
1613
+ this.setPersistedProperty(PostHogPersistedProperty.Props, this.props);
1614
+ });
1615
+ }
1616
+ async unregister(property) {
1617
+ this.wrap(() => {
1618
+ delete this.props[property];
1619
+ this.setPersistedProperty(PostHogPersistedProperty.Props, this.props);
1620
+ });
1621
+ }
1598
1622
  /***
1599
1623
  *** QUEUEING AND FLUSHING
1600
1624
  ***/