posthog-node 5.51.6 → 5.51.8

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 (59) hide show
  1. package/dist/ai-capture/batching.js +12 -8
  2. package/dist/ai-capture/routing.js +18 -14
  3. package/dist/capture-v1/config.js +16 -12
  4. package/dist/capture-v1/config.mjs +1 -1
  5. package/dist/capture-v1/errors.js +15 -11
  6. package/dist/capture-v1/routing.js +18 -13
  7. package/dist/capture-v1/sender.js +12 -8
  8. package/dist/capture-v1/transform.js +18 -14
  9. package/dist/capture-v1/types.js +2 -2
  10. package/dist/capture-v1/types.mjs +1 -0
  11. package/dist/client.d.ts +16 -6
  12. package/dist/client.d.ts.map +1 -1
  13. package/dist/client.js +18 -14
  14. package/dist/client.mjs +4 -4
  15. package/dist/entrypoints/index.edge.js +35 -33
  16. package/dist/entrypoints/index.node.js +50 -48
  17. package/dist/entrypoints/nestjs.js +16 -14
  18. package/dist/experimental.js +2 -2
  19. package/dist/experimental.mjs +1 -0
  20. package/dist/exports.js +61 -63
  21. package/dist/exports.mjs +2 -3
  22. package/dist/extensions/context/context.js +12 -8
  23. package/dist/extensions/context/types.js +2 -2
  24. package/dist/extensions/context/types.mjs +1 -0
  25. package/dist/extensions/error-tracking/autocapture.js +17 -13
  26. package/dist/extensions/error-tracking/index.js +12 -8
  27. package/dist/extensions/error-tracking/index.mjs +1 -1
  28. package/dist/extensions/error-tracking/modifiers/context-lines.node.js +15 -11
  29. package/dist/extensions/error-tracking/modifiers/module.node.js +12 -8
  30. package/dist/extensions/error-tracking/modifiers/relative-path.node.js +12 -8
  31. package/dist/extensions/express.js +14 -10
  32. package/dist/extensions/feature-flags/cache.js +2 -2
  33. package/dist/extensions/feature-flags/cache.mjs +1 -0
  34. package/dist/extensions/feature-flags/crypto.js +12 -8
  35. package/dist/extensions/feature-flags/crypto.mjs +1 -2
  36. package/dist/extensions/feature-flags/feature-flags.js +17 -13
  37. package/dist/extensions/nestjs.js +12 -8
  38. package/dist/extensions/sentry-integration.js +17 -11
  39. package/dist/extensions/sentry-integration.mjs +3 -1
  40. package/dist/extensions/tracing-headers.js +20 -15
  41. package/dist/extensions/url-utils.js +14 -10
  42. package/dist/feature-flag-evaluations.d.ts +7 -4
  43. package/dist/feature-flag-evaluations.d.ts.map +1 -1
  44. package/dist/feature-flag-evaluations.js +12 -8
  45. package/dist/gzip.node.js +12 -8
  46. package/dist/storage-memory.js +15 -11
  47. package/dist/types.d.ts +6 -2
  48. package/dist/types.d.ts.map +1 -1
  49. package/dist/types.js +15 -11
  50. package/dist/version.d.ts +1 -1
  51. package/dist/version.js +15 -11
  52. package/dist/version.mjs +1 -1
  53. package/package.json +11 -11
  54. package/src/client.ts +16 -6
  55. package/src/extensions/error-tracking/modifiers/module.node.ts +1 -1
  56. package/src/extensions/tracing-headers.ts +1 -1
  57. package/src/feature-flag-evaluations.ts +7 -4
  58. package/src/types.ts +6 -2
  59. package/src/version.ts +1 -1
@@ -29,7 +29,7 @@ function createGetModuleFromFilename(
29
29
 
30
30
  const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename
31
31
 
32
- // eslint-disable-next-line prefer-const
32
+ // oxlint-disable-next-line prefer-const
33
33
  let { dir, base: file, ext } = posix.parse(normalizedFilename)
34
34
 
35
35
  if (ext === '.js' || ext === '.mjs' || ext === '.cjs') {
@@ -2,7 +2,7 @@ import type { IncomingHttpHeaders } from 'node:http'
2
2
 
3
3
  const TRACING_HEADER_MAX_LENGTH = 1000
4
4
  // Remove C0 controls, DEL, and C1 controls from PostHog tracing IDs only.
5
- // eslint-disable-next-line no-control-regex
5
+ // oxlint-disable-next-line no-control-regex
6
6
  const TRACING_HEADER_CONTROL_CHARS_REGEX = /[\x00-\x1f\x7f-\x9f]/g
7
7
 
8
8
  type HeaderValue = IncomingHttpHeaders[string]
@@ -121,7 +121,8 @@ export class FeatureFlagEvaluations {
121
121
  *
122
122
  * Flags that were not returned from the underlying evaluation resolve to
123
123
  * `options.defaultValue` (`false` unless overridden). A flag that has a value —
124
- * including `false` and variant strings — always wins over `options.defaultValue`.
124
+ * including a conclusive `false` result and variant strings — always wins over
125
+ * `options.defaultValue`. Use `getFlag()` to distinguish an absent result from `false`.
125
126
  */
126
127
  isEnabled(key: string, options: { defaultValue?: boolean } = {}): boolean {
127
128
  const flag = this._flags[key]
@@ -133,9 +134,11 @@ export class FeatureFlagEvaluations {
133
134
  * Get the evaluated value of a feature flag. Fires a `$feature_flag_called` event
134
135
  * on the first access per (distinctId, flag, value) tuple.
135
136
  *
136
- * Returns the variant string for multivariate flags, `true` for enabled flags
137
- * without a variant, `false` for disabled flags, and `undefined` for flags that
138
- * were not returned by the evaluation.
137
+ * Returns the variant string for multivariate flags, `true` for boolean flags that
138
+ * evaluate on, `false` for boolean flags that conclusively evaluate off, and `undefined`
139
+ * for flags that were not returned by the evaluation. Cached inactive definitions are
140
+ * conclusive `false` results during local evaluation, while remote evaluation omits
141
+ * globally inactive flags.
139
142
  */
140
143
  getFlag(key: string): FeatureFlagValue | undefined {
141
144
  const flag = this._flags[key]
package/src/types.ts CHANGED
@@ -422,6 +422,7 @@ export type FeatureFlagErrorType = (typeof FeatureFlagError)[keyof typeof Featur
422
422
  */
423
423
  export type FeatureFlagResult = {
424
424
  key: string
425
+ /** Whether the returned feature flag evaluation is enabled. `false` is a conclusive off result. */
425
426
  enabled: boolean
426
427
  variant: string | undefined
427
428
  payload: JsonType | undefined
@@ -582,7 +583,7 @@ export interface IPostHog {
582
583
  * @param onlyEvaluateLocally optional - whether to only evaluate the flag locally. Defaults to false.
583
584
  * @param sendFeatureFlagEvents optional - whether to send feature flag events. Used for Experiments. Defaults to true.
584
585
  *
585
- * @returns true if the flag is on, false if the flag is off, undefined if there was an error.
586
+ * @returns true if the flag evaluates on, false if it conclusively evaluates off, or undefined if no result is available. Local evaluation resolves cached inactive definitions to false; remote evaluation omits globally inactive flags, leaving no result.
586
587
  *
587
588
  * @deprecated Use {@link IPostHog.evaluateFlags} and call `flags.isEnabled(key)` on the
588
589
  * returned snapshot. Will be removed in the next major version.
@@ -613,7 +614,7 @@ export interface IPostHog {
613
614
  * @param onlyEvaluateLocally optional - whether to only evaluate the flag locally. Defaults to false.
614
615
  * @param sendFeatureFlagEvents optional - whether to send feature flag events. Used for Experiments. Defaults to true.
615
616
  *
616
- * @returns true or string(for multivariates) if the flag is on, false if the flag is off, undefined if there was an error.
617
+ * @returns true or a variant string if the flag evaluates on, false if it conclusively evaluates off, or undefined if no result is available. Local evaluation resolves cached inactive definitions to false; remote evaluation omits globally inactive flags, leaving no result.
617
618
  *
618
619
  * @deprecated Use {@link IPostHog.evaluateFlags} and call `flags.getFlag(key)` on the
619
620
  * returned snapshot. Will be removed in the next major version.
@@ -745,6 +746,9 @@ export interface IPostHog {
745
746
  * posthog.capture({ distinctId: 'user_123', event: 'page_viewed', flags })
746
747
  * ```
747
748
  *
749
+ * Local evaluation resolves cached inactive definitions to `false`. Remote evaluation omits
750
+ * globally inactive flags, so those keys are absent when no local definition is available.
751
+ *
748
752
  * @param options - Optional configuration for flag evaluation. `flagKeys` scopes local evaluation, the `/flags` request, and the returned snapshot. Missing local keys trigger fallback unless `onlyEvaluateLocally` is true.
749
753
  */
750
754
  evaluateFlags(options?: AllFlagsOptions): Promise<FeatureFlagEvaluations>
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.51.6'
1
+ export const version = '5.51.8'