posthog-node 5.25.0 → 5.26.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/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;
@@ -278,8 +291,12 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
278
291
  locally_evaluated: flagWasLocallyEvaluated,
279
292
  [`$feature/${key}`]: response,
280
293
  $feature_flag_request_id: requestId,
281
- $feature_flag_evaluated_at: evaluatedAt
294
+ $feature_flag_evaluated_at: flagWasLocallyEvaluated ? Date.now() : evaluatedAt
282
295
  };
296
+ if (flagWasLocallyEvaluated && this.featureFlagsPoller) {
297
+ const flagDefinitionsLoadedAt = this.featureFlagsPoller.getFlagDefinitionsLoadedAt();
298
+ if (void 0 !== flagDefinitionsLoadedAt) properties.$feature_flag_definitions_loaded_at = flagDefinitionsLoadedAt;
299
+ }
283
300
  if (featureFlagError) properties.$feature_flag_error = featureFlagError;
284
301
  this.capture({
285
302
  distinctId,
@@ -314,10 +331,12 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
314
331
  if (void 0 === result) return;
315
332
  return result.payload ?? null;
316
333
  }
317
- async getFeatureFlagResult(key, distinctId, options) {
318
- return this._getFeatureFlagResult(key, distinctId, {
319
- ...options,
320
- sendFeatureFlagEvents: options?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
334
+ async getFeatureFlagResult(key, distinctIdOrOptions, options) {
335
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
336
+ if (!resolvedDistinctId) return void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()");
337
+ return this._getFeatureFlagResult(key, resolvedDistinctId, {
338
+ ...resolvedOptions,
339
+ sendFeatureFlagEvents: resolvedOptions?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
321
340
  });
322
341
  }
323
342
  async getRemoteConfigPayload(flagKey) {
@@ -335,18 +354,32 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
335
354
  if (void 0 === feat) return;
336
355
  return !!feat || false;
337
356
  }
338
- async getAllFlags(distinctId, options) {
339
- const response = await this.getAllFlagsAndPayloads(distinctId, options);
357
+ async getAllFlags(distinctIdOrOptions, options) {
358
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
359
+ if (!resolvedDistinctId) {
360
+ this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()");
361
+ return {};
362
+ }
363
+ const response = await this.getAllFlagsAndPayloads(resolvedDistinctId, resolvedOptions);
340
364
  return response.featureFlags || {};
341
365
  }
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);
366
+ async getAllFlagsAndPayloads(distinctIdOrOptions, options) {
367
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
368
+ if (!resolvedDistinctId) {
369
+ this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()");
370
+ return {
371
+ featureFlags: {},
372
+ featureFlagPayloads: {}
373
+ };
374
+ }
375
+ const { groups, disableGeoip, flagKeys } = resolvedOptions || {};
376
+ let { onlyEvaluateLocally, personProperties, groupProperties } = resolvedOptions || {};
377
+ const adjustedProperties = this.addLocalPersonAndGroupProperties(resolvedDistinctId, groups, personProperties, groupProperties);
346
378
  personProperties = adjustedProperties.allPersonProperties;
347
379
  groupProperties = adjustedProperties.allGroupProperties;
380
+ const evaluationContext = this.createFeatureFlagEvaluationContext(resolvedDistinctId, groups, personProperties, groupProperties);
348
381
  if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = this.options.strictLocalEvaluation ?? false;
349
- const localEvaluationResult = await this.featureFlagsPoller?.getAllFlagsAndPayloads(distinctId, groups, personProperties, groupProperties, flagKeys);
382
+ const localEvaluationResult = await this.featureFlagsPoller?.getAllFlagsAndPayloads(evaluationContext, flagKeys);
350
383
  let featureFlags = {};
351
384
  let featureFlagPayloads = {};
352
385
  let fallbackToFlags = true;
@@ -356,7 +389,7 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
356
389
  fallbackToFlags = localEvaluationResult.fallbackToFlags;
357
390
  }
358
391
  if (fallbackToFlags && !onlyEvaluateLocally) {
359
- const remoteEvaluationResult = await super.getFeatureFlagsAndPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, flagKeys);
392
+ const remoteEvaluationResult = await super.getFeatureFlagsAndPayloadsStateless(evaluationContext.distinctId, evaluationContext.groups, evaluationContext.personProperties, evaluationContext.groupProperties, disableGeoip, flagKeys);
360
393
  featureFlags = {
361
394
  ...featureFlags,
362
395
  ...remoteEvaluationResult.flags || {}
@@ -441,6 +474,9 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
441
474
  getContext() {
442
475
  return this.context?.get();
443
476
  }
477
+ enterContext(data, options) {
478
+ this.context?.enter(data, options);
479
+ }
444
480
  async _shutdown(shutdownTimeoutMs) {
445
481
  this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
446
482
  this.errorTracking.shutdown();
@@ -538,6 +574,15 @@ class PostHogBackendClient extends core_namespaceObject.PostHogCoreStateless {
538
574
  allGroupProperties
539
575
  };
540
576
  }
577
+ createFeatureFlagEvaluationContext(distinctId, groups, personProperties, groupProperties) {
578
+ return {
579
+ distinctId,
580
+ groups: groups || {},
581
+ personProperties: personProperties || {},
582
+ groupProperties: groupProperties || {},
583
+ evaluationCache: {}
584
+ };
585
+ }
541
586
  captureException(error, distinctId, additionalProperties, uuid) {
542
587
  if (!index_js_default().isPreviouslyCapturedError(error)) {
543
588
  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;
@@ -240,8 +253,12 @@ class PostHogBackendClient extends PostHogCoreStateless {
240
253
  locally_evaluated: flagWasLocallyEvaluated,
241
254
  [`$feature/${key}`]: response,
242
255
  $feature_flag_request_id: requestId,
243
- $feature_flag_evaluated_at: evaluatedAt
256
+ $feature_flag_evaluated_at: flagWasLocallyEvaluated ? Date.now() : evaluatedAt
244
257
  };
258
+ if (flagWasLocallyEvaluated && this.featureFlagsPoller) {
259
+ const flagDefinitionsLoadedAt = this.featureFlagsPoller.getFlagDefinitionsLoadedAt();
260
+ if (void 0 !== flagDefinitionsLoadedAt) properties.$feature_flag_definitions_loaded_at = flagDefinitionsLoadedAt;
261
+ }
245
262
  if (featureFlagError) properties.$feature_flag_error = featureFlagError;
246
263
  this.capture({
247
264
  distinctId,
@@ -276,10 +293,12 @@ class PostHogBackendClient extends PostHogCoreStateless {
276
293
  if (void 0 === result) return;
277
294
  return result.payload ?? null;
278
295
  }
279
- async getFeatureFlagResult(key, distinctId, options) {
280
- return this._getFeatureFlagResult(key, distinctId, {
281
- ...options,
282
- sendFeatureFlagEvents: options?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
296
+ async getFeatureFlagResult(key, distinctIdOrOptions, options) {
297
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
298
+ if (!resolvedDistinctId) return void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()");
299
+ return this._getFeatureFlagResult(key, resolvedDistinctId, {
300
+ ...resolvedOptions,
301
+ sendFeatureFlagEvents: resolvedOptions?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
283
302
  });
284
303
  }
285
304
  async getRemoteConfigPayload(flagKey) {
@@ -297,18 +316,32 @@ class PostHogBackendClient extends PostHogCoreStateless {
297
316
  if (void 0 === feat) return;
298
317
  return !!feat || false;
299
318
  }
300
- async getAllFlags(distinctId, options) {
301
- const response = await this.getAllFlagsAndPayloads(distinctId, options);
319
+ async getAllFlags(distinctIdOrOptions, options) {
320
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
321
+ if (!resolvedDistinctId) {
322
+ this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()");
323
+ return {};
324
+ }
325
+ const response = await this.getAllFlagsAndPayloads(resolvedDistinctId, resolvedOptions);
302
326
  return response.featureFlags || {};
303
327
  }
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);
328
+ async getAllFlagsAndPayloads(distinctIdOrOptions, options) {
329
+ const { distinctId: resolvedDistinctId, options: resolvedOptions } = this._resolveDistinctId(distinctIdOrOptions, options);
330
+ if (!resolvedDistinctId) {
331
+ this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()");
332
+ return {
333
+ featureFlags: {},
334
+ featureFlagPayloads: {}
335
+ };
336
+ }
337
+ const { groups, disableGeoip, flagKeys } = resolvedOptions || {};
338
+ let { onlyEvaluateLocally, personProperties, groupProperties } = resolvedOptions || {};
339
+ const adjustedProperties = this.addLocalPersonAndGroupProperties(resolvedDistinctId, groups, personProperties, groupProperties);
308
340
  personProperties = adjustedProperties.allPersonProperties;
309
341
  groupProperties = adjustedProperties.allGroupProperties;
342
+ const evaluationContext = this.createFeatureFlagEvaluationContext(resolvedDistinctId, groups, personProperties, groupProperties);
310
343
  if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = this.options.strictLocalEvaluation ?? false;
311
- const localEvaluationResult = await this.featureFlagsPoller?.getAllFlagsAndPayloads(distinctId, groups, personProperties, groupProperties, flagKeys);
344
+ const localEvaluationResult = await this.featureFlagsPoller?.getAllFlagsAndPayloads(evaluationContext, flagKeys);
312
345
  let featureFlags = {};
313
346
  let featureFlagPayloads = {};
314
347
  let fallbackToFlags = true;
@@ -318,7 +351,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
318
351
  fallbackToFlags = localEvaluationResult.fallbackToFlags;
319
352
  }
320
353
  if (fallbackToFlags && !onlyEvaluateLocally) {
321
- const remoteEvaluationResult = await super.getFeatureFlagsAndPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, flagKeys);
354
+ const remoteEvaluationResult = await super.getFeatureFlagsAndPayloadsStateless(evaluationContext.distinctId, evaluationContext.groups, evaluationContext.personProperties, evaluationContext.groupProperties, disableGeoip, flagKeys);
322
355
  featureFlags = {
323
356
  ...featureFlags,
324
357
  ...remoteEvaluationResult.flags || {}
@@ -403,6 +436,9 @@ class PostHogBackendClient extends PostHogCoreStateless {
403
436
  getContext() {
404
437
  return this.context?.get();
405
438
  }
439
+ enterContext(data, options) {
440
+ this.context?.enter(data, options);
441
+ }
406
442
  async _shutdown(shutdownTimeoutMs) {
407
443
  this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
408
444
  this.errorTracking.shutdown();
@@ -500,6 +536,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
500
536
  allGroupProperties
501
537
  };
502
538
  }
539
+ createFeatureFlagEvaluationContext(distinctId, groups, personProperties, groupProperties) {
540
+ return {
541
+ distinctId,
542
+ groups: groups || {},
543
+ personProperties: personProperties || {},
544
+ groupProperties: groupProperties || {},
545
+ evaluationCache: {}
546
+ };
547
+ }
503
548
  captureException(error, distinctId, additionalProperties, uuid) {
504
549
  if (!error_tracking.isPreviouslyCapturedError(error)) {
505
550
  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;
@@ -51,16 +62,18 @@ declare class FeatureFlagsPoller {
51
62
  private flagsEtag?;
52
63
  private nextFetchAllowedAt?;
53
64
  private strictLocalEvaluation;
65
+ private flagDefinitionsLoadedAt?;
54
66
  constructor({ pollingInterval, personalApiKey, projectApiKey, timeout, host, customHeaders, ...options }: FeatureFlagsPollerOptions);
55
67
  debug(enabled?: boolean): void;
56
68
  private logMsgIfDebug;
69
+ private createEvaluationContext;
57
70
  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<{
71
+ getAllFlagsAndPayloads(evaluationContext: FeatureFlagEvaluationContext, flagKeysToExplicitlyEvaluate?: string[]): Promise<{
59
72
  response: Record<string, FeatureFlagValue>;
60
73
  payloads: Record<string, JsonType>;
61
74
  fallbackToFlags: boolean;
62
75
  }>;
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<{
76
+ computeFlagAndPayloadLocally(flag: PostHogFeatureFlag, evaluationContext: FeatureFlagEvaluationContext, options?: ComputeFlagAndPayloadOptions): Promise<{
64
77
  value: FeatureFlagValue;
65
78
  payload: JsonType | null;
66
79
  }>;
@@ -69,8 +82,8 @@ declare class FeatureFlagsPoller {
69
82
  private getFeatureFlagPayload;
70
83
  private evaluateFlagDependency;
71
84
  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>;
85
+ matchFeatureFlagProperties(flag: PostHogFeatureFlag, bucketingValue: string, properties: Record<string, any>, evaluationContext: FeatureFlagEvaluationContext): Promise<FeatureFlagValue>;
86
+ isConditionMatch(flag: PostHogFeatureFlag, bucketingValue: string, condition: FeatureFlagCondition, properties: Record<string, any>, evaluationContext: FeatureFlagEvaluationContext): Promise<boolean>;
74
87
  getMatchingVariant(flag: PostHogFeatureFlag, bucketingValue: string): Promise<FeatureFlagValue | undefined>;
75
88
  variantLookupTable(flag: PostHogFeatureFlag): {
76
89
  valueMin: number;
@@ -98,6 +111,11 @@ declare class FeatureFlagsPoller {
98
111
  * This is useful to check if local evaluation is ready before calling getFeatureFlag.
99
112
  */
100
113
  isLocalEvaluationReady(): boolean;
114
+ /**
115
+ * Returns the timestamp (in milliseconds) when flag definitions were last loaded.
116
+ * Returns undefined if flags have not been loaded yet.
117
+ */
118
+ getFlagDefinitionsLoadedAt(): number | undefined;
101
119
  /**
102
120
  * If a client is misconfigured with an invalid or improper API key, the polling interval is doubled each time
103
121
  * until a successful request is made, up to a maximum of 60 seconds.
@@ -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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