mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
Fix
This commit is contained in:
parent
8ee9fa5574
commit
91d93cb247
@ -8,8 +8,10 @@ import {
|
||||
FeatureCompletedEvent,
|
||||
FeatureUncompletedEvent,
|
||||
type IAuditUser,
|
||||
type IEnvironment,
|
||||
type IEnvironmentStore,
|
||||
type IEventStore,
|
||||
type IFeatureEnvironment,
|
||||
type IFeatureEnvironmentStore,
|
||||
type IFlagResolver,
|
||||
type IUnleashConfig,
|
||||
@ -209,7 +211,7 @@ export class FeatureLifecycleService {
|
||||
return {environments, allFeatures};
|
||||
}
|
||||
|
||||
private async buildEnvironmentMap() {
|
||||
private async buildEnvironmentMap(): Promise<Map<string, IEnvironment>> {
|
||||
const allEnvs = await this.environmentStore.getAll();
|
||||
return new Map(allEnvs.map((env) => [env.name, env]));
|
||||
}
|
||||
@ -217,7 +219,10 @@ export class FeatureLifecycleService {
|
||||
private async buildFeatureEnvironmentMap(allFeatures: string[]) {
|
||||
const allFeatureEnvs =
|
||||
await this.featureEnvironmentStore.getAllByFeatures(allFeatures);
|
||||
const featureEnvMap = new Map<string, Map<string, any>>();
|
||||
const featureEnvMap = new Map<
|
||||
string,
|
||||
Map<string, IFeatureEnvironment>
|
||||
>();
|
||||
|
||||
allFeatureEnvs.forEach((fe) => {
|
||||
if (!featureEnvMap.has(fe.environment)) {
|
||||
@ -232,8 +237,8 @@ export class FeatureLifecycleService {
|
||||
private determineLifecycleStages(
|
||||
events: IClientMetricsEnv[],
|
||||
environments: string[],
|
||||
envMap: Map<string, any>,
|
||||
featureEnvMap: Map<string, Map<string, any>>,
|
||||
envMap: Map<string, IEnvironment>,
|
||||
featureEnvMap: Map<string, Map<string, IFeatureEnvironment>>,
|
||||
): Array<{ feature: string; stage: 'pre-live' | 'live' }> {
|
||||
const allStagesToInsert: Array<{
|
||||
feature: string;
|
||||
@ -292,7 +297,7 @@ export class FeatureLifecycleService {
|
||||
private getEnabledFeaturesForEnvironment(
|
||||
features: string[],
|
||||
environment: string,
|
||||
featureEnvMap: Map<string, Map<string, any>>,
|
||||
featureEnvMap: Map<string, Map<string, IFeatureEnvironment>>,
|
||||
): string[] {
|
||||
const envFeatureEnvs = featureEnvMap.get(environment) || new Map();
|
||||
return features.filter((feature) => {
|
||||
|
Loading…
Reference in New Issue
Block a user