posthog-node 5.11.2 → 5.13.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/src/types.ts CHANGED
@@ -6,6 +6,8 @@ import type {
6
6
  PostHogFetchResponse,
7
7
  } from '@posthog/core'
8
8
 
9
+ import type { FlagDefinitionCacheProvider } from './extensions/feature-flags/cache'
10
+
9
11
  export interface IdentifyMessage {
10
12
  distinctId: string
11
13
  properties?: Record<string | number, any>
@@ -72,6 +74,32 @@ export type PostHogOptions = PostHogCoreOptions & {
72
74
  // Whether to enable feature flag polling for local evaluation by default. Defaults to true when personalApiKey is provided.
73
75
  // We recommend setting this to false if you are only using the personalApiKey for evaluating remote config payloads via `getRemoteConfigPayload` and not using local evaluation.
74
76
  enableLocalEvaluation?: boolean
77
+ /**
78
+ * @experimental This API is experimental and may change in minor versions.
79
+ *
80
+ * Optional cache provider for feature flag definitions.
81
+ *
82
+ * Allows custom caching strategies (Redis, database, etc.) for flag definitions
83
+ * in multi-worker environments. If not provided, defaults to in-memory cache.
84
+ *
85
+ * This enables distributed coordination where only one worker fetches flags while
86
+ * others use cached data, reducing API calls and improving performance.
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * import { FlagDefinitionCacheProvider } from 'posthog-node/experimental'
91
+ *
92
+ * class RedisCacheProvider implements FlagDefinitionCacheProvider {
93
+ * // ... implementation
94
+ * }
95
+ *
96
+ * const client = new PostHog('api-key', {
97
+ * personalApiKey: 'personal-key',
98
+ * flagDefinitionCacheProvider: new RedisCacheProvider(redis)
99
+ * })
100
+ * ```
101
+ */
102
+ flagDefinitionCacheProvider?: FlagDefinitionCacheProvider
75
103
  /**
76
104
  * Allows modification or dropping of events before they're sent to PostHog.
77
105
  * If an array is provided, the functions are run in order.
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.11.2'
1
+ export const version = '5.13.0'