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/lib/index.d.ts CHANGED
@@ -132,7 +132,7 @@ declare class SimpleEventEmitter {
132
132
  declare abstract class PostHogCoreStateless {
133
133
  readonly apiKey: string;
134
134
  readonly host: string;
135
- private flushAt;
135
+ readonly flushAt: number;
136
136
  private maxBatchSize;
137
137
  private maxQueueSize;
138
138
  private flushInterval;
package/lib/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createHash } from 'rusha';
2
2
 
3
- var version = "4.2.2";
3
+ var version = "4.2.3";
4
4
 
5
5
  var PostHogPersistedProperty;
6
6
  (function (PostHogPersistedProperty) {
@@ -1060,7 +1060,7 @@ class PostHogCoreStateless {
1060
1060
  identifyStateless(distinctId, properties, options) {
1061
1061
  this.wrap(() => {
1062
1062
  // The properties passed to identifyStateless are event properties.
1063
- // To add person properties, pass in all person properties to the `$set` key.
1063
+ // To add person properties, pass in all person properties to the `$set` and `$set_once` keys.
1064
1064
  const payload = {
1065
1065
  ...this.buildPayload({
1066
1066
  distinct_id: distinctId,
@@ -2159,9 +2159,14 @@ class PostHog extends PostHogCoreStateless {
2159
2159
  disableGeoip
2160
2160
  }) {
2161
2161
  // Catch properties passed as $set and move them to the top level
2162
- const personProperties = properties?.$set || properties;
2162
+ // promote $set and $set_once to top level
2163
+ const userPropsOnce = properties?.$set_once;
2164
+ delete properties?.$set_once;
2165
+ // if no $set is provided we assume all properties are $set
2166
+ const userProps = properties?.$set || properties;
2163
2167
  super.identifyStateless(distinctId, {
2164
- $set: personProperties
2168
+ $set: userProps,
2169
+ $set_once: userPropsOnce
2165
2170
  }, {
2166
2171
  disableGeoip
2167
2172
  });