@@ -14,7 +14,7 @@ import { ClientFilter } from "../../models";
1414import * as flat from "flat" ;
1515import { ConfigurationFormat } from "../../enums" ;
1616import { isJsonContentType } from "../utils" ;
17- import { FeatureFlagValue , RequirementType } from "../../featureFlag" ;
17+ import { MsFeatureFlagValue , RequirementType } from "../../featureFlag" ;
1818import { Constants } from "../constants" ;
1919import { featureFlagValueSchema } from "../../featureFlagSchema" ;
2020import Ajv , { ErrorObject } from "ajv" ;
@@ -34,12 +34,12 @@ export class DefaultConfigurationSettingsConverter implements ConfigurationSetti
3434 public Convert (
3535 config : object ,
3636 options : SourceOptions
37- ) : SetConfigurationSettingParam < string | FeatureFlagValue | SecretReferenceValue > [ ] {
37+ ) : SetConfigurationSettingParam < string | MsFeatureFlagValue | SecretReferenceValue > [ ] {
3838 let configurationSettings = new Array <
39- SetConfigurationSettingParam < string | FeatureFlagValue >
39+ SetConfigurationSettingParam < string | MsFeatureFlagValue >
4040 > ( ) ;
4141
42- let featureFlagsConfigSettings = new Array < SetConfigurationSettingParam < FeatureFlagValue > > ( ) ;
42+ let featureFlagsConfigSettings = new Array < SetConfigurationSettingParam < MsFeatureFlagValue > > ( ) ;
4343 let foundMsFmSchema = false ;
4444 let foundLegacySchema = false ;
4545 let legacySchemaFeatureManagementKeyWord = "" ;
@@ -187,18 +187,18 @@ class FeatureFlagConfigurationSettingsConverter implements ConfigurationSettings
187187 Convert (
188188 config : object ,
189189 options : SourceOptions
190- ) : SetConfigurationSettingParam < FeatureFlagValue > [ ] {
191- const settings = new Array < SetConfigurationSettingParam < FeatureFlagValue > > ( ) ;
192- const featureFlags = new Array < FeatureFlagValue > ( ) ;
190+ ) : SetConfigurationSettingParam < MsFeatureFlagValue > [ ] {
191+ const settings = new Array < SetConfigurationSettingParam < MsFeatureFlagValue > > ( ) ;
192+ const featureFlags = new Array < MsFeatureFlagValue > ( ) ;
193193
194194 if ( this . foundMsFeatureManagement ) {
195- const msFmSectionFeatureFlags = this . getMsFmSchemaSection ( config ) ;
195+ const msFmSectionFeatureFlags = this . getMsFmSchemaFeatureFlags ( config ) ;
196196
197197 if ( msFmSectionFeatureFlags ) {
198198 for ( const featureFlag of msFmSectionFeatureFlags ) {
199199 if ( ! featureFlag . id ) {
200200 throw new ArgumentError (
201- ` Feature flag ${ featureFlag } is in an invalid format: id is a required property`
201+ " Feature flag without id is found, id is a required property."
202202 ) ;
203203 }
204204
@@ -208,7 +208,7 @@ class FeatureFlagConfigurationSettingsConverter implements ConfigurationSettings
208208
209209 if ( ! this . validateFeatureName ( featureFlag . id ) ) {
210210 throw new ArgumentError (
211- `Feature flag ${ featureFlag } contains invalid character,'%' and ':' are not allowed in feature name. Please provide valid feature id .`
211+ `Feature flag id ${ featureFlag . id } contains invalid character,'%' and ':' are not allowed in feature name.`
212212 ) ;
213213 }
214214 featureFlags . push ( this . getFeatureFlagDefinitionFromMsFmSchema ( featureFlag ) ) ;
@@ -217,7 +217,7 @@ class FeatureFlagConfigurationSettingsConverter implements ConfigurationSettings
217217 }
218218
219219 if ( this . legacySchemaFeatureManagementKeyWord ) {
220- const legacySchemaFeatureFlags = this . getLegacySchema ( config ) ;
220+ const legacySchemaFeatureFlags = this . getLegacySchemaFeatureFlags ( config ) ;
221221
222222 if ( legacySchemaFeatureFlags ) {
223223 for ( const featureFlag in legacySchemaFeatureFlags ) {
@@ -249,7 +249,7 @@ class FeatureFlagConfigurationSettingsConverter implements ConfigurationSettings
249249
250250 const prefix : string = options . prefix ?? "" ;
251251 for ( const featureFlag of featureFlags ) {
252- const setting : SetConfigurationSettingParam < FeatureFlagValue > = {
252+ const setting : SetConfigurationSettingParam < MsFeatureFlagValue > = {
253253 key : featureFlagPrefix + prefix + featureFlag . id ,
254254 label : options . label ,
255255 value : featureFlag ,
@@ -278,10 +278,10 @@ class FeatureFlagConfigurationSettingsConverter implements ConfigurationSettings
278278 featureData : any ,
279279 enabledForKeyWord : string ,
280280 requirementTypeKeyWord : string
281- ) : FeatureFlagValue {
281+ ) : MsFeatureFlagValue {
282282 const defaultFeatureConditions = { clientFilters : [ ] } ;
283283
284- const featureFlagValue : FeatureFlagValue = {
284+ const featureFlagValue : MsFeatureFlagValue = {
285285 id : featureFlagName ,
286286 description : "" ,
287287 enabled : false ,
@@ -356,8 +356,8 @@ class FeatureFlagConfigurationSettingsConverter implements ConfigurationSettings
356356 return featureFlagValue ;
357357 }
358358
359- private getFeatureFlagDefinitionFromMsFmSchema ( featureFlag : any ) : FeatureFlagValue {
360- const validate = this . ajv . compile < FeatureFlagValue > ( featureFlagValueSchema ) ;
359+ private getFeatureFlagDefinitionFromMsFmSchema ( featureFlag : any ) : MsFeatureFlagValue {
360+ const validate = this . ajv . compile < MsFeatureFlagValue > ( featureFlagValueSchema ) ;
361361 const featureFlagCopy = JSON . parse ( JSON . stringify ( featureFlag ) ) ; //deep copy
362362
363363 // normalize client filters
@@ -373,7 +373,7 @@ class FeatureFlagConfigurationSettingsConverter implements ConfigurationSettings
373373 throw new ArgumentError ( `Feature flag '${ featureFlag . id } ' is not in the correct format. ${ validationError . getFriendlyMessage ( ) } ` ) ;
374374 }
375375
376- const parsedFeatureFlag : FeatureFlagValue = {
376+ const parsedFeatureFlag : MsFeatureFlagValue = {
377377 ...featureFlag ,
378378 displayName : featureFlag . display_name ,
379379 conditions : {
@@ -405,7 +405,7 @@ class FeatureFlagConfigurationSettingsConverter implements ConfigurationSettings
405405 return true ;
406406 }
407407
408- private getMsFmSchemaSection ( config : object ) : any {
408+ private getMsFmSchemaFeatureFlags ( config : object ) : any {
409409 const msFeatureManagementKeyWord = Constants . FeatureManagementKeyWords [ 3 ] ;
410410 const featureManagementKey = msFeatureManagementKeyWord as keyof object ;
411411 const featureManagementSection = config [ featureManagementKey ] ;
@@ -421,7 +421,7 @@ class FeatureFlagConfigurationSettingsConverter implements ConfigurationSettings
421421 return featureManagementSection [ Constants . FeatureFlagsKeyWord ] ;
422422 }
423423
424- private getLegacySchema ( config : object ) : any {
424+ private getLegacySchemaFeatureFlags ( config : object ) : any {
425425 const msFeatureManagementKeyWord = Constants . FeatureManagementKeyWords [ 3 ] ;
426426 const featureManagementSection = config [ this . legacySchemaFeatureManagementKeyWord as keyof object ] ;
427427
0 commit comments