posthog-node
Advanced tools
Comparing version 2.5.1 to 2.5.2
@@ -0,4 +1,9 @@ | ||
# 2.5.2 - 2023-02-17 | ||
1. Fix issue where properties passed to `.identify` were not set correctly | ||
# 2.5.1 - 2023-02-16 | ||
1. Make sure shutdown waits for pending promises to resolve. Fixes a problem with using PostHog Node in serverless environments. | ||
# 2.5.0 - 2023-02-15 | ||
@@ -8,2 +13,3 @@ | ||
2. Sets minimum version of node.js to 15 | ||
# 2.4.0 - 2023-02-02 | ||
@@ -10,0 +16,0 @@ |
{ | ||
"name": "posthog-node", | ||
"version": "2.5.1", | ||
"version": "2.5.2", | ||
"description": "PostHog Node.js integration", | ||
@@ -5,0 +5,0 @@ "repository": "PostHog/posthog-node", |
@@ -120,3 +120,8 @@ import { version } from '../package.json' | ||
identify({ distinctId, properties }: IdentifyMessageV1): void { | ||
super.identifyStateless(distinctId, properties) | ||
// Catch properties passed as $set and move them to the top level | ||
const personProperties = properties?.$set || properties | ||
super.identifyStateless(distinctId, { | ||
$set: personProperties, | ||
}) | ||
} | ||
@@ -123,0 +128,0 @@ |
@@ -117,3 +117,5 @@ // import { PostHog } from '../' | ||
properties: { | ||
foo: 'bar', | ||
$set: { | ||
foo: 'bar', | ||
}, | ||
}, | ||
@@ -124,2 +126,20 @@ }, | ||
it('should handle identify mistakenly using $set', async () => { | ||
expect(mockedFetch).toHaveBeenCalledTimes(0) | ||
posthog.identify({ distinctId: '123', properties: { foo: 'bar', $set: { foo: 'other' } } }) | ||
jest.runOnlyPendingTimers() | ||
const batchEvents = getLastBatchEvents() | ||
expect(batchEvents).toMatchObject([ | ||
{ | ||
distinct_id: '123', | ||
event: '$identify', | ||
properties: { | ||
$set: { | ||
foo: 'other', | ||
}, | ||
}, | ||
}, | ||
]) | ||
}) | ||
it('should capture alias events on shared queue', async () => { | ||
@@ -126,0 +146,0 @@ expect(mockedFetch).toHaveBeenCalledTimes(0) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
780749
10998