Μετάβαση στο περιεχόμενο

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.

optional allowedVariants?: readonly string[]

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.

@pipeline.wrap({ kind: 'command' }, [FeatureFlagBehavior, {
flag: 'checkout-experiment',
allowedVariants: ['treatment-a'],
}])

optional context?: 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.

@pipeline.wrap({ kind: 'command' }, [FeatureFlagBehavior, {
flag: 'new-checkout',
context: (ctx) => ({
plan: ctx.items.get('plan') as string,
country: ctx.items.get('country') as string,
}),
}])

optional defaultValue?: 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).


optional errorPolicy?: 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 using defaultValue (default).
  • throw — surface FeatureFlagEvaluationError instead of silently treating a provider failure like an ordinary disabled flag.
'use-default'

optional fallback?: 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.


optional flag?: 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.


optional targetingKeyFactory?: 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.

User-sticky rollout

@pipeline.wrap({ kind: 'command' }, [FeatureFlagBehavior, {
flag: 'new-checkout',
targetingKeyFactory: (ctx) =>
ctx.items.get('userId') as string | undefined,
}])