FeatureFlagBehaviorOptions
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
Defined in: packages/pipeline-feature-flags/src/interfaces/feature-flags-options.interface.ts:69
Per-handler feature-flag options, supplied through
pipeline.wrap(options, [FeatureFlagBehavior, options]) and/or as defaults,
the second argument of the FeatureFlagBehavior constructor.
Properties
Section titled “Properties”allowedVariants?
Section titled “allowedVariants?”
optionalallowedVariants?: readonlystring[]
Defined in: packages/pipeline-feature-flags/src/interfaces/feature-flags-options.interface.ts:140
Optional allow-list of provider variants. When set, a boolean true only
enables the handler if the provider also resolved one of these variants.
This is useful when one boolean flag carries named cohorts such as
control, treatment-a, and treatment-b.
Example
Section titled “Example”@pipeline.wrap({ kind: 'command' }, [FeatureFlagBehavior, { flag: 'checkout-experiment', allowedVariants: ['treatment-a'],}])context?
Section titled “context?”
optionalcontext?:EvaluationContextFactory
Defined in: packages/pipeline-feature-flags/src/interfaces/feature-flags-options.interface.ts:104
Builds extra OpenFeature targeting context for this handler, merged on top of the base context (derived from the request) and the constructor’s context.
Example
Section titled “Example”@pipeline.wrap({ kind: 'command' }, [FeatureFlagBehavior, { flag: 'new-checkout', context: (ctx) => ({ plan: ctx.items.get('plan') as string, country: ctx.items.get('country') as string, }),}])defaultValue?
Section titled “defaultValue?”
optionaldefaultValue?:boolean
Defined in: packages/pipeline-feature-flags/src/interfaces/feature-flags-options.interface.ts:80
Value used when the flag cannot be resolved (provider error, unknown key,
not yet ready). Defaults to false (fail-closed).
errorPolicy?
Section titled “errorPolicy?”
optionalerrorPolicy?:FeatureFlagErrorPolicy
Defined in: packages/pipeline-feature-flags/src/interfaces/feature-flags-options.interface.ts:152
Provider evaluation-error handling.
use-default— follow OpenFeature’s default-value semantics and continue evaluating the final gate usingdefaultValue(default).throw— surface FeatureFlagEvaluationError instead of silently treating a provider failure like an ordinary disabled flag.
Default
Section titled “Default”'use-default'fallback?
Section titled “fallback?”
optionalfallback?:FeatureFallbackFactory
Defined in: packages/pipeline-feature-flags/src/interfaces/feature-flags-options.interface.ts:87
When the flag resolves to disabled, return this value instead of throwing FeatureDisabledError. Use it to degrade gracefully, for example by returning an empty read model or another explicitly supported fallback.
optionalflag?:string
Defined in: packages/pipeline-feature-flags/src/interfaces/feature-flags-options.interface.ts:74
Boolean flag key that gates the handler. When omitted the behavior is a no-op (the handler always runs) — useful for setting only constructor defaults.
targetingKeyFactory?
Section titled “targetingKeyFactory?”
optionaltargetingKeyFactory?:TargetingKeyFactory
Defined in: packages/pipeline-feature-flags/src/interfaces/feature-flags-options.interface.ts:123
Stable identity used for percentage rollouts / sticky targeting.
Handler-level targetingKeyFactory overrides the constructor’s resolver.
Correlation IDs are intentionally not used automatically because they
normally change on every request and can move the same user between rollout
cohorts.
Example
Section titled “Example”User-sticky rollout
@pipeline.wrap({ kind: 'command' }, [FeatureFlagBehavior, { flag: 'new-checkout', targetingKeyFactory: (ctx) => ctx.items.get('userId') as string | undefined,}])