posthog-node 5.56.3 → 5.57.0
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/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -0
- package/dist/client.mjs +3 -0
- package/dist/exports.d.ts +1 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/extensions/feature-flags/feature-flags.d.ts +9 -5
- package/dist/extensions/feature-flags/feature-flags.d.ts.map +1 -1
- package/dist/extensions/feature-flags/feature-flags.js +127 -36
- package/dist/extensions/feature-flags/feature-flags.mjs +128 -37
- package/dist/feature-flag-evaluations.d.ts +12 -1
- package/dist/feature-flag-evaluations.d.ts.map +1 -1
- package/dist/feature-flag-evaluations.js +7 -1
- package/dist/feature-flag-evaluations.mjs +7 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.mjs +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +4 -4
- package/src/client.ts +18 -2
- package/src/exports.ts +1 -1
- package/src/extensions/feature-flags/feature-flags.ts +270 -67
- package/src/feature-flag-evaluations.ts +24 -3
- package/src/types.ts +2 -0
- package/src/version.ts +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1055,7 +1055,7 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
|
|
|
1055
1055
|
* {@label Feature flags}
|
|
1056
1056
|
*
|
|
1057
1057
|
* @param distinctIdOrOptions - The user's distinct ID, or options when the distinctId comes from `withContext()`
|
|
1058
|
-
* @param options - Optional configuration for flag evaluation. Supports the same fields as `getAllFlags()`. `flagKeys` scopes local evaluation, the `/flags` request, and the returned snapshot. `onlyEvaluateLocally` prevents fallback and leaves unresolved keys absent.
|
|
1058
|
+
* @param options - Optional configuration for flag evaluation. Supports the same fields as `getAllFlags()`. `flagKeys` scopes local evaluation, the `/flags` request, and the returned snapshot. `onlyEvaluateLocally` prevents fallback and leaves unresolved keys absent; the snapshot's `unresolvedFlags` lists them with a reason.
|
|
1059
1059
|
* @returns Promise that resolves to a `FeatureFlagEvaluations` snapshot
|
|
1060
1060
|
*/
|
|
1061
1061
|
evaluateFlags(options?: AllFlagsOptions): Promise<FeatureFlagEvaluations>;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gBAAgB,EAKhB,QAAQ,EAER,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAG/B,wBAAwB,EAGxB,UAAU,EAIV,gBAAgB,EAKjB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gBAAgB,EAKhB,QAAQ,EAER,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAG/B,wBAAwB,EAGxB,UAAU,EAIV,gBAAgB,EAKjB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EACV,OAAO,EACP,IAAI,EACJ,kBAAkB,EAClB,gBAAgB,EAGjB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,eAAe,EACf,YAAY,EAGZ,4BAA4B,EAE5B,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,2BAA2B,EAC3B,cAAc,EAEd,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,SAAS,CAAA;AAChB,OAAO,EAEL,sBAAsB,EAEtB,qBAAqB,EACtB,MAAM,4BAA4B,CAAA;AAOnC,OAAO,aAAa,MAAM,6BAA6B,CAAA;AAGvD,OAAO,EAAE,W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GAAG,OAAO,CAAC,IAAI,CAAC,CAwCzD;YAEa,2BAA2B;IAqCzC,OAAO,CAAC,0BAA0B;YA+BpB,uBAAuB;IAuErC,OAAO,CAAC,gCAAgC;IAqBxC,OAAO,CAAC,kCAAkC;IAI1C,OAAO,CAAC,kCAAkC;IAe1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,gBAAgB,CACd,KAAK,EAAE,OAAO,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnD,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,EAC3B,KAAK,CAAC,EAAE,sBAAsB,GAC7B,IAAI,CAaN;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACG,yBAAyB,CAC7B,KAAK,EAAE,OAAO,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnD,KAAK,CAAC,EAAE,sBAAsB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAaf;IAEY,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;QAC7D,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,sBAAsB,CAAA;QAClC,OAAO,EAAE,qBAAqB,CAAA;KAC/B,CAAC,CAED;YAEa,oBAAoB;IA0JlC,OAAO,CAAC,cAAc;CA4BvB"}
|
package/dist/client.js
CHANGED
|
@@ -902,12 +902,15 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
|
|
|
902
902
|
if (void 0 !== requestedFlagKeys) {
|
|
903
903
|
for (const key of Object.keys(records))if (!requestedFlagKeys.has(key)) delete records[key];
|
|
904
904
|
}
|
|
905
|
+
const unresolvedFlags = {};
|
|
906
|
+
for (const [key, reason] of Object.entries(localResult?.unresolved ?? {}))if (!Object.prototype.hasOwnProperty.call(records, key)) unresolvedFlags[key] = reason;
|
|
905
907
|
return new external_feature_flag_evaluations_js_namespaceObject.FeatureFlagEvaluations({
|
|
906
908
|
host: this._getFeatureFlagEvaluationsHost(),
|
|
907
909
|
distinctId: resolvedDistinctId,
|
|
908
910
|
groups,
|
|
909
911
|
disableGeoip,
|
|
910
912
|
flags: records,
|
|
913
|
+
unresolvedFlags,
|
|
911
914
|
requestId,
|
|
912
915
|
evaluatedAt,
|
|
913
916
|
flagDefinitionsLoadedAt: this.featureFlagsPoller?.getFlagDefinitionsLoadedAt(),
|
package/dist/client.mjs
CHANGED
|
@@ -859,12 +859,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
859
859
|
if (void 0 !== requestedFlagKeys) {
|
|
860
860
|
for (const key of Object.keys(records))if (!requestedFlagKeys.has(key)) delete records[key];
|
|
861
861
|
}
|
|
862
|
+
const unresolvedFlags = {};
|
|
863
|
+
for (const [key, reason] of Object.entries(localResult?.unresolved ?? {}))if (!Object.prototype.hasOwnProperty.call(records, key)) unresolvedFlags[key] = reason;
|
|
862
864
|
return new FeatureFlagEvaluations({
|
|
863
865
|
host: this._getFeatureFlagEvaluationsHost(),
|
|
864
866
|
distinctId: resolvedDistinctId,
|
|
865
867
|
groups,
|
|
866
868
|
disableGeoip,
|
|
867
869
|
flags: records,
|
|
870
|
+
unresolvedFlags,
|
|
868
871
|
requestId,
|
|
869
872
|
evaluatedAt,
|
|
870
873
|
flagDefinitionsLoadedAt: this.featureFlagsPoller?.getFlagDefinitionsLoadedAt(),
|
package/dist/exports.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './types';
|
|
|
4
4
|
export { FeatureFlagEvaluations } from './feature-flag-evaluations';
|
|
5
5
|
export type { FlagDefinitionCacheData, FlagDefinitionCacheInput, FlagDefinitionCacheProvider, } from './extensions/feature-flags/cache';
|
|
6
6
|
export { FeatureFlagError } from '@posthog/core';
|
|
7
|
-
export type { FeatureFlagErrorType } from '@posthog/core';
|
|
7
|
+
export type { FeatureFlagErrorType, UnresolvedFlagReason } from '@posthog/core';
|
|
8
8
|
export type { CaptureMetricOptions, Metrics, MetricsConfig } from '@posthog/core';
|
|
9
9
|
export type { Span, SpanAttributes, SpanAttributeValue, SpanKind, SpanStatusCode, SpanTimeInput, StartSpanOptions, SpanRecord, BeforeSpanSendFn, TracesConfig, } from '@posthog/core';
|
|
10
10
|
export { cookieStateToProperties, cookieStoreFromHeader, getPostHogCookieName, parsePostHogCookie, readPostHogCookie, serializePostHogCookie, uuidv7, } from '@posthog/core';
|
package/dist/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,SAAS,CAAA;AAEvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAA;AAIzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,SAAS,CAAA;AAEvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAA;AAIzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAI/E,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAIjF,YAAY,EACV,IAAI,EACJ,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,YAAY,GACb,MAAM,eAAe,CAAA;AAKtB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,GACP,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FeatureFlagCondition, FeatureFlagEvaluationRuntime, PostHogFeatureFlag, PropertyGroup } from '../../types';
|
|
2
|
-
import type { FeatureFlagValue, JsonType, PostHogFetchOptions, PostHogFetchResponse } from '@posthog/core';
|
|
2
|
+
import type { FeatureFlagValue, JsonType, PostHogFetchOptions, PostHogFetchResponse, UnresolvedFlagReason } from '@posthog/core';
|
|
3
3
|
import { InconclusiveMatchError, relativeDateParseForFeatureFlagMatching } from '@posthog/core';
|
|
4
4
|
import { FlagDefinitionCacheProvider, FlagDefinitionCacheInput } from './cache';
|
|
5
5
|
type ConditionMatchResult = 'match' | 'no_match' | 'out_of_rollout_bound';
|
|
@@ -7,6 +7,7 @@ declare class ClientError extends Error {
|
|
|
7
7
|
constructor(message: string);
|
|
8
8
|
}
|
|
9
9
|
declare class RequiresServerEvaluation extends Error {
|
|
10
|
+
readonly reason: UnresolvedFlagReason;
|
|
10
11
|
constructor(message: string);
|
|
11
12
|
}
|
|
12
13
|
type FeatureFlagsPollerOptions = {
|
|
@@ -87,15 +88,18 @@ declare class FeatureFlagsPoller {
|
|
|
87
88
|
private onMinimalFlagCalledEvents?;
|
|
88
89
|
private evaluationContexts?;
|
|
89
90
|
private filteredOutFlagKeys;
|
|
91
|
+
private warnedUnresolvableFlags;
|
|
90
92
|
constructor({ pollingInterval, personalApiKey, projectApiKey, timeout, host, customHeaders, ...options }: FeatureFlagsPollerOptions);
|
|
91
93
|
debug(enabled?: boolean): void;
|
|
92
94
|
private logMsgIfDebug;
|
|
95
|
+
private currentDefinitions;
|
|
93
96
|
private withEvaluationSnapshot;
|
|
94
97
|
private createEvaluationContext;
|
|
95
98
|
getFeatureFlag(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, any>, groupProperties?: Record<string, Record<string, any>>): Promise<FeatureFlagValue | undefined>;
|
|
96
99
|
getAllFlagsAndPayloads(evaluationContext: FeatureFlagEvaluationContext, flagKeysToExplicitlyEvaluate?: string[]): Promise<{
|
|
97
100
|
response: Record<string, FeatureFlagValue>;
|
|
98
101
|
payloads: Record<string, JsonType>;
|
|
102
|
+
unresolved: Record<string, UnresolvedFlagReason>;
|
|
99
103
|
fallbackToFlags: boolean;
|
|
100
104
|
}>;
|
|
101
105
|
computeFlagAndPayloadLocally(flag: PostHogFeatureFlag, evaluationContext: FeatureFlagEvaluationContext, options?: ComputeFlagAndPayloadOptions): Promise<{
|
|
@@ -130,11 +134,11 @@ declare class FeatureFlagsPoller {
|
|
|
130
134
|
getFlagKeysByEvaluationRuntime(runtime: FeatureFlagEvaluationRuntime): string[];
|
|
131
135
|
private updateFlagState;
|
|
132
136
|
/**
|
|
133
|
-
* Warn about flags
|
|
134
|
-
* Called after loading flag definitions when local evaluation is enabled.
|
|
135
|
-
*
|
|
137
|
+
* Warn about flags whose definition local evaluation cannot resolve.
|
|
138
|
+
* Called after loading flag definitions when local evaluation is enabled. Each flag is
|
|
139
|
+
* warned about once until its definition changes.
|
|
136
140
|
*/
|
|
137
|
-
private
|
|
141
|
+
private warnAboutUnresolvableFlags;
|
|
138
142
|
/**
|
|
139
143
|
* Attempts to load flags from cache and update internal state.
|
|
140
144
|
* Returns true if flags were successfully loaded from cache, false otherwise.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../src/extensions/feature-flags/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAG5B,kBAAkB,EAClB,aAAa,EACd,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../src/extensions/feature-flags/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAG5B,kBAAkB,EAClB,aAAa,EACd,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,eAAe,CAAA;AACtB,OAAO,EAML,sBAAsB,EAItB,uCAAuC,EAGxC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,2BAA2B,EAA2B,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAkBxG,KAAK,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,sBAAsB,CAAA;AAEzE,cAAM,WAAY,SAAQ,KAAK;IAC7B,YAAY,OAAO,EAAE,MAAM,EAM1B;CACF;AAWD,cAAM,wBAAyB,SAAQ,KAAK;IAE1C,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAA2B;IAEhE,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAqBD,KAAK,yBAAyB,GAAG;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAA;IACpF,OAAO,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AG,OAAO,CAAC,IAAI,CAAC,CAqBzD;IAED;;;OAGG;IACH,sBAAsB,IAAI,OAAO,CAEhC;IAED;;;OAGG;IACH,0BAA0B,IAAI,MAAM,GAAG,SAAS,CAE/C;IAED;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAQpB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAMd,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAiLvC;IAED,OAAO,CAAC,+BAA+B;IAoBjC,8BAA8B,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAuDpE;IAEK,UAAU,CAAC,SAAS,GAAE,MAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBzD;CACF;AA2ED,iBAAS,aAAa,CACpB,QAAQ,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EACpD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EACpC,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAET;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAE5D;AAqKD,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,uCAAuC,EACvC,WAAW,EACX,sBAAsB,EACtB,wBAAwB,EACxB,WAAW,GACZ,CAAA"}
|
|
@@ -60,10 +60,20 @@ function setCustomErrorPrototype(error, constructor) {
|
|
|
60
60
|
}
|
|
61
61
|
class RequiresServerEvaluation extends Error {
|
|
62
62
|
constructor(message){
|
|
63
|
-
super(message);
|
|
63
|
+
super(message), this.reason = 'unsupported_definition';
|
|
64
64
|
setCustomErrorPrototype(this, RequiresServerEvaluation);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
const UNRESOLVED_REASON_PRECEDENCE = [
|
|
68
|
+
'experience_continuity',
|
|
69
|
+
'unsupported_definition',
|
|
70
|
+
'unresolved_dependency',
|
|
71
|
+
'missing_context'
|
|
72
|
+
];
|
|
73
|
+
function pickUnresolvedReason(current, next) {
|
|
74
|
+
if (void 0 === current) return next;
|
|
75
|
+
return UNRESOLVED_REASON_PRECEDENCE.indexOf(next) < UNRESOLVED_REASON_PRECEDENCE.indexOf(current) ? next : current;
|
|
76
|
+
}
|
|
67
77
|
class FeatureFlagsPoller {
|
|
68
78
|
constructor({ pollingInterval, personalApiKey, projectApiKey, timeout, host, customHeaders, ...options }){
|
|
69
79
|
this.debugMode = false;
|
|
@@ -71,6 +81,7 @@ class FeatureFlagsPoller {
|
|
|
71
81
|
this.backOffCount = 0;
|
|
72
82
|
this.pollerStopped = false;
|
|
73
83
|
this.filteredOutFlagKeys = new Set();
|
|
84
|
+
this.warnedUnresolvableFlags = new Map();
|
|
74
85
|
this.pollingInterval = pollingInterval;
|
|
75
86
|
this.personalApiKey = personalApiKey;
|
|
76
87
|
this.featureFlags = [];
|
|
@@ -98,18 +109,21 @@ class FeatureFlagsPoller {
|
|
|
98
109
|
logMsgIfDebug(fn) {
|
|
99
110
|
if (this.debugMode) fn();
|
|
100
111
|
}
|
|
112
|
+
currentDefinitions() {
|
|
113
|
+
return {
|
|
114
|
+
featureFlagsByKey: this.featureFlagsByKey,
|
|
115
|
+
groupTypeMapping: this.groupTypeMapping,
|
|
116
|
+
cohorts: this.cohorts,
|
|
117
|
+
filteredOutFlagKeys: this.filteredOutFlagKeys,
|
|
118
|
+
propertyMatchingVersion: this.propertyMatchingVersion
|
|
119
|
+
};
|
|
120
|
+
}
|
|
101
121
|
withEvaluationSnapshot(context) {
|
|
102
122
|
if (context.definitions) return context;
|
|
103
123
|
return {
|
|
104
124
|
...context,
|
|
105
125
|
evaluationCache: {},
|
|
106
|
-
definitions:
|
|
107
|
-
featureFlagsByKey: this.featureFlagsByKey,
|
|
108
|
-
groupTypeMapping: this.groupTypeMapping,
|
|
109
|
-
cohorts: this.cohorts,
|
|
110
|
-
filteredOutFlagKeys: this.filteredOutFlagKeys,
|
|
111
|
-
propertyMatchingVersion: this.propertyMatchingVersion
|
|
112
|
-
}
|
|
126
|
+
definitions: this.currentDefinitions()
|
|
113
127
|
};
|
|
114
128
|
}
|
|
115
129
|
createEvaluationContext(distinctId, groups = {}, personProperties = {}, groupProperties = {}, evaluationCache = {}) {
|
|
@@ -144,6 +158,7 @@ class FeatureFlagsPoller {
|
|
|
144
158
|
await this.loadFeatureFlags();
|
|
145
159
|
const response = {};
|
|
146
160
|
const payloads = {};
|
|
161
|
+
const unresolved = {};
|
|
147
162
|
let fallbackToFlags = 0 == this.featureFlags.length;
|
|
148
163
|
const flagsToEvaluate = flagKeysToExplicitlyEvaluate ? flagKeysToExplicitlyEvaluate.map((key)=>this.featureFlagsByKey[key]).filter(Boolean) : this.featureFlags;
|
|
149
164
|
const sharedEvaluationContext = this.withEvaluationSnapshot({
|
|
@@ -158,14 +173,17 @@ class FeatureFlagsPoller {
|
|
|
158
173
|
response[flag.key] = matchValue;
|
|
159
174
|
if (matchPayload) payloads[flag.key] = matchPayload;
|
|
160
175
|
} catch (e) {
|
|
161
|
-
if (e instanceof RequiresServerEvaluation || e instanceof core_namespaceObject.InconclusiveMatchError)
|
|
162
|
-
|
|
176
|
+
if (e instanceof RequiresServerEvaluation || e instanceof core_namespaceObject.InconclusiveMatchError) {
|
|
177
|
+
this.logMsgIfDebug(()=>console.debug(`${e.name} when computing flag locally: ${flag.key}: ${e.message}`));
|
|
178
|
+
unresolved[flag.key] = e.reason;
|
|
179
|
+
} else if (e instanceof Error) this.onError?.(new Error(`Error computing flag locally: ${flag.key}: ${e}`));
|
|
163
180
|
fallbackToFlags = true;
|
|
164
181
|
}
|
|
165
182
|
}));
|
|
166
183
|
return {
|
|
167
184
|
response,
|
|
168
185
|
payloads,
|
|
186
|
+
unresolved,
|
|
169
187
|
fallbackToFlags
|
|
170
188
|
};
|
|
171
189
|
}
|
|
@@ -190,7 +208,7 @@ class FeatureFlagsPoller {
|
|
|
190
208
|
async computeFlagValueLocally(flag, evaluationContext) {
|
|
191
209
|
const { distinctId, groups, personProperties, groupProperties } = evaluationContext;
|
|
192
210
|
if (!flag.active) return false;
|
|
193
|
-
if (flag.ensure_experience_continuity) throw new core_namespaceObject.InconclusiveMatchError('Flag has experience continuity enabled');
|
|
211
|
+
if (flag.ensure_experience_continuity) throw new core_namespaceObject.InconclusiveMatchError('Flag has experience continuity enabled', 'experience_continuity');
|
|
194
212
|
const flagFilters = flag.filters || {};
|
|
195
213
|
const aggregation_group_type_index = flagFilters.aggregation_group_type_index;
|
|
196
214
|
if (void 0 != aggregation_group_type_index) {
|
|
@@ -211,7 +229,7 @@ class FeatureFlagsPoller {
|
|
|
211
229
|
const bucketingValue = this.getBucketingValueForFlag(flag, distinctId, personProperties);
|
|
212
230
|
if (void 0 === bucketingValue) {
|
|
213
231
|
this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${flag.key} without $device_id, falling back to server evaluation`));
|
|
214
|
-
throw new core_namespaceObject.InconclusiveMatchError(`Can't compute feature flag: ${flag.key} without $device_id
|
|
232
|
+
throw new core_namespaceObject.InconclusiveMatchError(`Can't compute feature flag: ${flag.key} without $device_id`, getDefinitionUnresolvedReason(flag, evaluationContext.definitions) ?? 'missing_context');
|
|
215
233
|
}
|
|
216
234
|
return await this.matchFeatureFlagProperties(flag, bucketingValue, personProperties, evaluationContext);
|
|
217
235
|
}
|
|
@@ -233,6 +251,8 @@ class FeatureFlagsPoller {
|
|
|
233
251
|
const dependencyChain = property.dependency_chain;
|
|
234
252
|
if (!Array.isArray(dependencyChain)) throw new core_namespaceObject.InconclusiveMatchError(`Flag dependency property for '${targetFlagKey}' has an invalid 'dependency_chain' (expected array, got ${typeof dependencyChain})`);
|
|
235
253
|
if (0 === dependencyChain.length) throw new core_namespaceObject.InconclusiveMatchError(`Circular dependency detected for flag '${targetFlagKey}' (empty dependency chain)`);
|
|
254
|
+
const missingDependency = dependencyChain.find((depFlagKey)=>!(depFlagKey in evaluationCache) && !evaluationContext.definitions.featureFlagsByKey[depFlagKey] && !evaluationContext.definitions.filteredOutFlagKeys.has(depFlagKey));
|
|
255
|
+
if (void 0 !== missingDependency) throw new core_namespaceObject.InconclusiveMatchError(`Missing flag dependency '${missingDependency}' for flag '${targetFlagKey}'`);
|
|
236
256
|
for (const depFlagKey of dependencyChain){
|
|
237
257
|
if (!(depFlagKey in evaluationCache)) {
|
|
238
258
|
const depFlag = evaluationContext.definitions.featureFlagsByKey[depFlagKey];
|
|
@@ -240,14 +260,13 @@ class FeatureFlagsPoller {
|
|
|
240
260
|
const depResult = await this.computeFlagValueLocally(depFlag, evaluationContext);
|
|
241
261
|
evaluationCache[depFlagKey] = depResult;
|
|
242
262
|
} catch (error) {
|
|
243
|
-
throw new core_namespaceObject.InconclusiveMatchError(`Error evaluating flag dependency '${depFlagKey}' for flag '${targetFlagKey}': ${error}
|
|
263
|
+
throw new core_namespaceObject.InconclusiveMatchError(`Error evaluating flag dependency '${depFlagKey}' for flag '${targetFlagKey}': ${error}`, 'unresolved_dependency');
|
|
244
264
|
}
|
|
245
265
|
else evaluationCache[depFlagKey] = false;
|
|
246
|
-
else
|
|
247
|
-
else throw new core_namespaceObject.InconclusiveMatchError(`Missing flag dependency '${depFlagKey}' for flag '${targetFlagKey}'`);
|
|
266
|
+
else evaluationCache[depFlagKey] = false;
|
|
248
267
|
}
|
|
249
268
|
const cachedResult = evaluationCache[depFlagKey];
|
|
250
|
-
if (null == cachedResult) throw new core_namespaceObject.InconclusiveMatchError(`Dependency '${depFlagKey}' could not be evaluated
|
|
269
|
+
if (null == cachedResult) throw new core_namespaceObject.InconclusiveMatchError(`Dependency '${depFlagKey}' could not be evaluated`, 'unresolved_dependency');
|
|
251
270
|
}
|
|
252
271
|
const targetFlagValue = evaluationCache[targetFlagKey];
|
|
253
272
|
return this.flagEvaluatesToExpectedValue(property.value, targetFlagValue);
|
|
@@ -266,7 +285,7 @@ class FeatureFlagsPoller {
|
|
|
266
285
|
const flagAggregation = flagFilters.aggregation_group_type_index;
|
|
267
286
|
const earlyExitEnabled = flagFilters.early_exit ?? false;
|
|
268
287
|
const { groups, groupProperties } = evaluationContext;
|
|
269
|
-
let
|
|
288
|
+
let inconclusiveReason;
|
|
270
289
|
let result;
|
|
271
290
|
for (const condition of flagConditions)try {
|
|
272
291
|
const conditionAggregation = void 0 !== condition.aggregation_group_type_index ? condition.aggregation_group_type_index : flagAggregation;
|
|
@@ -280,7 +299,7 @@ class FeatureFlagsPoller {
|
|
|
280
299
|
continue;
|
|
281
300
|
}
|
|
282
301
|
if (!(groupName in groupProperties)) {
|
|
283
|
-
|
|
302
|
+
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, 'missing_context');
|
|
284
303
|
continue;
|
|
285
304
|
}
|
|
286
305
|
effectiveProperties = groupProperties[groupName];
|
|
@@ -295,16 +314,16 @@ class FeatureFlagsPoller {
|
|
|
295
314
|
break;
|
|
296
315
|
}
|
|
297
316
|
if (earlyExitEnabled && 'out_of_rollout_bound' === matchResult) {
|
|
298
|
-
if (
|
|
317
|
+
if (inconclusiveReason) break;
|
|
299
318
|
return false;
|
|
300
319
|
}
|
|
301
320
|
} catch (e) {
|
|
302
321
|
if (e instanceof RequiresServerEvaluation) throw e;
|
|
303
|
-
if (e instanceof core_namespaceObject.InconclusiveMatchError)
|
|
322
|
+
if (e instanceof core_namespaceObject.InconclusiveMatchError) inconclusiveReason = pickUnresolvedReason(inconclusiveReason, e.reason);
|
|
304
323
|
else throw e;
|
|
305
324
|
}
|
|
306
325
|
if (void 0 !== result) return result;
|
|
307
|
-
if (
|
|
326
|
+
if (inconclusiveReason) throw new core_namespaceObject.InconclusiveMatchError("Can't determine if feature flag is enabled or not with given properties", inconclusiveReason);
|
|
308
327
|
return false;
|
|
309
328
|
}
|
|
310
329
|
async isConditionMatch(flag, bucketingValue, condition, properties, evaluationContext) {
|
|
@@ -315,15 +334,38 @@ class FeatureFlagsPoller {
|
|
|
315
334
|
this.logMsgIfDebug(()=>console.warn(msg));
|
|
316
335
|
};
|
|
317
336
|
if ((condition.properties || []).length > 0) {
|
|
337
|
+
let inconclusiveReason;
|
|
338
|
+
let serverEvaluationError;
|
|
318
339
|
for (const prop of condition.properties){
|
|
319
340
|
const propertyType = prop.type;
|
|
320
341
|
let matches = false;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
342
|
+
try {
|
|
343
|
+
if ('cohort' === propertyType) {
|
|
344
|
+
const inCohort = await matchCohort(prop, properties, definitions.cohorts, this.debugMode, (depProp)=>this.evaluateFlagDependency(depProp, properties, evaluationContext), definitions.propertyMatchingVersion);
|
|
345
|
+
matches = 'not_in' === prop.operator ? !inCohort : inCohort;
|
|
346
|
+
} else if ('flag' === propertyType) matches = await this.evaluateFlagDependency(prop, properties, evaluationContext);
|
|
347
|
+
else if (Object.prototype.hasOwnProperty.call(properties, prop.key)) matches = matchProperty(prop, properties, warnFunction, definitions.propertyMatchingVersion);
|
|
348
|
+
else {
|
|
349
|
+
(0, core_namespaceObject.assertFeatureFlagFilterSupported)(prop);
|
|
350
|
+
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, 'missing_context');
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
} catch (e) {
|
|
354
|
+
if (e instanceof RequiresServerEvaluation) {
|
|
355
|
+
if (void 0 === inconclusiveReason) serverEvaluationError ??= e;
|
|
356
|
+
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, e.reason);
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (e instanceof core_namespaceObject.InconclusiveMatchError) {
|
|
360
|
+
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, e.reason);
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
throw e;
|
|
364
|
+
}
|
|
325
365
|
if (!matches) return 'no_match';
|
|
326
366
|
}
|
|
367
|
+
if (serverEvaluationError) throw serverEvaluationError;
|
|
368
|
+
if (inconclusiveReason) throw new core_namespaceObject.InconclusiveMatchError(`Can't determine if a condition of flag ${flag.key} matches`, inconclusiveReason);
|
|
327
369
|
if (void 0 == rolloutPercentage) return 'match';
|
|
328
370
|
}
|
|
329
371
|
if (void 0 != rolloutPercentage && await (0, core_namespaceObject.getFeatureFlagHash)(flag.key, bucketingValue) > rolloutPercentage / 100.0) return 'out_of_rollout_bound';
|
|
@@ -365,10 +407,28 @@ class FeatureFlagsPoller {
|
|
|
365
407
|
this.loadedSuccessfullyOnce = true;
|
|
366
408
|
this.onMinimalFlagCalledEvents?.((flagData.minimal_flag_called_events ?? flagData.minimalFlagCalledEvents) === true);
|
|
367
409
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const
|
|
371
|
-
|
|
410
|
+
warnAboutUnresolvableFlags(flags) {
|
|
411
|
+
const experienceContinuityFlags = [];
|
|
412
|
+
const unsupportedDefinitionFlags = [];
|
|
413
|
+
const warnedFlags = new Map();
|
|
414
|
+
const definitions = this.currentDefinitions();
|
|
415
|
+
for (const flag of flags){
|
|
416
|
+
const reason = getDefinitionUnresolvedReason(flag, definitions);
|
|
417
|
+
if (!reason) continue;
|
|
418
|
+
const fingerprint = JSON.stringify(flag);
|
|
419
|
+
warnedFlags.set(flag.key, fingerprint);
|
|
420
|
+
if (this.warnedUnresolvableFlags.get(flag.key) !== fingerprint) if ('experience_continuity' === reason) experienceContinuityFlags.push(flag.key);
|
|
421
|
+
else unsupportedDefinitionFlags.push(flag.key);
|
|
422
|
+
}
|
|
423
|
+
this.warnedUnresolvableFlags = warnedFlags;
|
|
424
|
+
if (experienceContinuityFlags.length > 0) {
|
|
425
|
+
const consequence = this.strictLocalEvaluation ? "With strictLocalEvaluation enabled these flags are left unresolved. To evaluate them locally, disable experience continuity on these flags in PostHog." : "Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).";
|
|
426
|
+
console.warn(`[PostHog] You are using local evaluation but ${experienceContinuityFlags.length} flag(s) have experience continuity enabled and cannot be resolved locally (reason: experience_continuity): ${experienceContinuityFlags.join(', ')}. ` + consequence);
|
|
427
|
+
}
|
|
428
|
+
if (unsupportedDefinitionFlags.length > 0) {
|
|
429
|
+
const consequence = this.strictLocalEvaluation ? "With strictLocalEvaluation enabled these flags are left unresolved when evaluation reaches that part." : "Evaluating these flags falls back to a server request when evaluation reaches that part.";
|
|
430
|
+
console.warn(`[PostHog] You are using local evaluation but ${unsupportedDefinitionFlags.length} flag(s) use something local evaluation does not support, such as a static cohort, an unknown operator, or a missing or circular flag dependency (reason: unsupported_definition): ${unsupportedDefinitionFlags.join(', ')}. ${consequence} To evaluate them locally, change these flags in PostHog or upgrade posthog-node.`);
|
|
431
|
+
}
|
|
372
432
|
}
|
|
373
433
|
async loadFromCache(debugMessage) {
|
|
374
434
|
if (!this.cacheProvider) return false;
|
|
@@ -378,7 +438,7 @@ class FeatureFlagsPoller {
|
|
|
378
438
|
this.updateFlagState(cached);
|
|
379
439
|
this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${debugMessage} (${cached.flags.length} flags)`));
|
|
380
440
|
this.onLoad?.(this.featureFlags.length);
|
|
381
|
-
this.
|
|
441
|
+
this.warnAboutUnresolvableFlags(this.featureFlags);
|
|
382
442
|
return true;
|
|
383
443
|
}
|
|
384
444
|
return false;
|
|
@@ -488,7 +548,7 @@ class FeatureFlagsPoller {
|
|
|
488
548
|
this.onError?.(new Error(`Failed to store in cache: ${err}`));
|
|
489
549
|
}
|
|
490
550
|
this.onLoad?.(this.featureFlags.length);
|
|
491
|
-
this.
|
|
551
|
+
this.warnAboutUnresolvableFlags(this.featureFlags);
|
|
492
552
|
break;
|
|
493
553
|
}
|
|
494
554
|
default:
|
|
@@ -570,6 +630,37 @@ class FeatureFlagsPoller {
|
|
|
570
630
|
}
|
|
571
631
|
}
|
|
572
632
|
}
|
|
633
|
+
function getDefinitionUnresolvedReason(flag, definitions) {
|
|
634
|
+
if (!flag.active) return;
|
|
635
|
+
if (flag.ensure_experience_continuity) return 'experience_continuity';
|
|
636
|
+
const flagFilters = flag.filters || {};
|
|
637
|
+
const aggregation = flagFilters.aggregation_group_type_index;
|
|
638
|
+
if (void 0 != aggregation && !definitions.groupTypeMapping[String(aggregation)]) return 'unsupported_definition';
|
|
639
|
+
const usesUnsupportedProperty = (flagFilters.groups || []).some((condition)=>(condition.properties || []).some((property)=>isUnsupportedProperty(property, definitions, new Set())));
|
|
640
|
+
return usesUnsupportedProperty ? 'unsupported_definition' : void 0;
|
|
641
|
+
}
|
|
642
|
+
function isUnsupportedProperty(property, definitions, visitedCohortIds) {
|
|
643
|
+
if ('flag' === property.type) {
|
|
644
|
+
const dependencyChain = property.dependency_chain;
|
|
645
|
+
if (!Array.isArray(dependencyChain) || 0 === dependencyChain.length) return true;
|
|
646
|
+
return dependencyChain.some((key)=>!definitions.featureFlagsByKey[key] && !definitions.filteredOutFlagKeys.has(key));
|
|
647
|
+
}
|
|
648
|
+
if ('cohort' !== property.type) try {
|
|
649
|
+
(0, core_namespaceObject.assertFeatureFlagFilterSupported)(property);
|
|
650
|
+
return false;
|
|
651
|
+
} catch (e) {
|
|
652
|
+
if (e instanceof core_namespaceObject.InconclusiveMatchError) return true;
|
|
653
|
+
throw e;
|
|
654
|
+
}
|
|
655
|
+
const cohortId = String(property.value);
|
|
656
|
+
if (!(cohortId in definitions.cohorts)) return true;
|
|
657
|
+
if (visitedCohortIds.has(cohortId)) return false;
|
|
658
|
+
visitedCohortIds.add(cohortId);
|
|
659
|
+
return isUnsupportedPropertyGroup(definitions.cohorts[cohortId], definitions, visitedCohortIds);
|
|
660
|
+
}
|
|
661
|
+
function isUnsupportedPropertyGroup(group, definitions, visitedCohortIds) {
|
|
662
|
+
return (group?.values ?? []).some((value)=>'values' in value ? isUnsupportedPropertyGroup(value, definitions, visitedCohortIds) : isUnsupportedProperty(value, definitions, visitedCohortIds));
|
|
663
|
+
}
|
|
573
664
|
function matchProperty(property, propertyValues, warnFunction, propertyMatchingVersion) {
|
|
574
665
|
return (0, core_namespaceObject.matchFeatureFlagProperty)(property, propertyValues, {
|
|
575
666
|
warnFunction,
|
|
@@ -593,7 +684,7 @@ async function matchPropertyGroup(propertyGroup, propertyValues, cohortPropertie
|
|
|
593
684
|
const propertyGroupType = propertyGroup.type;
|
|
594
685
|
const properties = propertyGroup.values;
|
|
595
686
|
if (!properties || 0 === properties.length) return true;
|
|
596
|
-
let
|
|
687
|
+
let inconclusiveReason;
|
|
597
688
|
if ('values' in properties[0]) {
|
|
598
689
|
for (const prop of properties)try {
|
|
599
690
|
const matches = await matchPropertyGroup(prop, propertyValues, cohortProperties, debugMode, flagDependencyEvaluator, propertyMatchingVersion);
|
|
@@ -604,10 +695,10 @@ async function matchPropertyGroup(propertyGroup, propertyValues, cohortPropertie
|
|
|
604
695
|
if (err instanceof RequiresServerEvaluation) throw err;
|
|
605
696
|
if (err instanceof core_namespaceObject.InconclusiveMatchError) {
|
|
606
697
|
if (debugMode) console.debug(`Failed to compute property ${prop} locally: ${err}`);
|
|
607
|
-
|
|
698
|
+
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, err.reason);
|
|
608
699
|
} else throw err;
|
|
609
700
|
}
|
|
610
|
-
if (
|
|
701
|
+
if (inconclusiveReason) throw new core_namespaceObject.InconclusiveMatchError("Can't match cohort without a given cohort property value", inconclusiveReason);
|
|
611
702
|
return 'AND' === propertyGroupType;
|
|
612
703
|
}
|
|
613
704
|
for (const prop of properties)try {
|
|
@@ -629,10 +720,10 @@ async function matchPropertyGroup(propertyGroup, propertyValues, cohortPropertie
|
|
|
629
720
|
if (err instanceof RequiresServerEvaluation) throw err;
|
|
630
721
|
if (err instanceof core_namespaceObject.InconclusiveMatchError) {
|
|
631
722
|
if (debugMode) console.debug(`Failed to compute property ${prop} locally: ${err}`);
|
|
632
|
-
|
|
723
|
+
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, err.reason);
|
|
633
724
|
} else throw err;
|
|
634
725
|
}
|
|
635
|
-
if (
|
|
726
|
+
if (inconclusiveReason) throw new core_namespaceObject.InconclusiveMatchError("can't match cohort without a given cohort property value", inconclusiveReason);
|
|
636
727
|
return 'AND' === propertyGroupType;
|
|
637
728
|
}
|
|
638
729
|
exports.ClientError = __webpack_exports__.ClientError;
|