interface FlagContext
Since 0.1.0

Evaluation context for targeting rules.

Properties

readonly
optional
userId: string

The user the flag is evaluated for.

Since 0.2.0
readonly
optional
tenantId: string

The tenant the flag is evaluated for, when the request resolves one.

A flag scoped with tenants (see the feature-flags plugin's FlagDefinition) is false for a context whose tenantId is not in that list — and false when no tenant is resolved at all. Optional, so every existing caller and implementor is source-compatible: a context without a tenantId only matters against a flag that scopes itself.

readonly
optional
attributes: Readonly<Record<string, string | number | boolean>>

Additional targeting attributes.

The built-in evaluation path accepts these but does not read them — only userId participates in allowlist and percentage targeting. They are carried through for a custom provider that implements its own targeting rules.

Usage

import { type FlagContext } from "common/src/index.ts";