posthog-node 5.60.0 → 5.60.1
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/extensions/feature-flags/feature-flags.d.ts +1 -1
- package/dist/extensions/feature-flags/feature-flags.d.ts.map +1 -1
- package/dist/extensions/feature-flags/feature-flags.js +12 -3
- package/dist/extensions/feature-flags/feature-flags.mjs +12 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +1 -1
- package/src/extensions/feature-flags/feature-flags.ts +31 -6
- package/src/version.ts +1 -1
|
@@ -8,7 +8,7 @@ declare class ClientError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
declare class RequiresServerEvaluation extends Error {
|
|
10
10
|
readonly reason: UnresolvedFlagReason;
|
|
11
|
-
constructor(message: string);
|
|
11
|
+
constructor(message: string, reason?: UnresolvedFlagReason);
|
|
12
12
|
}
|
|
13
13
|
type FeatureFlagsPollerOptions = {
|
|
14
14
|
personalApiKey?: string;
|
|
@@ -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,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,E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ED;;;;;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;AA8KD,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,uCAAuC,EACvC,WAAW,EACX,sBAAsB,EACtB,wBAAwB,EACxB,WAAW,GACZ,CAAA"}
|
|
@@ -59,8 +59,8 @@ function setCustomErrorPrototype(error, constructor) {
|
|
|
59
59
|
Object.setPrototypeOf(error, constructor.prototype);
|
|
60
60
|
}
|
|
61
61
|
class RequiresServerEvaluation extends Error {
|
|
62
|
-
constructor(message){
|
|
63
|
-
super(message), this.reason =
|
|
62
|
+
constructor(message, reason = 'unsupported_definition'){
|
|
63
|
+
super(message), this.reason = reason;
|
|
64
64
|
setCustomErrorPrototype(this, RequiresServerEvaluation);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -266,6 +266,7 @@ class FeatureFlagsPoller {
|
|
|
266
266
|
const depResult = await this.computeFlagValueLocally(depFlag, evaluationContext);
|
|
267
267
|
evaluationCache[depFlagKey] = depResult;
|
|
268
268
|
} catch (error) {
|
|
269
|
+
if (error instanceof RequiresServerEvaluation) throw new RequiresServerEvaluation(`Flag dependency '${depFlagKey}' for flag '${targetFlagKey}' requires server evaluation: ${error.message}`, 'unresolved_dependency');
|
|
269
270
|
throw preserveRegexUncertainty(new core_namespaceObject.InconclusiveMatchError(`Error evaluating flag dependency '${depFlagKey}' for flag '${targetFlagKey}': ${error}`, 'unresolved_dependency'), error);
|
|
270
271
|
}
|
|
271
272
|
else evaluationCache[depFlagKey] = false;
|
|
@@ -327,7 +328,14 @@ class FeatureFlagsPoller {
|
|
|
327
328
|
return false;
|
|
328
329
|
}
|
|
329
330
|
} catch (e) {
|
|
330
|
-
if (e instanceof RequiresServerEvaluation)
|
|
331
|
+
if (e instanceof RequiresServerEvaluation) {
|
|
332
|
+
let definitionReason;
|
|
333
|
+
try {
|
|
334
|
+
definitionReason = getDefinitionUnresolvedReason(flag, evaluationContext.definitions);
|
|
335
|
+
} catch {}
|
|
336
|
+
const reason = pickUnresolvedReason(pickUnresolvedReason(inconclusiveReason, e.reason), definitionReason ?? e.reason);
|
|
337
|
+
throw reason === e.reason ? e : new RequiresServerEvaluation(e.message, reason);
|
|
338
|
+
}
|
|
331
339
|
if (e instanceof core_namespaceObject.InconclusiveMatchError) {
|
|
332
340
|
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, e.reason);
|
|
333
341
|
if (Symbol.for('posthog.requiresServerRegexEvaluation') in e) {
|
|
@@ -384,6 +392,7 @@ class FeatureFlagsPoller {
|
|
|
384
392
|
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, e.reason);
|
|
385
393
|
continue;
|
|
386
394
|
}
|
|
395
|
+
if (void 0 !== inconclusiveReason) break;
|
|
387
396
|
throw e;
|
|
388
397
|
}
|
|
389
398
|
if (!matches) return 'no_match';
|
|
@@ -21,8 +21,8 @@ function setCustomErrorPrototype(error, constructor) {
|
|
|
21
21
|
Object.setPrototypeOf(error, constructor.prototype);
|
|
22
22
|
}
|
|
23
23
|
class RequiresServerEvaluation extends Error {
|
|
24
|
-
constructor(message){
|
|
25
|
-
super(message), this.reason =
|
|
24
|
+
constructor(message, reason = 'unsupported_definition'){
|
|
25
|
+
super(message), this.reason = reason;
|
|
26
26
|
setCustomErrorPrototype(this, RequiresServerEvaluation);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -228,6 +228,7 @@ class FeatureFlagsPoller {
|
|
|
228
228
|
const depResult = await this.computeFlagValueLocally(depFlag, evaluationContext);
|
|
229
229
|
evaluationCache[depFlagKey] = depResult;
|
|
230
230
|
} catch (error) {
|
|
231
|
+
if (error instanceof RequiresServerEvaluation) throw new RequiresServerEvaluation(`Flag dependency '${depFlagKey}' for flag '${targetFlagKey}' requires server evaluation: ${error.message}`, 'unresolved_dependency');
|
|
231
232
|
throw preserveRegexUncertainty(new InconclusiveMatchError(`Error evaluating flag dependency '${depFlagKey}' for flag '${targetFlagKey}': ${error}`, 'unresolved_dependency'), error);
|
|
232
233
|
}
|
|
233
234
|
else evaluationCache[depFlagKey] = false;
|
|
@@ -289,7 +290,14 @@ class FeatureFlagsPoller {
|
|
|
289
290
|
return false;
|
|
290
291
|
}
|
|
291
292
|
} catch (e) {
|
|
292
|
-
if (e instanceof RequiresServerEvaluation)
|
|
293
|
+
if (e instanceof RequiresServerEvaluation) {
|
|
294
|
+
let definitionReason;
|
|
295
|
+
try {
|
|
296
|
+
definitionReason = getDefinitionUnresolvedReason(flag, evaluationContext.definitions);
|
|
297
|
+
} catch {}
|
|
298
|
+
const reason = pickUnresolvedReason(pickUnresolvedReason(inconclusiveReason, e.reason), definitionReason ?? e.reason);
|
|
299
|
+
throw reason === e.reason ? e : new RequiresServerEvaluation(e.message, reason);
|
|
300
|
+
}
|
|
293
301
|
if (e instanceof InconclusiveMatchError) {
|
|
294
302
|
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, e.reason);
|
|
295
303
|
if (Symbol.for('posthog.requiresServerRegexEvaluation') in e) {
|
|
@@ -346,6 +354,7 @@ class FeatureFlagsPoller {
|
|
|
346
354
|
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, e.reason);
|
|
347
355
|
continue;
|
|
348
356
|
}
|
|
357
|
+
if (void 0 !== inconclusiveReason) break;
|
|
349
358
|
throw e;
|
|
350
359
|
}
|
|
351
360
|
if (!matches) return 'no_match';
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.60.
|
|
1
|
+
export declare const version = "5.60.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/dist/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.60.
|
|
1
|
+
const version = "5.60.1";
|
|
2
2
|
export { version };
|
package/package.json
CHANGED
|
@@ -67,10 +67,11 @@ function setCustomErrorPrototype(error: Error, constructor: new (message: string
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
class RequiresServerEvaluation extends Error {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
constructor(
|
|
71
|
+
message: string,
|
|
72
|
+
// Server-side data such as a static cohort is never available locally.
|
|
73
|
+
readonly reason: UnresolvedFlagReason = 'unsupported_definition'
|
|
74
|
+
) {
|
|
74
75
|
super(message)
|
|
75
76
|
setCustomErrorPrototype(this, RequiresServerEvaluation)
|
|
76
77
|
}
|
|
@@ -551,6 +552,14 @@ class FeatureFlagsPoller {
|
|
|
551
552
|
const depResult = await this.computeFlagValueLocally(depFlag, evaluationContext)
|
|
552
553
|
evaluationCache[depFlagKey] = depResult
|
|
553
554
|
} catch (error) {
|
|
555
|
+
// Only the server knows this dependency's value, and that value can decide which
|
|
556
|
+
// condition of the dependent flag matches, so the dependent flag falls back too.
|
|
557
|
+
if (error instanceof RequiresServerEvaluation) {
|
|
558
|
+
throw new RequiresServerEvaluation(
|
|
559
|
+
`Flag dependency '${depFlagKey}' for flag '${targetFlagKey}' requires server evaluation: ${error.message}`,
|
|
560
|
+
'unresolved_dependency'
|
|
561
|
+
)
|
|
562
|
+
}
|
|
554
563
|
throw preserveRegexUncertainty(
|
|
555
564
|
new InconclusiveMatchError(
|
|
556
565
|
`Error evaluating flag dependency '${depFlagKey}' for flag '${targetFlagKey}': ${error}`,
|
|
@@ -680,8 +689,19 @@ class FeatureFlagsPoller {
|
|
|
680
689
|
}
|
|
681
690
|
} catch (e) {
|
|
682
691
|
if (e instanceof RequiresServerEvaluation) {
|
|
683
|
-
// Static cohort or other missing server-side data - must fallback to API
|
|
684
|
-
|
|
692
|
+
// Static cohort or other missing server-side data - must fallback to API.
|
|
693
|
+
// The fallback skips later conditions, so a higher reason in them comes from the definition.
|
|
694
|
+
let definitionReason: UnresolvedFlagReason | undefined
|
|
695
|
+
try {
|
|
696
|
+
definitionReason = getDefinitionUnresolvedReason(flag, evaluationContext.definitions!)
|
|
697
|
+
} catch {
|
|
698
|
+
// A malformed definition must not turn the server fallback into an evaluation error.
|
|
699
|
+
}
|
|
700
|
+
const reason = pickUnresolvedReason(
|
|
701
|
+
pickUnresolvedReason(inconclusiveReason, e.reason),
|
|
702
|
+
definitionReason ?? e.reason
|
|
703
|
+
)
|
|
704
|
+
throw reason === e.reason ? e : new RequiresServerEvaluation(e.message, reason)
|
|
685
705
|
} else if (e instanceof InconclusiveMatchError) {
|
|
686
706
|
// Evaluation error (bad regex, invalid date, missing property, etc.)
|
|
687
707
|
// Track that we had an inconclusive match, but try other conditions
|
|
@@ -793,6 +813,11 @@ class FeatureFlagsPoller {
|
|
|
793
813
|
inconclusiveReason = pickUnresolvedReason(inconclusiveReason, e.reason)
|
|
794
814
|
continue
|
|
795
815
|
}
|
|
816
|
+
// After a filter that could not be checked, stop the condition there as inconclusive,
|
|
817
|
+
// so an unexpected error does not stop later conditions from resolving the flag.
|
|
818
|
+
if (inconclusiveReason !== undefined) {
|
|
819
|
+
break
|
|
820
|
+
}
|
|
796
821
|
throw e
|
|
797
822
|
}
|
|
798
823
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "5.60.
|
|
1
|
+
export const version = "5.60.1"
|