posthog-node 5.51.6 → 5.51.7
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/ai-capture/batching.js +12 -8
- package/dist/ai-capture/routing.js +18 -14
- package/dist/capture-v1/config.js +16 -12
- package/dist/capture-v1/config.mjs +1 -1
- package/dist/capture-v1/errors.js +15 -11
- package/dist/capture-v1/routing.js +18 -13
- package/dist/capture-v1/sender.js +12 -8
- package/dist/capture-v1/transform.js +18 -14
- package/dist/capture-v1/types.js +2 -2
- package/dist/capture-v1/types.mjs +1 -0
- package/dist/client.d.ts +16 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -14
- package/dist/client.mjs +4 -4
- package/dist/entrypoints/index.edge.js +35 -33
- package/dist/entrypoints/index.node.js +50 -48
- package/dist/entrypoints/nestjs.js +16 -14
- package/dist/experimental.js +2 -2
- package/dist/experimental.mjs +1 -0
- package/dist/exports.js +61 -63
- package/dist/exports.mjs +2 -3
- package/dist/extensions/context/context.js +12 -8
- package/dist/extensions/context/types.js +2 -2
- package/dist/extensions/context/types.mjs +1 -0
- package/dist/extensions/error-tracking/autocapture.js +17 -13
- package/dist/extensions/error-tracking/index.js +12 -8
- package/dist/extensions/error-tracking/index.mjs +1 -1
- package/dist/extensions/error-tracking/modifiers/context-lines.node.js +15 -11
- package/dist/extensions/error-tracking/modifiers/module.node.js +12 -8
- package/dist/extensions/error-tracking/modifiers/relative-path.node.js +12 -8
- package/dist/extensions/express.js +14 -10
- package/dist/extensions/feature-flags/cache.js +2 -2
- package/dist/extensions/feature-flags/cache.mjs +1 -0
- package/dist/extensions/feature-flags/crypto.js +12 -8
- package/dist/extensions/feature-flags/crypto.mjs +1 -2
- package/dist/extensions/feature-flags/feature-flags.js +17 -13
- package/dist/extensions/nestjs.js +12 -8
- package/dist/extensions/sentry-integration.js +17 -11
- package/dist/extensions/sentry-integration.mjs +3 -1
- package/dist/extensions/tracing-headers.js +20 -15
- package/dist/extensions/url-utils.js +14 -10
- package/dist/feature-flag-evaluations.d.ts +7 -4
- package/dist/feature-flag-evaluations.d.ts.map +1 -1
- package/dist/feature-flag-evaluations.js +12 -8
- package/dist/gzip.node.js +12 -8
- package/dist/storage-memory.js +15 -11
- package/dist/types.d.ts +6 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -11
- package/dist/version.d.ts +1 -1
- package/dist/version.js +15 -11
- package/dist/version.mjs +1 -1
- package/package.json +10 -10
- package/src/client.ts +16 -6
- package/src/extensions/error-tracking/modifiers/module.node.ts +1 -1
- package/src/extensions/tracing-headers.ts +1 -1
- package/src/feature-flag-evaluations.ts +7 -4
- package/src/types.ts +6 -2
- package/src/version.ts +1 -1
|
@@ -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
|
-
//
|
|
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
|
|
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
|
|
137
|
-
*
|
|
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
|
|
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
|
|
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.
|
|
1
|
+
export const version = '5.51.7'
|