FeatureFlagBase

db · /index·type

Resolved document shape for a feature flag record. Combines BaseDocument (id, timestamps) with the flag fields — a unique key, the optional kind discriminator and description, the required defaultValue, the optional enum-style options, and the targeting rule list. Use this type when reading flag documents from FeatureFlagService.

Definition

@nordcom/commerce-db
type FeatureFlagBase = BaseDocument & { defaultValue: JsonValue; description: string; key: string; kind: FeatureFlagKind; options: FeatureFlagOption[]; targeting: TargetingRule[] };

BaseDocument & { defaultValue: JsonValue; description: string; key: string; kind: FeatureFlagKind; options: FeatureFlagOption[]; targeting: TargetingRule[] }

Example

import type { FeatureFlagBase } from '@nordcom/commerce-db';
function isEnabled(flag: FeatureFlagBase): boolean {
    return flag.defaultValue === true;
}

FeatureFlagService ReviewService ShopService FeatureFlagOption FeatureFlagRef ResolvedCartLineTokens ResolvedProductCardTokens ResolvedShopTheme

Metadata@nordcom/commerce-db@0.1.0Open in GitHub ↗

On this page