posthog-node 5.25.0 → 5.26.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FeatureFlagValue, JsonType, PostHogCaptureOptions, PostHogCoreStateless, PostHogFetchOptions, PostHogFetchResponse, PostHogFlagsAndPayloadsResponse, PostHogPersistedProperty } from '@posthog/core';
2
- import { EventMessage, FeatureFlagResult, GroupIdentifyMessage, IdentifyMessage, IPostHog, OverrideFeatureFlagsOptions, PostHogOptions } from './types';
2
+ import { EventMessage, FeatureFlagResult, GroupIdentifyMessage, IdentifyMessage, IPostHog, OverrideFeatureFlagsOptions, PostHogOptions, FlagEvaluationOptions, AllFlagsOptions } from './types';
3
3
  import ErrorTracking from './extensions/error-tracking';
4
4
  import { PostHogEventProperties } from '@posthog/core';
5
5
  import { ContextData, ContextOptions, IPostHogContext } from './extensions/context/types';
@@ -394,6 +394,7 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
394
394
  * @returns Promise that resolves to true if ready, false if timed out
395
395
  */
396
396
  waitForLocalEvaluationReady(timeoutMs?: number): Promise<boolean>;
397
+ private _resolveDistinctId;
397
398
  /**
398
399
  * Internal method that handles feature flag evaluation with full details.
399
400
  * Used by getFeatureFlag, getFeatureFlagPayload, and getFeatureFlagResult.
@@ -529,14 +530,8 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
529
530
  * @param options - Optional configuration for flag evaluation
530
531
  * @returns Promise that resolves to the flag result or undefined
531
532
  */
532
- getFeatureFlagResult(key: string, distinctId: string, options?: {
533
- groups?: Record<string, string>;
534
- personProperties?: Record<string, string>;
535
- groupProperties?: Record<string, Record<string, string>>;
536
- onlyEvaluateLocally?: boolean;
537
- sendFeatureFlagEvents?: boolean;
538
- disableGeoip?: boolean;
539
- }): Promise<FeatureFlagResult | undefined>;
533
+ getFeatureFlagResult(key: string, options?: FlagEvaluationOptions): Promise<FeatureFlagResult | undefined>;
534
+ getFeatureFlagResult(key: string, distinctId: string, options?: FlagEvaluationOptions): Promise<FeatureFlagResult | undefined>;
540
535
  /**
541
536
  * Get the remote config payload for a feature flag.
542
537
  *
@@ -630,14 +625,8 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
630
625
  * @param options - Optional configuration for flag evaluation
631
626
  * @returns Promise that resolves to a record of flag keys and their values
632
627
  */
633
- getAllFlags(distinctId: string, options?: {
634
- groups?: Record<string, string>;
635
- personProperties?: Record<string, string>;
636
- groupProperties?: Record<string, Record<string, string>>;
637
- onlyEvaluateLocally?: boolean;
638
- disableGeoip?: boolean;
639
- flagKeys?: string[];
640
- }): Promise<Record<string, FeatureFlagValue>>;
628
+ getAllFlags(options?: AllFlagsOptions): Promise<Record<string, FeatureFlagValue>>;
629
+ getAllFlags(distinctId: string, options?: AllFlagsOptions): Promise<Record<string, FeatureFlagValue>>;
641
630
  /**
642
631
  * Get all feature flag values and payloads for a specific user.
643
632
  *
@@ -671,14 +660,8 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
671
660
  * @param options - Optional configuration for flag evaluation
672
661
  * @returns Promise that resolves to flags and payloads
673
662
  */
674
- getAllFlagsAndPayloads(distinctId: string, options?: {
675
- groups?: Record<string, string>;
676
- personProperties?: Record<string, string>;
677
- groupProperties?: Record<string, Record<string, string>>;
678
- onlyEvaluateLocally?: boolean;
679
- disableGeoip?: boolean;
680
- flagKeys?: string[];
681
- }): Promise<PostHogFlagsAndPayloadsResponse>;
663
+ getAllFlagsAndPayloads(options?: AllFlagsOptions): Promise<PostHogFlagsAndPayloadsResponse>;
664
+ getAllFlagsAndPayloads(distinctId: string, options?: AllFlagsOptions): Promise<PostHogFlagsAndPayloadsResponse>;
682
665
  /**
683
666
  * Create or update a group and its properties.
684
667
  *
@@ -811,6 +794,21 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
811
794
  * @returns The current context data, or undefined if no context is set
812
795
  */
813
796
  getContext(): ContextData | undefined;
797
+ /**
798
+ * Set context without a callback wrapper.
799
+ *
800
+ * Uses `AsyncLocalStorage.enterWith()` to attach context to the current
801
+ * async execution context. The context lives until that async context ends.
802
+ *
803
+ * Must be called in the same async scope that makes PostHog calls.
804
+ * Calling this outside a request-scoped async context will leak context
805
+ * across unrelated work. Prefer `withContext()` when you can wrap code
806
+ * in a callback — it creates an isolated scope that cleans up automatically.
807
+ *
808
+ * @param data - Context data to apply (distinctId, sessionId, properties)
809
+ * @param options - Context options (fresh: true to start with clean context instead of inheriting)
810
+ */
811
+ enterContext(data: Partial<ContextData>, options?: ContextOptions): void;
814
812
  /**
815
813
  * Shutdown the PostHog client gracefully.
816
814
  *
@@ -836,6 +834,7 @@ export declare abstract class PostHogBackendClient extends PostHogCoreStateless
836
834
  private extractPropertiesFromEvent;
837
835
  private getFeatureFlagsForEvent;
838
836
  private addLocalPersonAndGroupProperties;
837
+ private createFeatureFlagEvaluationContext;
839
838
  /**
840
839
  * Capture an error exception as an event.
841
840
  *
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gBAAgB,EAGhB,QAAQ,EACR,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAE/B,wBAAwB,EACzB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,YAAY,EAIZ,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,2BAA2B,EAC3B,cAAc,EAEf,MAAM,SAAS,CAAA;AAMhB,OAAO,aAAa,MAAM,6BAA6B,CAAA;AACvD,OAAO,EAAkB,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAGtE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AASzF,8BAAsB,oBAAqB,SAAQ,oBAAqB,YAAW,QAAQ;IACzF,OAAO,CAAC,cAAc,CAA6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;IAkErC,OAAO,CAAC,gCAAgC;IAqBxC,OAAO,CAAC,kCAAkC;IAe1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;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,GAC1B,IAAI;IAWP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;IAWH,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;IAkHF,OAAO,CAAC,cAAc;CAuBvB"}
package/dist/client.js CHANGED
@@ -177,6 +177,16 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
177
177
  });
178
178
  });
179
179
  }
180
+ _resolveDistinctId(distinctIdOrOptions, options) {
181
+ if ('string' == typeof distinctIdOrOptions) return {
182
+ distinctId: distinctIdOrOptions,
183
+ options
184
+ };
185
+ return {
186
+ distinctId: this.context?.get()?.distinctId,
187
+ options: distinctIdOrOptions
188
+ };
189
+ }
180
190
  async _getFeatureFlagResult(key, distinctId, options = {}, matchValue) {
181
191
  const sendFeatureFlagEvents = options.sendFeatureFlagEvents ?? true;
182
192
  if (void 0 !== this._flagOverrides && key in this._flagOverrides) {
@@ -195,6 +205,7 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
195
205
  const adjustedProperties = this.addLocalPersonAndGroupProperties(distinctId, groups, personProperties, groupProperties);
196
206
  personProperties = adjustedProperties.allPersonProperties;
197
207
  groupProperties = adjustedProperties.allGroupProperties;
208
+ const evaluationContext = this.createFeatureFlagEvaluationContext(distinctId, groups, personProperties, groupProperties);
198
209
  if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = this.options.strictLocalEvaluation ?? false;
199
210
  let result;
200
211
  let flagWasLocallyEvaluated = false;
@@ -209,7 +220,9 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
209
220
  await this.featureFlagsPoller?.loadFeatureFlags();
210
221
  const flag = this.featureFlagsPoller?.featureFlagsByKey[key];
211
222
  if (flag) try {
212
- const localResult = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(flag, distinctId, groups, personProperties, groupProperties, matchValue);
223
+ const localResult = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(flag, evaluationContext, {
224
+ matchValue
225
+ });
213
226
  if (localResult) {
214
227
  flagWasLocallyEvaluated = true;
215
228
  const value = localResult.value;
@@ -228,7 +241,7 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
228
241
  }
229
242
  }
230
243
  if (!flagWasLocallyEvaluated && !onlyEvaluateLocally) {
231
- const flagsResponse = await super.getFeatureFlagDetailsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, [
244
+ const flagsResponse = await super.getFeatureFlagDetailsStateless(evaluationContext.distinctId, evaluationContext.groups, evaluationContext.personProperties, evaluationContext.groupProperties, disableGeoip, [
232
245
  key
233
246
  ]);
234
247
  if (void 0 === flagsResponse) featureFlagError = external_types_js_namespaceObject.FeatureFlagError.UNKNOWN_ERROR;
@@ -314,10 +327,12 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
314
327
  if (void 0 === result) return;
315
328
  return result.payload ?? null;
316
329
  }
317
- async getFeatureFlagResult(key, distinctId, options) {
318
- return this._getFeatureFlagResult(key, distinctId, {
319
- ...options,
320
- sendFeatureFlagEvents: options?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
330
+ async getFeatureFlagResult(key, distinctIdOrOptions, options) {
331
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
332
+ if (!resolvedDistinctId) return void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()");
333
+ return this._getFeatureFlagResult(key, resolvedDistinctId, {
334
+ ...resolvedOptions,
335
+ sendFeatureFlagEvents: resolvedOptions?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
321
336
  });
322
337
  }
323
338
  async getRemoteConfigPayload(flagKey) {
@@ -335,18 +350,32 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
335
350
  if (void 0 === feat) return;
336
351
  return !!feat || false;
337
352
  }
338
- async getAllFlags(distinctId, options) {
339
- const response = await this.getAllFlagsAndPayloads(distinctId, options);
353
+ async getAllFlags(distinctIdOrOptions, options) {
354
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
355
+ if (!resolvedDistinctId) {
356
+ this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()");
357
+ return {};
358
+ }
359
+ const response = await this.getAllFlagsAndPayloads(resolvedDistinctId, resolvedOptions);
340
360
  return response.featureFlags || {};
341
361
  }
342
- async getAllFlagsAndPayloads(distinctId, options) {
343
- const { groups, disableGeoip, flagKeys } = options || {};
344
- let { onlyEvaluateLocally, personProperties, groupProperties } = options || {};
345
- const adjustedProperties = this.addLocalPersonAndGroupProperties(distinctId, groups, personProperties, groupProperties);
362
+ async getAllFlagsAndPayloads(distinctIdOrOptions, options) {
363
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
364
+ if (!resolvedDistinctId) {
365
+ this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()");
366
+ return {
367
+ featureFlags: {},
368
+ featureFlagPayloads: {}
369
+ };
370
+ }
371
+ const { groups, disableGeoip, flagKeys } = resolvedOptions || {};
372
+ let { onlyEvaluateLocally, personProperties, groupProperties } = resolvedOptions || {};
373
+ const adjustedProperties = this.addLocalPersonAndGroupProperties(resolvedDistinctId, groups, personProperties, groupProperties);
346
374
  personProperties = adjustedProperties.allPersonProperties;
347
375
  groupProperties = adjustedProperties.allGroupProperties;
376
+ const evaluationContext = this.createFeatureFlagEvaluationContext(resolvedDistinctId, groups, personProperties, groupProperties);
348
377
  if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = this.options.strictLocalEvaluation ?? false;
349
- const localEvaluationResult = await this.featureFlagsPoller?.getAllFlagsAndPayloads(distinctId, groups, personProperties, groupProperties, flagKeys);
378
+ const localEvaluationResult = await this.featureFlagsPoller?.getAllFlagsAndPayloads(evaluationContext, flagKeys);
350
379
  let featureFlags = {};
351
380
  let featureFlagPayloads = {};
352
381
  let fallbackToFlags = true;
@@ -356,7 +385,7 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
356
385
  fallbackToFlags = localEvaluationResult.fallbackToFlags;
357
386
  }
358
387
  if (fallbackToFlags && !onlyEvaluateLocally) {
359
- const remoteEvaluationResult = await super.getFeatureFlagsAndPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, flagKeys);
388
+ const remoteEvaluationResult = await super.getFeatureFlagsAndPayloadsStateless(evaluationContext.distinctId, evaluationContext.groups, evaluationContext.personProperties, evaluationContext.groupProperties, disableGeoip, flagKeys);
360
389
  featureFlags = {
361
390
  ...featureFlags,
362
391
  ...remoteEvaluationResult.flags || {}
@@ -441,6 +470,9 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
441
470
  getContext() {
442
471
  return this.context?.get();
443
472
  }
473
+ enterContext(data, options) {
474
+ this.context?.enter(data, options);
475
+ }
444
476
  async _shutdown(shutdownTimeoutMs) {
445
477
  this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
446
478
  this.errorTracking.shutdown();
@@ -538,6 +570,15 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
538
570
  allGroupProperties
539
571
  };
540
572
  }
573
+ createFeatureFlagEvaluationContext(distinctId, groups, personProperties, groupProperties) {
574
+ return {
575
+ distinctId,
576
+ groups: groups || {},
577
+ personProperties: personProperties || {},
578
+ groupProperties: groupProperties || {},
579
+ evaluationCache: {}
580
+ };
581
+ }
541
582
  captureException(error, distinctId, additionalProperties, uuid) {
542
583
  if (!index_js_default().isPreviouslyCapturedError(error)) {
543
584
  const syntheticException = new Error('PostHog syntheticException');
package/dist/client.mjs CHANGED
@@ -139,6 +139,16 @@ class PostHogBackendClient extends PostHogCoreStateless {
139
139
  });
140
140
  });
141
141
  }
142
+ _resolveDistinctId(distinctIdOrOptions, options) {
143
+ if ('string' == typeof distinctIdOrOptions) return {
144
+ distinctId: distinctIdOrOptions,
145
+ options
146
+ };
147
+ return {
148
+ distinctId: this.context?.get()?.distinctId,
149
+ options: distinctIdOrOptions
150
+ };
151
+ }
142
152
  async _getFeatureFlagResult(key, distinctId, options = {}, matchValue) {
143
153
  const sendFeatureFlagEvents = options.sendFeatureFlagEvents ?? true;
144
154
  if (void 0 !== this._flagOverrides && key in this._flagOverrides) {
@@ -157,6 +167,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
157
167
  const adjustedProperties = this.addLocalPersonAndGroupProperties(distinctId, groups, personProperties, groupProperties);
158
168
  personProperties = adjustedProperties.allPersonProperties;
159
169
  groupProperties = adjustedProperties.allGroupProperties;
170
+ const evaluationContext = this.createFeatureFlagEvaluationContext(distinctId, groups, personProperties, groupProperties);
160
171
  if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = this.options.strictLocalEvaluation ?? false;
161
172
  let result;
162
173
  let flagWasLocallyEvaluated = false;
@@ -171,7 +182,9 @@ class PostHogBackendClient extends PostHogCoreStateless {
171
182
  await this.featureFlagsPoller?.loadFeatureFlags();
172
183
  const flag = this.featureFlagsPoller?.featureFlagsByKey[key];
173
184
  if (flag) try {
174
- const localResult = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(flag, distinctId, groups, personProperties, groupProperties, matchValue);
185
+ const localResult = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(flag, evaluationContext, {
186
+ matchValue
187
+ });
175
188
  if (localResult) {
176
189
  flagWasLocallyEvaluated = true;
177
190
  const value = localResult.value;
@@ -190,7 +203,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
190
203
  }
191
204
  }
192
205
  if (!flagWasLocallyEvaluated && !onlyEvaluateLocally) {
193
- const flagsResponse = await super.getFeatureFlagDetailsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, [
206
+ const flagsResponse = await super.getFeatureFlagDetailsStateless(evaluationContext.distinctId, evaluationContext.groups, evaluationContext.personProperties, evaluationContext.groupProperties, disableGeoip, [
194
207
  key
195
208
  ]);
196
209
  if (void 0 === flagsResponse) featureFlagError = FeatureFlagError.UNKNOWN_ERROR;
@@ -276,10 +289,12 @@ class PostHogBackendClient extends PostHogCoreStateless {
276
289
  if (void 0 === result) return;
277
290
  return result.payload ?? null;
278
291
  }
279
- async getFeatureFlagResult(key, distinctId, options) {
280
- return this._getFeatureFlagResult(key, distinctId, {
281
- ...options,
282
- sendFeatureFlagEvents: options?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
292
+ async getFeatureFlagResult(key, distinctIdOrOptions, options) {
293
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
294
+ if (!resolvedDistinctId) return void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()");
295
+ return this._getFeatureFlagResult(key, resolvedDistinctId, {
296
+ ...resolvedOptions,
297
+ sendFeatureFlagEvents: resolvedOptions?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
283
298
  });
284
299
  }
285
300
  async getRemoteConfigPayload(flagKey) {
@@ -297,18 +312,32 @@ class PostHogBackendClient extends PostHogCoreStateless {
297
312
  if (void 0 === feat) return;
298
313
  return !!feat || false;
299
314
  }
300
- async getAllFlags(distinctId, options) {
301
- const response = await this.getAllFlagsAndPayloads(distinctId, options);
315
+ async getAllFlags(distinctIdOrOptions, options) {
316
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
317
+ if (!resolvedDistinctId) {
318
+ this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()");
319
+ return {};
320
+ }
321
+ const response = await this.getAllFlagsAndPayloads(resolvedDistinctId, resolvedOptions);
302
322
  return response.featureFlags || {};
303
323
  }
304
- async getAllFlagsAndPayloads(distinctId, options) {
305
- const { groups, disableGeoip, flagKeys } = options || {};
306
- let { onlyEvaluateLocally, personProperties, groupProperties } = options || {};
307
- const adjustedProperties = this.addLocalPersonAndGroupProperties(distinctId, groups, personProperties, groupProperties);
324
+ async getAllFlagsAndPayloads(distinctIdOrOptions, options) {
325
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
326
+ if (!resolvedDistinctId) {
327
+ this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()");
328
+ return {
329
+ featureFlags: {},
330
+ featureFlagPayloads: {}
331
+ };
332
+ }
333
+ const { groups, disableGeoip, flagKeys } = resolvedOptions || {};
334
+ let { onlyEvaluateLocally, personProperties, groupProperties } = resolvedOptions || {};
335
+ const adjustedProperties = this.addLocalPersonAndGroupProperties(resolvedDistinctId, groups, personProperties, groupProperties);
308
336
  personProperties = adjustedProperties.allPersonProperties;
309
337
  groupProperties = adjustedProperties.allGroupProperties;
338
+ const evaluationContext = this.createFeatureFlagEvaluationContext(resolvedDistinctId, groups, personProperties, groupProperties);
310
339
  if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = this.options.strictLocalEvaluation ?? false;
311
- const localEvaluationResult = await this.featureFlagsPoller?.getAllFlagsAndPayloads(distinctId, groups, personProperties, groupProperties, flagKeys);
340
+ const localEvaluationResult = await this.featureFlagsPoller?.getAllFlagsAndPayloads(evaluationContext, flagKeys);
312
341
  let featureFlags = {};
313
342
  let featureFlagPayloads = {};
314
343
  let fallbackToFlags = true;
@@ -318,7 +347,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
318
347
  fallbackToFlags = localEvaluationResult.fallbackToFlags;
319
348
  }
320
349
  if (fallbackToFlags && !onlyEvaluateLocally) {
321
- const remoteEvaluationResult = await super.getFeatureFlagsAndPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, flagKeys);
350
+ const remoteEvaluationResult = await super.getFeatureFlagsAndPayloadsStateless(evaluationContext.distinctId, evaluationContext.groups, evaluationContext.personProperties, evaluationContext.groupProperties, disableGeoip, flagKeys);
322
351
  featureFlags = {
323
352
  ...featureFlags,
324
353
  ...remoteEvaluationResult.flags || {}
@@ -403,6 +432,9 @@ class PostHogBackendClient extends PostHogCoreStateless {
403
432
  getContext() {
404
433
  return this.context?.get();
405
434
  }
435
+ enterContext(data, options) {
436
+ this.context?.enter(data, options);
437
+ }
406
438
  async _shutdown(shutdownTimeoutMs) {
407
439
  this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
408
440
  this.errorTracking.shutdown();
@@ -500,6 +532,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
500
532
  allGroupProperties
501
533
  };
502
534
  }
535
+ createFeatureFlagEvaluationContext(distinctId, groups, personProperties, groupProperties) {
536
+ return {
537
+ distinctId,
538
+ groups: groups || {},
539
+ personProperties: personProperties || {},
540
+ groupProperties: groupProperties || {},
541
+ evaluationCache: {}
542
+ };
543
+ }
503
544
  captureException(error, distinctId, additionalProperties, uuid) {
504
545
  if (!error_tracking.isPreviouslyCapturedError(error)) {
505
546
  const syntheticException = new Error('PostHog syntheticException');
@@ -4,5 +4,7 @@ export declare class PostHogContext implements IPostHogContext {
4
4
  constructor();
5
5
  get(): ContextData | undefined;
6
6
  run<T>(context: ContextData, fn: () => T, options?: ContextOptions): T;
7
+ enter(context: ContextData, options?: ContextOptions): void;
8
+ private resolve;
7
9
  }
8
10
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEtE,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,OAAO,CAAgC;;IAM/C,GAAG,IAAI,WAAW,GAAG,SAAS;IAI9B,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC;CAkBvE"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEtE,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,OAAO,CAAgC;;IAM/C,GAAG,IAAI,WAAW,GAAG,SAAS;IAI9B,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC;IAItE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI;IAI3D,OAAO,CAAC,OAAO;CAehB"}
@@ -35,20 +35,22 @@ class PostHogContext {
35
35
  return this.storage.getStore();
36
36
  }
37
37
  run(context, fn, options) {
38
- const fresh = options?.fresh === true;
39
- if (fresh) return this.storage.run(context, fn);
40
- {
41
- const currentContext = this.get() || {};
42
- const mergedContext = {
43
- distinctId: context.distinctId ?? currentContext.distinctId,
44
- sessionId: context.sessionId ?? currentContext.sessionId,
45
- properties: {
46
- ...currentContext.properties || {},
47
- ...context.properties || {}
48
- }
49
- };
50
- return this.storage.run(mergedContext, fn);
51
- }
38
+ return this.storage.run(this.resolve(context, options), fn);
39
+ }
40
+ enter(context, options) {
41
+ this.storage.enterWith(this.resolve(context, options));
42
+ }
43
+ resolve(context, options) {
44
+ if (options?.fresh === true) return context;
45
+ const current = this.get() || {};
46
+ return {
47
+ distinctId: context.distinctId ?? current.distinctId,
48
+ sessionId: context.sessionId ?? current.sessionId,
49
+ properties: {
50
+ ...current.properties || {},
51
+ ...context.properties || {}
52
+ }
53
+ };
52
54
  }
53
55
  }
54
56
  exports.PostHogContext = __webpack_exports__.PostHogContext;
@@ -7,20 +7,22 @@ class PostHogContext {
7
7
  return this.storage.getStore();
8
8
  }
9
9
  run(context, fn, options) {
10
- const fresh = options?.fresh === true;
11
- if (fresh) return this.storage.run(context, fn);
12
- {
13
- const currentContext = this.get() || {};
14
- const mergedContext = {
15
- distinctId: context.distinctId ?? currentContext.distinctId,
16
- sessionId: context.sessionId ?? currentContext.sessionId,
17
- properties: {
18
- ...currentContext.properties || {},
19
- ...context.properties || {}
20
- }
21
- };
22
- return this.storage.run(mergedContext, fn);
23
- }
10
+ return this.storage.run(this.resolve(context, options), fn);
11
+ }
12
+ enter(context, options) {
13
+ this.storage.enterWith(this.resolve(context, options));
14
+ }
15
+ resolve(context, options) {
16
+ if (options?.fresh === true) return context;
17
+ const current = this.get() || {};
18
+ return {
19
+ distinctId: context.distinctId ?? current.distinctId,
20
+ sessionId: context.sessionId ?? current.sessionId,
21
+ properties: {
22
+ ...current.properties || {},
23
+ ...context.properties || {}
24
+ }
25
+ };
24
26
  }
25
27
  }
26
28
  export { PostHogContext };
@@ -14,5 +14,6 @@ export interface ContextOptions {
14
14
  export interface IPostHogContext {
15
15
  get(): ContextData | undefined;
16
16
  run<T>(context: ContextData, fn: () => T, options?: ContextOptions): T;
17
+ enter(context: ContextData, options?: ContextOptions): void;
17
18
  }
18
19
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,IAAI,WAAW,GAAG,SAAS,CAAA;IAC9B,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC,CAAA;CACvE"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,IAAI,WAAW,GAAG,SAAS,CAAA;IAC9B,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC,CAAA;IACtE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CAC5D"}
@@ -25,6 +25,17 @@ type FeatureFlagsPollerOptions = {
25
25
  cacheProvider?: FlagDefinitionCacheProvider;
26
26
  strictLocalEvaluation?: boolean;
27
27
  };
28
+ export type FeatureFlagEvaluationContext = {
29
+ distinctId: string;
30
+ groups: Record<string, string>;
31
+ personProperties: Record<string, any>;
32
+ groupProperties: Record<string, Record<string, any>>;
33
+ evaluationCache: Record<string, FeatureFlagValue>;
34
+ };
35
+ type ComputeFlagAndPayloadOptions = {
36
+ matchValue?: FeatureFlagValue;
37
+ skipLoadCheck?: boolean;
38
+ };
28
39
  declare class FeatureFlagsPoller {
29
40
  pollingInterval: number;
30
41
  personalApiKey: string;
@@ -54,13 +65,14 @@ declare class FeatureFlagsPoller {
54
65
  constructor({ pollingInterval, personalApiKey, projectApiKey, timeout, host, customHeaders, ...options }: FeatureFlagsPollerOptions);
55
66
  debug(enabled?: boolean): void;
56
67
  private logMsgIfDebug;
68
+ private createEvaluationContext;
57
69
  getFeatureFlag(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, any>, groupProperties?: Record<string, Record<string, any>>): Promise<FeatureFlagValue | undefined>;
58
- getAllFlagsAndPayloads(distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, any>, groupProperties?: Record<string, Record<string, any>>, flagKeysToExplicitlyEvaluate?: string[]): Promise<{
70
+ getAllFlagsAndPayloads(evaluationContext: FeatureFlagEvaluationContext, flagKeysToExplicitlyEvaluate?: string[]): Promise<{
59
71
  response: Record<string, FeatureFlagValue>;
60
72
  payloads: Record<string, JsonType>;
61
73
  fallbackToFlags: boolean;
62
74
  }>;
63
- computeFlagAndPayloadLocally(flag: PostHogFeatureFlag, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, any>, groupProperties?: Record<string, Record<string, any>>, matchValue?: FeatureFlagValue, evaluationCache?: Record<string, FeatureFlagValue>, skipLoadCheck?: boolean): Promise<{
75
+ computeFlagAndPayloadLocally(flag: PostHogFeatureFlag, evaluationContext: FeatureFlagEvaluationContext, options?: ComputeFlagAndPayloadOptions): Promise<{
64
76
  value: FeatureFlagValue;
65
77
  payload: JsonType | null;
66
78
  }>;
@@ -69,8 +81,8 @@ declare class FeatureFlagsPoller {
69
81
  private getFeatureFlagPayload;
70
82
  private evaluateFlagDependency;
71
83
  private flagEvaluatesToExpectedValue;
72
- matchFeatureFlagProperties(flag: PostHogFeatureFlag, bucketingValue: string, properties: Record<string, any>, evaluationCache?: Record<string, FeatureFlagValue>, distinctId?: string, groups?: Record<string, string>, personProperties?: Record<string, any>, groupProperties?: Record<string, Record<string, any>>): Promise<FeatureFlagValue>;
73
- isConditionMatch(flag: PostHogFeatureFlag, bucketingValue: string, condition: FeatureFlagCondition, properties: Record<string, any>, evaluationCache?: Record<string, FeatureFlagValue>, distinctId?: string, groups?: Record<string, string>, personProperties?: Record<string, any>, groupProperties?: Record<string, Record<string, any>>): Promise<boolean>;
84
+ matchFeatureFlagProperties(flag: PostHogFeatureFlag, bucketingValue: string, properties: Record<string, any>, evaluationContext: FeatureFlagEvaluationContext): Promise<FeatureFlagValue>;
85
+ isConditionMatch(flag: PostHogFeatureFlag, bucketingValue: string, condition: FeatureFlagCondition, properties: Record<string, any>, evaluationContext: FeatureFlagEvaluationContext): Promise<boolean>;
74
86
  getMatchingVariant(flag: PostHogFeatureFlag, bucketingValue: string): Promise<FeatureFlagValue | undefined>;
75
87
  variantLookupTable(flag: PostHogFeatureFlag): {
76
88
  valueMin: number;
@@ -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;AAG1G,OAAO,EAAE,2BAA2B,EAA2B,MAAM,SAAS,CAAA;AAQ9E,cAAM,WAAY,SAAQ,KA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