New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

posthog-node

Package Overview
Dependencies
Maintainers
6
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthog-node - npm Package Compare versions

Comparing version 2.0.0-alpha6 to 2.0.0-alpha7

18

lib/index.cjs.js

@@ -142,3 +142,3 @@ 'use strict';

var version = "2.0.0-alpha6";
var version = "2.0.0-alpha7";

@@ -1295,6 +1295,14 @@ var PostHogPersistedProperty;

return __generator(this, function (_a) {
feat = this.getFeatureFlag(key, distinctId, groups);
return [2
/*return*/
, !!feat || defaultResult || false];
switch (_a.label) {
case 0:
return [4
/*yield*/
, this.getFeatureFlag(key, distinctId, groups)];
case 1:
feat = _a.sent();
return [2
/*return*/
, !!feat || defaultResult || false];
}
});

@@ -1301,0 +1309,0 @@ });

@@ -134,3 +134,3 @@ import undici from 'undici';

var version = "2.0.0-alpha6";
var version = "2.0.0-alpha7";

@@ -1287,6 +1287,14 @@ var PostHogPersistedProperty;

return __generator(this, function (_a) {
feat = this.getFeatureFlag(key, distinctId, groups);
return [2
/*return*/
, !!feat || defaultResult || false];
switch (_a.label) {
case 0:
return [4
/*yield*/
, this.getFeatureFlag(key, distinctId, groups)];
case 1:
feat = _a.sent();
return [2
/*return*/
, !!feat || defaultResult || false];
}
});

@@ -1293,0 +1301,0 @@ });

{
"name": "posthog-node",
"version": "2.0.0-alpha6",
"version": "2.0.0-alpha7",
"description": "PostHog Node.js integration",

@@ -5,0 +5,0 @@ "repository": "PostHog/posthog-node",

@@ -121,3 +121,3 @@ import { version } from '../package.json'

): Promise<boolean> {
const feat = this.getFeatureFlag(key, distinctId, groups)
const feat = await this.getFeatureFlag(key, distinctId, groups)
return !!feat || defaultResult || false

@@ -124,0 +124,0 @@ }

@@ -20,3 +20,3 @@ import PostHog from '../'

describe('PostHog Core', () => {
describe('PostHog Node.js', () => {
let posthog: PostHog

@@ -41,3 +41,3 @@

describe('legacy methods', () => {
describe('core methods', () => {
it('should capture an event to shared queue', async () => {

@@ -94,2 +94,47 @@ expect(mockedUndici.fetch).toHaveBeenCalledTimes(0)

})
describe('feature flags', () => {
beforeEach(() => {
const mockFeatureFlags = {
'feature-1': true,
'feature-2': true,
'feature-variant': 'variant',
}
mockedUndici.fetch.mockImplementation((url) => {
if ((url as any).includes('/decide/')) {
return Promise.resolve({
status: 200,
text: () => Promise.resolve('ok'),
json: () =>
Promise.resolve({
featureFlags: mockFeatureFlags,
}),
}) as any
}
return Promise.resolve({
status: 200,
text: () => Promise.resolve('ok'),
json: () =>
Promise.resolve({
status: 'ok',
}),
}) as any
})
})
it('should do getFeatureFlag', async () => {
expect(mockedUndici.fetch).toHaveBeenCalledTimes(0)
await expect(posthog.getFeatureFlag('feature-variant', '123', { org: '123' })).resolves.toEqual('variant')
expect(mockedUndici.fetch).toHaveBeenCalledTimes(1)
})
it('should do isFeatureEnabled', async () => {
expect(mockedUndici.fetch).toHaveBeenCalledTimes(0)
await expect(posthog.isFeatureEnabled('feature-1', '123', false, { org: '123' })).resolves.toEqual(true)
await expect(posthog.isFeatureEnabled('feature-4', '123', false, { org: '123' })).resolves.toEqual(false)
expect(mockedUndici.fetch).toHaveBeenCalledTimes(2)
})
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc