UNPKG

@alauda-fe/common

Version:

Alauda frontend team common codes.

37 lines (36 loc) 1.75 kB
/** * @packageDocumentation * @module utils */ import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import * as i0 from "@angular/core"; export declare class FeatureGateService { private readonly http; private readonly cacheStore; constructor(http: HttpClient); loadState(cluster?: string): Observable<"loaded" | "loadFailed" | "loading">; /** * check gate status * @param gate - specified feature gate * @param cluster - check gate for specified cluster */ isEnabled(gateName: string, cluster?: string): Observable<boolean>; isNegateEnabled(gateName: string, cluster?: string): Observable<boolean>; /** * filter list with gate, send items without feature gate as begin push (can skip by passing `skipNoFeatureGatePush` argument with true) * @param items - list need filter * @param gateAccessor - how to get gate from item * @param cluster - check gate for specified cluster * @param filterMethod - filter method, default to list filter, can filter deep with createRecursiveFilter or totally custom method. * @param skipNoFeatureGatePush - skip begin push , default false. */ filterEnabled<T>(items: T[], gateAccessor: (item: T) => string, cluster?: string, filterMethod?: (items: T[], condition: (item: T) => boolean) => T[], skipNoFeatureGatePush?: boolean): Observable<T[]>; /** * refetch cached feature gate settings * @param cluster - specified cluster, refetch all already cached settings when cluster is empty */ refetchCache(cluster?: string): void; static ɵfac: i0.ɵɵFactoryDeclaration<FeatureGateService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<FeatureGateService>; }