posthog-node 4.2.2 → 4.2.3

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,5 +1,9 @@
1
1
  # Next
2
2
 
3
+ # 4.2.3 - 2024-11-21
4
+
5
+ 1. fix: identify method allows passing a $set_once object
6
+
3
7
  # 4.2.2 - 2024-11-18
4
8
 
5
9
  1. fix: Shutdown will now respect the timeout and forcefully return rather than returning after the next fetch.
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.2.2";
7
+ var version = "4.2.3";
8
8
 
9
9
  var PostHogPersistedProperty;
10
10
  (function (PostHogPersistedProperty) {
@@ -1064,7 +1064,7 @@ class PostHogCoreStateless {
1064
1064
  identifyStateless(distinctId, properties, options) {
1065
1065
  this.wrap(() => {
1066
1066
  // The properties passed to identifyStateless are event properties.
1067
- // To add person properties, pass in all person properties to the `$set` key.
1067
+ // To add person properties, pass in all person properties to the `$set` and `$set_once` keys.
1068
1068
  const payload = {
1069
1069
  ...this.buildPayload({
1070
1070
  distinct_id: distinctId,
@@ -2163,9 +2163,14 @@ class PostHog extends PostHogCoreStateless {
2163
2163
  disableGeoip
2164
2164
  }) {
2165
2165
  // Catch properties passed as $set and move them to the top level
2166
- const personProperties = properties?.$set || properties;
2166
+ // promote $set and $set_once to top level
2167
+ const userPropsOnce = properties?.$set_once;
2168
+ delete properties?.$set_once;
2169
+ // if no $set is provided we assume all properties are $set
2170
+ const userProps = properties?.$set || properties;
2167
2171
  super.identifyStateless(distinctId, {
2168
- $set: personProperties
2172
+ $set: userProps,
2173
+ $set_once: userPropsOnce
2169
2174
  }, {
2170
2175
  disableGeoip
2171
2176
  });