Skip to content

RevTurbineUserContext

SDK-local user context state.

Extends the canonical UserContextInput with a local id field for user identification. The full persistence-ready UserContext (with tenant_id, user_id, timestamps) is built by the SDK via getUserContext().

custom is widened to Record<string, unknown> at the SDK boundary for customer convenience; values are narrowed to TraitValue when persisted via the API.

  • Omit<UserContextInput, "custom" | "entitlements" | "usage" | "personalization" | "derived_computed_at" | "context_hash">

optional context_hash?: string | null

Server-computed user-context hash (plan 74). Optional at the SDK input boundary for the same reason as derived_computed_at.


optional custom?: SdkTraits

Customer-defined fields for segmentation and personalization.


optional derived_computed_at?: string | null

Server-computed derived-entitlement cache stamp (plan 74). Optional at the SDK input boundary — local mode does not compute it; the control plane populates and round-trips it, defaulting to null when absent.


optional entitlements?: Record<string, boolean>

Feature entitlements granted by plan + entitlement rules.


optional id?: string

Authenticated user identifier. When undefined, the SDK uses an anonymous ID.


optional personalization?: SdkTraits

Transient personalization token map.

Holds SDK-derived tokens (plan_name, usage_current, etc.) merged with app-provided tokens. Not persisted — rebuilt on each SDK session. Widened to accept unknown at the SDK boundary; narrowed to string | number when serialized.


optional usage?: Record<string, { }>

Usage entries derived from credits / usage_limit entitlements, keyed by handle.