nest-feature-guard
Version:
A powerful, NestJS-first feature flag guard and decorator library with Redis caching support. Perfect for implementing feature toggles, A/B testing, gradual rollouts, and user-specific feature access control.
20 lines (19 loc) • 672 B
TypeScript
import Redis from 'ioredis';
import { FeatureGuardStore } from './feature-flag-cache.interface';
interface SetFeatureFlagOptions {
flag: string;
enabled: boolean;
userIds?: string[];
}
export declare class RedisFeatureFlagCache implements FeatureGuardStore {
private readonly redis;
private readonly featureKeyPrefix;
constructor(redis: Redis, featureKeyPrefix?: string);
setFeatureFlag({ flag, enabled, userIds }: SetFeatureFlagOptions): Promise<void>;
getFeature(flag: string): Promise<{
enabled: boolean;
userIds?: string[];
} | null>;
hasFeatureFlag(flag: string, userId: string): Promise<boolean>;
}
export {};