posthog-node 5.56.4 → 5.57.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 +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -0
- package/dist/client.mjs +4 -0
- package/dist/exports.d.ts +1 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/extensions/feature-flags/feature-flags.d.ts +9 -5
- package/dist/extensions/feature-flags/feature-flags.d.ts.map +1 -1
- package/dist/extensions/feature-flags/feature-flags.js +182 -64
- package/dist/extensions/feature-flags/feature-flags.mjs +183 -65
- package/dist/feature-flag-evaluations.d.ts +12 -1
- package/dist/feature-flag-evaluations.d.ts.map +1 -1
- package/dist/feature-flag-evaluations.js +7 -1
- package/dist/feature-flag-evaluations.mjs +7 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.mjs +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +2 -2
- package/src/client.ts +21 -2
- package/src/exports.ts +1 -1
- package/src/extensions/feature-flags/feature-flags.ts +319 -71
- package/src/feature-flag-evaluations.ts +24 -3
- package/src/types.ts +7 -0
- package/src/version.ts +1 -1
package/dist/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.
|
|
1
|
+
const version = "5.57.1";
|
|
2
2
|
export { version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-node",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.57.1",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/PostHog/posthog-js/issues"
|
|
6
6
|
},
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"module": "dist/entrypoints/index.node.mjs",
|
|
30
30
|
"types": "dist/entrypoints/index.node.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@posthog/core": "^1.
|
|
32
|
+
"@posthog/core": "^1.60.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@edge-runtime/vm": "^5.0.0",
|
package/src/client.ts
CHANGED
|
@@ -30,7 +30,14 @@ import {
|
|
|
30
30
|
SyncSpanContextManager,
|
|
31
31
|
uuidv7,
|
|
32
32
|
} from '@posthog/core'
|
|
33
|
-
import type {
|
|
33
|
+
import type {
|
|
34
|
+
Metrics,
|
|
35
|
+
Span,
|
|
36
|
+
SpanContextManager,
|
|
37
|
+
StartSpanOptions,
|
|
38
|
+
TraceSdkContext,
|
|
39
|
+
UnresolvedFlagReason,
|
|
40
|
+
} from '@posthog/core'
|
|
34
41
|
import {
|
|
35
42
|
AllFlagsOptions,
|
|
36
43
|
EventMessage,
|
|
@@ -159,6 +166,8 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
|
|
|
159
166
|
private _v1Sender?: V1CaptureSender
|
|
160
167
|
/** Whether this client captures full AI content: see `enableFullAiCapture` in `PostHogOptions`. */
|
|
161
168
|
public readonly enableFullAiCapture: boolean
|
|
169
|
+
/** Whether PostHog AI integrations redact content: see `privacyMode` in `PostHogOptions`. */
|
|
170
|
+
public readonly privacyMode: boolean
|
|
162
171
|
private _aiCaptureRouteActive = false
|
|
163
172
|
|
|
164
173
|
// Feature flag overrides for local testing/development
|
|
@@ -244,6 +253,7 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
|
|
|
244
253
|
this.options = normalizedOptions
|
|
245
254
|
this.captureMode = resolveCaptureMode()
|
|
246
255
|
this.enableFullAiCapture = normalizedOptions.enableFullAiCapture === true
|
|
256
|
+
this.privacyMode = normalizedOptions.privacyMode === true
|
|
247
257
|
this.context = this.initializeContext()
|
|
248
258
|
|
|
249
259
|
this.options.featureFlagsPollingInterval =
|
|
@@ -2282,7 +2292,7 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
|
|
|
2282
2292
|
* {@label Feature flags}
|
|
2283
2293
|
*
|
|
2284
2294
|
* @param distinctIdOrOptions - The user's distinct ID, or options when the distinctId comes from `withContext()`
|
|
2285
|
-
* @param options - Optional configuration for flag evaluation. Supports the same fields as `getAllFlags()`. `flagKeys` scopes local evaluation, the `/flags` request, and the returned snapshot. `onlyEvaluateLocally` prevents fallback and leaves unresolved keys absent.
|
|
2295
|
+
* @param options - Optional configuration for flag evaluation. Supports the same fields as `getAllFlags()`. `flagKeys` scopes local evaluation, the `/flags` request, and the returned snapshot. `onlyEvaluateLocally` prevents fallback and leaves unresolved keys absent; the snapshot's `unresolvedFlags` lists them with a reason.
|
|
2286
2296
|
* @returns Promise that resolves to a `FeatureFlagEvaluations` snapshot
|
|
2287
2297
|
*/
|
|
2288
2298
|
async evaluateFlags(options?: AllFlagsOptions): Promise<FeatureFlagEvaluations>
|
|
@@ -2468,12 +2478,21 @@ export abstract class PostHogBackendClient extends PostHogCoreStateless implemen
|
|
|
2468
2478
|
}
|
|
2469
2479
|
}
|
|
2470
2480
|
|
|
2481
|
+
// A flag a remote fallback or override resolved has a value, so it is not unresolved.
|
|
2482
|
+
const unresolvedFlags: Record<string, UnresolvedFlagReason> = {}
|
|
2483
|
+
for (const [key, reason] of Object.entries(localResult?.unresolved ?? {})) {
|
|
2484
|
+
if (!Object.prototype.hasOwnProperty.call(records, key)) {
|
|
2485
|
+
unresolvedFlags[key] = reason
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2471
2489
|
return new FeatureFlagEvaluations({
|
|
2472
2490
|
host: this._getFeatureFlagEvaluationsHost(),
|
|
2473
2491
|
distinctId: resolvedDistinctId,
|
|
2474
2492
|
groups,
|
|
2475
2493
|
disableGeoip,
|
|
2476
2494
|
flags: records,
|
|
2495
|
+
unresolvedFlags,
|
|
2477
2496
|
requestId,
|
|
2478
2497
|
evaluatedAt,
|
|
2479
2498
|
flagDefinitionsLoadedAt: this.featureFlagsPoller?.getFlagDefinitionsLoadedAt(),
|
package/src/exports.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type {
|
|
|
12
12
|
// Re-export FeatureFlagError from core for backwards compatibility.
|
|
13
13
|
// These were originally defined in posthog-node and moved to core for reuse across SDKs.
|
|
14
14
|
export { FeatureFlagError } from '@posthog/core'
|
|
15
|
-
export type { FeatureFlagErrorType } from '@posthog/core'
|
|
15
|
+
export type { FeatureFlagErrorType, UnresolvedFlagReason } from '@posthog/core'
|
|
16
16
|
|
|
17
17
|
// Metrics types re-exported so consumers can name the `metrics` client option
|
|
18
18
|
// and API surface without a direct @posthog/core dependency.
|