posthog-node 5.10.0 → 5.10.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,oBAAoB,EAEpB,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAC/B,wBAAwB,EAExB,qBAAqB,EAEtB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,cAAc,EAEf,MAAM,SAAS,CAAA;AAChB,OAAO,EAAqB,gBAAgB,EAAuB,MAAM,eAAe,CAAA;AAExF,OAAO,aAAa,MAAM,6BAA6B,CAAA;AACvD,OAAO,EAAkB,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAUtE,8BAAsB,oBAAqB,SAAQ,oBAAqB,YAAW,QAAQ;IACzF,OAAO,CAAC,cAAc,CAA6B;IAEnD,OAAO,CAAC,kBAAkB,CAAC,CAAoB;IAC/C,SAAS,CAAC,aAAa,EAAE,aAAa,CAAA;IACtC,OAAO,CAAC,YAAY,CAAQ;IAC5B,SAAgB,OAAO,EAAE,cAAc,CAAA;IAEvC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;gBACS,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB;IA4CxD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,oBAAoB,CAAC,GAAG,EAAE,wBAAwB,GAAG,GAAG,GAAG,SAAS;IAIpE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,oBAAoB,CAAC,GAAG,EAAE,wBAAwB,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IAI5E;;;;;;;;;;;;;;;;;;;;OAoBG;IACH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OAAO,CAAC,0BAA0B;YA+BpB,uBAAuB;IAiErC,OAAO,CAAC,gCAAgC;IAqBxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAShH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACG,yBAAyB,CAC7B,KAAK,EAAE,OAAO,EACd,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAClD,OAAO,CAAC,IAAI,CAAC;IASH,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;IA8EF,OAAO,CAAC,cAAc;CAuBvB"}
package/dist/client.js CHANGED
@@ -223,12 +223,15 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
223
223
  if (localEvaluationEnabled) {
224
224
  await this.featureFlagsPoller?.loadFeatureFlags();
225
225
  const flag = this.featureFlagsPoller?.featureFlagsByKey[key];
226
- if (flag) {
226
+ if (flag) try {
227
227
  const result = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(flag, distinctId, groups, personProperties, groupProperties, matchValue);
228
228
  if (result) {
229
229
  matchValue = result.value;
230
230
  response = result.payload;
231
231
  }
232
+ } catch (e) {
233
+ if (e instanceof feature_flags_js_namespaceObject.RequiresServerEvaluation || e instanceof feature_flags_js_namespaceObject.InconclusiveMatchError) this._logger?.info(`${e.name} when computing flag locally: ${flag.key}: ${e.message}`);
234
+ else throw e;
232
235
  }
233
236
  }
234
237
  if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = false;
package/dist/client.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { version } from "./version.mjs";
2
2
  import { PostHogCoreStateless, getFeatureFlagValue, isPlainObject, safeSetTimeout } from "@posthog/core";
3
- import { FeatureFlagsPoller } from "./extensions/feature-flags/feature-flags.mjs";
3
+ import { FeatureFlagsPoller, InconclusiveMatchError, RequiresServerEvaluation } from "./extensions/feature-flags/feature-flags.mjs";
4
4
  import error_tracking from "./extensions/error-tracking/index.mjs";
5
5
  import { PostHogMemoryStorage } from "./storage-memory.mjs";
6
6
  const MINIMUM_POLLING_INTERVAL = 100;
@@ -185,12 +185,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
185
185
  if (localEvaluationEnabled) {
186
186
  await this.featureFlagsPoller?.loadFeatureFlags();
187
187
  const flag = this.featureFlagsPoller?.featureFlagsByKey[key];
188
- if (flag) {
188
+ if (flag) try {
189
189
  const result = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(flag, distinctId, groups, personProperties, groupProperties, matchValue);
190
190
  if (result) {
191
191
  matchValue = result.value;
192
192
  response = result.payload;
193
193
  }
194
+ } catch (e) {
195
+ if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) this._logger?.info(`${e.name} when computing flag locally: ${flag.key}: ${e.message}`);
196
+ else throw e;
194
197
  }
195
198
  }
196
199
  if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = false;
@@ -6,6 +6,9 @@ declare class ClientError extends Error {
6
6
  declare class InconclusiveMatchError extends Error {
7
7
  constructor(message: string);
8
8
  }
9
+ declare class RequiresServerEvaluation extends Error {
10
+ constructor(message: string);
11
+ }
9
12
  type FeatureFlagsPollerOptions = {
10
13
  personalApiKey: string;
11
14
  projectApiKey: string;
@@ -85,5 +88,5 @@ declare class FeatureFlagsPoller {
85
88
  }
86
89
  declare function matchProperty(property: FeatureFlagCondition['properties'][number], propertyValues: Record<string, any>, warnFunction?: (msg: string) => void): boolean;
87
90
  declare function relativeDateParseForFeatureFlagMatching(value: string): Date | null;
88
- export { FeatureFlagsPoller, matchProperty, relativeDateParseForFeatureFlagMatching, InconclusiveMatchError, ClientError, };
91
+ export { FeatureFlagsPoller, matchProperty, relativeDateParseForFeatureFlagMatching, InconclusiveMatchError, RequiresServerEvaluation, ClientError, };
89
92
  //# sourceMappingURL=feature-flags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../../src/extensions/feature-flags/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmC,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACtH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAU1G,cAAM,WAAY,SAAQ,KAAK;gBACjB,OAAO,EAAE,MAAM;CAO5B;AAED,cAAM,sBAAuB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAS5B;AAED,KAAK,yBAAyB,GAAG;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,CAAA;IACvB,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,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAC1C,CAAA;AAED,cAAM,kBAAkB;IACtB,eAAe,EAAE,MA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B,EAClB,aAAa,EACb,uCAAuC,EACvC,sBAAsB,EACtB,wBAAwB,EACxB,WAAW,GACZ,CAAA"}
@@ -24,11 +24,12 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
+ matchProperty: ()=>matchProperty,
27
28
  ClientError: ()=>ClientError,
28
29
  relativeDateParseForFeatureFlagMatching: ()=>relativeDateParseForFeatureFlagMatching,
29
30
  InconclusiveMatchError: ()=>InconclusiveMatchError,
30
31
  FeatureFlagsPoller: ()=>FeatureFlagsPoller,
31
- matchProperty: ()=>matchProperty
32
+ RequiresServerEvaluation: ()=>RequiresServerEvaluation
32
33
  });
33
34
  const core_namespaceObject = require("@posthog/core");
34
35
  const external_crypto_js_namespaceObject = require("./crypto.js");
@@ -54,6 +55,14 @@ class InconclusiveMatchError extends Error {
54
55
  Object.setPrototypeOf(this, InconclusiveMatchError.prototype);
55
56
  }
56
57
  }
58
+ class RequiresServerEvaluation extends Error {
59
+ constructor(message){
60
+ super(message);
61
+ this.name = this.constructor.name;
62
+ Error.captureStackTrace(this, this.constructor);
63
+ Object.setPrototypeOf(this, RequiresServerEvaluation.prototype);
64
+ }
65
+ }
57
66
  class FeatureFlagsPoller {
58
67
  constructor({ pollingInterval, personalApiKey, projectApiKey, timeout, host, customHeaders, ...options }){
59
68
  this.debugMode = false;
@@ -93,7 +102,7 @@ class FeatureFlagsPoller {
93
102
  response = result.value;
94
103
  this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${key} -> ${response}`));
95
104
  } catch (e) {
96
- if (e instanceof InconclusiveMatchError) this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${key}: ${e}`));
105
+ if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) this.logMsgIfDebug(()=>console.debug(`${e.name} when computing flag locally: ${key}: ${e.message}`));
97
106
  else if (e instanceof Error) this.onError?.(new Error(`Error computing flag locally: ${key}: ${e}`));
98
107
  }
99
108
  return response;
@@ -111,7 +120,7 @@ class FeatureFlagsPoller {
111
120
  response[flag.key] = matchValue;
112
121
  if (matchPayload) payloads[flag.key] = matchPayload;
113
122
  } catch (e) {
114
- if (e instanceof InconclusiveMatchError) this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${flag.key}: ${e}`));
123
+ if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) this.logMsgIfDebug(()=>console.debug(`${e.name} when computing flag locally: ${flag.key}: ${e.message}`));
115
124
  else if (e instanceof Error) this.onError?.(new Error(`Error computing flag locally: ${flag.key}: ${e}`));
116
125
  fallbackToFlags = true;
117
126
  }
@@ -214,6 +223,7 @@ class FeatureFlagsPoller {
214
223
  break;
215
224
  }
216
225
  } catch (e) {
226
+ if (e instanceof RequiresServerEvaluation) throw e;
217
227
  if (e instanceof InconclusiveMatchError) isInconclusive = true;
218
228
  else throw e;
219
229
  }
@@ -423,9 +433,12 @@ function matchProperty(property, propertyValues, warnFunction) {
423
433
  throw new InconclusiveMatchError(`Unknown operator: ${operator}`);
424
434
  }
425
435
  }
436
+ function checkCohortExists(cohortId, cohortProperties) {
437
+ if (!(cohortId in cohortProperties)) throw new RequiresServerEvaluation(`cohort ${cohortId} not found in local cohorts - likely a static cohort that requires server evaluation`);
438
+ }
426
439
  function matchCohort(property, propertyValues, cohortProperties, debugMode = false) {
427
440
  const cohortId = String(property.value);
428
- if (!(cohortId in cohortProperties)) throw new InconclusiveMatchError("can't match cohort without a given cohort property value");
441
+ checkCohortExists(cohortId, cohortProperties);
429
442
  const propertyGroup = cohortProperties[cohortId];
430
443
  return matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, debugMode);
431
444
  }
@@ -442,6 +455,7 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
442
455
  if (!matches) return false;
443
456
  } else if (matches) return true;
444
457
  } catch (err) {
458
+ if (err instanceof RequiresServerEvaluation) throw err;
445
459
  if (err instanceof InconclusiveMatchError) {
446
460
  if (debugMode) console.debug(`Failed to compute property ${prop} locally: ${err}`);
447
461
  errorMatchingLocally = true;
@@ -466,6 +480,7 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
466
480
  if (!matches && negation) return true;
467
481
  }
468
482
  } catch (err) {
483
+ if (err instanceof RequiresServerEvaluation) throw err;
469
484
  if (err instanceof InconclusiveMatchError) {
470
485
  if (debugMode) console.debug(`Failed to compute property ${prop} locally: ${err}`);
471
486
  errorMatchingLocally = true;
@@ -515,12 +530,14 @@ function relativeDateParseForFeatureFlagMatching(value) {
515
530
  exports.ClientError = __webpack_exports__.ClientError;
516
531
  exports.FeatureFlagsPoller = __webpack_exports__.FeatureFlagsPoller;
517
532
  exports.InconclusiveMatchError = __webpack_exports__.InconclusiveMatchError;
533
+ exports.RequiresServerEvaluation = __webpack_exports__.RequiresServerEvaluation;
518
534
  exports.matchProperty = __webpack_exports__.matchProperty;
519
535
  exports.relativeDateParseForFeatureFlagMatching = __webpack_exports__.relativeDateParseForFeatureFlagMatching;
520
536
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
521
537
  "ClientError",
522
538
  "FeatureFlagsPoller",
523
539
  "InconclusiveMatchError",
540
+ "RequiresServerEvaluation",
524
541
  "matchProperty",
525
542
  "relativeDateParseForFeatureFlagMatching"
526
543
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
@@ -22,6 +22,14 @@ class InconclusiveMatchError extends Error {
22
22
  Object.setPrototypeOf(this, InconclusiveMatchError.prototype);
23
23
  }
24
24
  }
25
+ class RequiresServerEvaluation extends Error {
26
+ constructor(message){
27
+ super(message);
28
+ this.name = this.constructor.name;
29
+ Error.captureStackTrace(this, this.constructor);
30
+ Object.setPrototypeOf(this, RequiresServerEvaluation.prototype);
31
+ }
32
+ }
25
33
  class FeatureFlagsPoller {
26
34
  constructor({ pollingInterval, personalApiKey, projectApiKey, timeout, host, customHeaders, ...options }){
27
35
  this.debugMode = false;
@@ -61,7 +69,7 @@ class FeatureFlagsPoller {
61
69
  response = result.value;
62
70
  this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${key} -> ${response}`));
63
71
  } catch (e) {
64
- if (e instanceof InconclusiveMatchError) this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${key}: ${e}`));
72
+ if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) this.logMsgIfDebug(()=>console.debug(`${e.name} when computing flag locally: ${key}: ${e.message}`));
65
73
  else if (e instanceof Error) this.onError?.(new Error(`Error computing flag locally: ${key}: ${e}`));
66
74
  }
67
75
  return response;
@@ -79,7 +87,7 @@ class FeatureFlagsPoller {
79
87
  response[flag.key] = matchValue;
80
88
  if (matchPayload) payloads[flag.key] = matchPayload;
81
89
  } catch (e) {
82
- if (e instanceof InconclusiveMatchError) this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${flag.key}: ${e}`));
90
+ if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) this.logMsgIfDebug(()=>console.debug(`${e.name} when computing flag locally: ${flag.key}: ${e.message}`));
83
91
  else if (e instanceof Error) this.onError?.(new Error(`Error computing flag locally: ${flag.key}: ${e}`));
84
92
  fallbackToFlags = true;
85
93
  }
@@ -182,6 +190,7 @@ class FeatureFlagsPoller {
182
190
  break;
183
191
  }
184
192
  } catch (e) {
193
+ if (e instanceof RequiresServerEvaluation) throw e;
185
194
  if (e instanceof InconclusiveMatchError) isInconclusive = true;
186
195
  else throw e;
187
196
  }
@@ -391,9 +400,12 @@ function matchProperty(property, propertyValues, warnFunction) {
391
400
  throw new InconclusiveMatchError(`Unknown operator: ${operator}`);
392
401
  }
393
402
  }
403
+ function checkCohortExists(cohortId, cohortProperties) {
404
+ if (!(cohortId in cohortProperties)) throw new RequiresServerEvaluation(`cohort ${cohortId} not found in local cohorts - likely a static cohort that requires server evaluation`);
405
+ }
394
406
  function matchCohort(property, propertyValues, cohortProperties, debugMode = false) {
395
407
  const cohortId = String(property.value);
396
- if (!(cohortId in cohortProperties)) throw new InconclusiveMatchError("can't match cohort without a given cohort property value");
408
+ checkCohortExists(cohortId, cohortProperties);
397
409
  const propertyGroup = cohortProperties[cohortId];
398
410
  return matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, debugMode);
399
411
  }
@@ -410,6 +422,7 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
410
422
  if (!matches) return false;
411
423
  } else if (matches) return true;
412
424
  } catch (err) {
425
+ if (err instanceof RequiresServerEvaluation) throw err;
413
426
  if (err instanceof InconclusiveMatchError) {
414
427
  if (debugMode) console.debug(`Failed to compute property ${prop} locally: ${err}`);
415
428
  errorMatchingLocally = true;
@@ -434,6 +447,7 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
434
447
  if (!matches && negation) return true;
435
448
  }
436
449
  } catch (err) {
450
+ if (err instanceof RequiresServerEvaluation) throw err;
437
451
  if (err instanceof InconclusiveMatchError) {
438
452
  if (debugMode) console.debug(`Failed to compute property ${prop} locally: ${err}`);
439
453
  errorMatchingLocally = true;
@@ -480,4 +494,4 @@ function relativeDateParseForFeatureFlagMatching(value) {
480
494
  return parsedDt;
481
495
  }
482
496
  }
483
- export { ClientError, FeatureFlagsPoller, InconclusiveMatchError, matchProperty, relativeDateParseForFeatureFlagMatching };
497
+ export { ClientError, FeatureFlagsPoller, InconclusiveMatchError, RequiresServerEvaluation, matchProperty, relativeDateParseForFeatureFlagMatching };
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "5.10.0";
1
+ export declare const version = "5.10.2";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  version: ()=>version
28
28
  });
29
- const version = '5.10.0';
29
+ const version = '5.10.2';
30
30
  exports.version = __webpack_exports__.version;
31
31
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
32
32
  "version"
package/dist/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const version = '5.10.0';
1
+ const version = '5.10.2';
2
2
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-node",
3
- "version": "5.10.0",
3
+ "version": "5.10.2",
4
4
  "description": "PostHog Node.js integration",
5
5
  "repository": {
6
6
  "type": "git",
package/src/client.ts CHANGED
@@ -21,7 +21,11 @@ import {
21
21
  SendFeatureFlagsOptions,
22
22
  } from './types'
23
23
  import { FeatureFlagDetail, FeatureFlagValue, getFeatureFlagValue } from '@posthog/core'
24
- import { FeatureFlagsPoller } from './extensions/feature-flags/feature-flags'
24
+ import {
25
+ FeatureFlagsPoller,
26
+ RequiresServerEvaluation,
27
+ InconclusiveMatchError,
28
+ } from './extensions/feature-flags/feature-flags'
25
29
  import ErrorTracking from './extensions/error-tracking'
26
30
  import { safeSetTimeout, PostHogEventProperties } from '@posthog/core'
27
31
  import { PostHogMemoryStorage } from './storage-memory'
@@ -800,17 +804,26 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
800
804
 
801
805
  const flag = this.featureFlagsPoller?.featureFlagsByKey[key]
802
806
  if (flag) {
803
- const result = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(
804
- flag,
805
- distinctId,
806
- groups,
807
- personProperties,
808
- groupProperties,
809
- matchValue
810
- )
811
- if (result) {
812
- matchValue = result.value
813
- response = result.payload
807
+ try {
808
+ const result = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(
809
+ flag,
810
+ distinctId,
811
+ groups,
812
+ personProperties,
813
+ groupProperties,
814
+ matchValue
815
+ )
816
+ if (result) {
817
+ matchValue = result.value
818
+ response = result.payload
819
+ }
820
+ } catch (e) {
821
+ if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) {
822
+ // Fall through to server evaluation
823
+ this._logger?.info(`${e.name} when computing flag locally: ${flag.key}: ${e.message}`)
824
+ } else {
825
+ throw e
826
+ }
814
827
  }
815
828
  }
816
829
  }
@@ -31,6 +31,18 @@ class InconclusiveMatchError extends Error {
31
31
  }
32
32
  }
33
33
 
34
+ class RequiresServerEvaluation extends Error {
35
+ constructor(message: string) {
36
+ super(message)
37
+ this.name = this.constructor.name
38
+ Error.captureStackTrace(this, this.constructor)
39
+ // instanceof doesn't work in ES3 or ES5
40
+ // https://www.dannyguo.com/blog/how-to-fix-instanceof-not-working-for-custom-errors-in-typescript/
41
+ // this is the workaround
42
+ Object.setPrototypeOf(this, RequiresServerEvaluation.prototype)
43
+ }
44
+ }
45
+
34
46
  type FeatureFlagsPollerOptions = {
35
47
  personalApiKey: string
36
48
  projectApiKey: string
@@ -130,8 +142,8 @@ class FeatureFlagsPoller {
130
142
  response = result.value
131
143
  this.logMsgIfDebug(() => console.debug(`Successfully computed flag locally: ${key} -> ${response}`))
132
144
  } catch (e) {
133
- if (e instanceof InconclusiveMatchError) {
134
- this.logMsgIfDebug(() => console.debug(`InconclusiveMatchError when computing flag locally: ${key}: ${e}`))
145
+ if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) {
146
+ this.logMsgIfDebug(() => console.debug(`${e.name} when computing flag locally: ${key}: ${e.message}`))
135
147
  } else if (e instanceof Error) {
136
148
  this.onError?.(new Error(`Error computing flag locally: ${key}: ${e}`))
137
149
  }
@@ -182,10 +194,8 @@ class FeatureFlagsPoller {
182
194
  payloads[flag.key] = matchPayload
183
195
  }
184
196
  } catch (e) {
185
- if (e instanceof InconclusiveMatchError) {
186
- this.logMsgIfDebug(() =>
187
- console.debug(`InconclusiveMatchError when computing flag locally: ${flag.key}: ${e}`)
188
- )
197
+ if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) {
198
+ this.logMsgIfDebug(() => console.debug(`${e.name} when computing flag locally: ${flag.key}: ${e.message}`))
189
199
  } else if (e instanceof Error) {
190
200
  this.onError?.(new Error(`Error computing flag locally: ${flag.key}: ${e}`))
191
201
  }
@@ -432,7 +442,12 @@ class FeatureFlagsPoller {
432
442
  break
433
443
  }
434
444
  } catch (e) {
435
- if (e instanceof InconclusiveMatchError) {
445
+ if (e instanceof RequiresServerEvaluation) {
446
+ // Static cohort or other missing server-side data - must fallback to API
447
+ throw e
448
+ } else if (e instanceof InconclusiveMatchError) {
449
+ // Evaluation error (bad regex, invalid date, missing property, etc.)
450
+ // Track that we had an inconclusive match, but try other conditions
436
451
  isInconclusive = true
437
452
  } else {
438
453
  throw e
@@ -443,6 +458,7 @@ class FeatureFlagsPoller {
443
458
  if (result !== undefined) {
444
459
  return result
445
460
  } else if (isInconclusive) {
461
+ // Had evaluation errors and no successful match - can't determine locally
446
462
  throw new InconclusiveMatchError("Can't determine if feature flag is enabled or not with given properties")
447
463
  }
448
464
 
@@ -809,6 +825,14 @@ function matchProperty(
809
825
  }
810
826
  }
811
827
 
828
+ function checkCohortExists(cohortId: string, cohortProperties: FeatureFlagsPoller['cohorts']): void {
829
+ if (!(cohortId in cohortProperties)) {
830
+ throw new RequiresServerEvaluation(
831
+ `cohort ${cohortId} not found in local cohorts - likely a static cohort that requires server evaluation`
832
+ )
833
+ }
834
+ }
835
+
812
836
  function matchCohort(
813
837
  property: FeatureFlagCondition['properties'][number],
814
838
  propertyValues: Record<string, any>,
@@ -816,9 +840,7 @@ function matchCohort(
816
840
  debugMode: boolean = false
817
841
  ): boolean {
818
842
  const cohortId = String(property.value)
819
- if (!(cohortId in cohortProperties)) {
820
- throw new InconclusiveMatchError("can't match cohort without a given cohort property value")
821
- }
843
+ checkCohortExists(cohortId, cohortProperties)
822
844
 
823
845
  const propertyGroup = cohortProperties[cohortId]
824
846
  return matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, debugMode)
@@ -860,7 +882,10 @@ function matchPropertyGroup(
860
882
  }
861
883
  }
862
884
  } catch (err) {
863
- if (err instanceof InconclusiveMatchError) {
885
+ if (err instanceof RequiresServerEvaluation) {
886
+ // Immediately propagate - this condition requires server-side data
887
+ throw err
888
+ } else if (err instanceof InconclusiveMatchError) {
864
889
  if (debugMode) {
865
890
  console.debug(`Failed to compute property ${prop} locally: ${err}`)
866
891
  }
@@ -914,7 +939,10 @@ function matchPropertyGroup(
914
939
  }
915
940
  }
916
941
  } catch (err) {
917
- if (err instanceof InconclusiveMatchError) {
942
+ if (err instanceof RequiresServerEvaluation) {
943
+ // Immediately propagate - this condition requires server-side data
944
+ throw err
945
+ } else if (err instanceof InconclusiveMatchError) {
918
946
  if (debugMode) {
919
947
  console.debug(`Failed to compute property ${prop} locally: ${err}`)
920
948
  }
@@ -999,5 +1027,6 @@ export {
999
1027
  matchProperty,
1000
1028
  relativeDateParseForFeatureFlagMatching,
1001
1029
  InconclusiveMatchError,
1030
+ RequiresServerEvaluation,
1002
1031
  ClientError,
1003
1032
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.10.0'
1
+ export const version = '5.10.2'