posthog-node
Advanced tools
Comparing version 4.1.0 to 4.1.1
# Next | ||
# 4.1.1 - 2024-08-20 | ||
1. Local evaluation returns correct results on `undefined/null` values | ||
# 4.1.0 - 2024-08-14 | ||
@@ -4,0 +7,0 @@ |
@@ -63,4 +63,4 @@ /// <reference types="node" /> | ||
} | ||
declare function matchProperty(property: FeatureFlagCondition['properties'][number], propertyValues: Record<string, any>): boolean; | ||
declare function matchProperty(property: FeatureFlagCondition['properties'][number], propertyValues: Record<string, any>, warnFunction?: (msg: string) => void): boolean; | ||
declare function relativeDateParseForFeatureFlagMatching(value: string): Date | null; | ||
export { FeatureFlagsPoller, matchProperty, relativeDateParseForFeatureFlagMatching, InconclusiveMatchError, ClientError, }; |
{ | ||
"name": "posthog-node", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "PostHog Node.js integration", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -10,2 +10,3 @@ import { createHash } from 'rusha' | ||
const NULL_VALUES_ALLOWED_OPERATORS = ['is_not'] | ||
class ClientError extends Error { | ||
@@ -309,3 +310,7 @@ constructor(message: string) { | ||
const rolloutPercentage = condition.rollout_percentage | ||
const warnFunction = (msg: string): void => { | ||
if (this.debugMode) { | ||
console.warn(msg) | ||
} | ||
} | ||
if ((condition.properties || []).length > 0) { | ||
@@ -319,3 +324,3 @@ for (const prop of condition.properties) { | ||
} else { | ||
matches = matchProperty(prop, properties) | ||
matches = matchProperty(prop, properties, warnFunction) | ||
} | ||
@@ -467,3 +472,4 @@ | ||
property: FeatureFlagCondition['properties'][number], | ||
propertyValues: Record<string, any> | ||
propertyValues: Record<string, any>, | ||
warnFunction?: (msg: string) => void | ||
): boolean { | ||
@@ -481,3 +487,12 @@ const key = property.key | ||
const overrideValue = propertyValues[key] | ||
if (overrideValue == null && !NULL_VALUES_ALLOWED_OPERATORS.includes(operator)) { | ||
// if the value is null, just fail the feature flag comparison | ||
// this isn't an InconclusiveMatchError because the property value was provided. | ||
if (warnFunction) { | ||
warnFunction(`Property ${key} cannot have a value of null/undefined with the ${operator} operator`) | ||
} | ||
return false | ||
} | ||
function computeExactMatch(value: any, overrideValue: any): boolean { | ||
@@ -484,0 +499,0 @@ if (Array.isArray(value)) { |
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
Sorry, the diff of this file is too big to display
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
888575
13054