posthog-node 5.39.4 → 5.41.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.
Files changed (47) hide show
  1. package/LICENSE +2 -2
  2. package/dist/capture-v1/config.d.ts +11 -0
  3. package/dist/capture-v1/config.d.ts.map +1 -0
  4. package/dist/capture-v1/config.js +42 -0
  5. package/dist/capture-v1/config.mjs +8 -0
  6. package/dist/capture-v1/errors.d.ts +32 -0
  7. package/dist/capture-v1/errors.d.ts.map +1 -0
  8. package/dist/capture-v1/errors.js +49 -0
  9. package/dist/capture-v1/errors.mjs +15 -0
  10. package/dist/capture-v1/routing.d.ts +21 -0
  11. package/dist/capture-v1/routing.d.ts.map +1 -0
  12. package/dist/capture-v1/routing.js +47 -0
  13. package/dist/capture-v1/routing.mjs +7 -0
  14. package/dist/capture-v1/sender.d.ts +70 -0
  15. package/dist/capture-v1/sender.d.ts.map +1 -0
  16. package/dist/capture-v1/sender.js +222 -0
  17. package/dist/capture-v1/sender.mjs +188 -0
  18. package/dist/capture-v1/transform.d.ts +34 -0
  19. package/dist/capture-v1/transform.d.ts.map +1 -0
  20. package/dist/capture-v1/transform.js +142 -0
  21. package/dist/capture-v1/transform.mjs +99 -0
  22. package/dist/capture-v1/types.d.ts +50 -0
  23. package/dist/capture-v1/types.d.ts.map +1 -0
  24. package/dist/capture-v1/types.js +18 -0
  25. package/dist/capture-v1/types.mjs +0 -0
  26. package/dist/client.d.ts +24 -3
  27. package/dist/client.d.ts.map +1 -1
  28. package/dist/client.js +43 -1
  29. package/dist/client.mjs +44 -2
  30. package/dist/extensions/feature-flags/feature-flags.js +2 -2
  31. package/dist/extensions/feature-flags/feature-flags.mjs +2 -2
  32. package/dist/types.d.ts +17 -0
  33. package/dist/types.d.ts.map +1 -1
  34. package/dist/version.d.ts +1 -1
  35. package/dist/version.js +1 -1
  36. package/dist/version.mjs +1 -1
  37. package/package.json +3 -3
  38. package/src/capture-v1/config.ts +18 -0
  39. package/src/capture-v1/errors.ts +52 -0
  40. package/src/capture-v1/routing.ts +28 -0
  41. package/src/capture-v1/sender.ts +298 -0
  42. package/src/capture-v1/transform.ts +159 -0
  43. package/src/capture-v1/types.ts +55 -0
  44. package/src/client.ts +80 -3
  45. package/src/extensions/feature-flags/feature-flags.ts +2 -2
  46. package/src/types.ts +19 -2
  47. package/src/version.ts +1 -1
package/src/types.ts CHANGED
@@ -145,6 +145,23 @@ export type BeforeSendFn = (event: EventMessage | null) => EventMessage | null
145
145
 
146
146
  export type PostHogOptions = Omit<PostHogCoreOptions, 'before_send'> & {
147
147
  persistence?: 'memory'
148
+ /**
149
+ * Credential that enables local feature flag evaluation and remote config.
150
+ *
151
+ * Accepts either a Personal API Key (`phx_...`) or a Project Secret API Key (`phs_...`).
152
+ * When provided, the client can evaluate feature flags locally and decrypt remote
153
+ * config payloads via `getRemoteConfigPayload`. Prefer this over the deprecated
154
+ * `personalApiKey` option; when both are set, `secretKey` takes precedence.
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * const client = new PostHog('phc_...', { secretKey: 'phs_...' })
159
+ * ```
160
+ */
161
+ secretKey?: string
162
+ /**
163
+ * @deprecated Use `secretKey` instead.
164
+ */
148
165
  personalApiKey?: string
149
166
  privacyMode?: boolean
150
167
  enableExceptionAutocapture?: boolean
@@ -153,8 +170,8 @@ export type PostHogOptions = Omit<PostHogCoreOptions, 'before_send'> & {
153
170
  // Maximum size of cache that deduplicates $feature_flag_called calls per user.
154
171
  maxCacheSize?: number
155
172
  fetch?: (url: string, options: PostHogFetchOptions) => Promise<PostHogFetchResponse>
156
- // Whether to enable feature flag polling for local evaluation by default. Defaults to true when personalApiKey is provided.
157
- // 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.
173
+ // Whether to enable feature flag polling for local evaluation by default. Defaults to true when secretKey is provided.
174
+ // We recommend setting this to false if you are only using the secretKey for evaluating remote config payloads via `getRemoteConfigPayload` and not using local evaluation.
158
175
  enableLocalEvaluation?: boolean
159
176
  /**
160
177
  * Optional cache provider for feature flag definitions.
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.39.4'
1
+ export const version = '5.41.0'