@@ -128,15 +128,15 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
128128 */
129129 #kvPageWatchers: PagedSettingsWatcher [ ] = [ ] ;
130130 /**
131- * Page watchers for classic feature flags, derived from
131+ * Page watchers for feature flags, derived from
132132 * @see AzureAppConfigurationOptions.featureFlagOptions.selectors with each key filter prefixed by `.appconfig.featureflag/`.
133133 */
134- #classicFfPageWatchers : PagedSettingsWatcher [ ] = [ ] ;
134+ #ffPageWatchers : PagedSettingsWatcher [ ] = [ ] ;
135135 /**
136- * Page watchers for feature flags loaded from feature flag endpoint, derived from
136+ * Page watchers for enhanced feature flags loaded from the dedicated feature flag endpoint, derived from
137137 * @see AzureAppConfigurationOptions.featureFlagOptions.selectors.
138138 */
139- #ffPageWatchers : PagedSettingsWatcher [ ] = [ ] ;
139+ #enhancedFfPageWatchers : PagedSettingsWatcher [ ] = [ ] ;
140140
141141 // Load balancing
142142 #lastSuccessfulEndpoint: string = "" ;
@@ -198,8 +198,8 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
198198 if ( options ?. featureFlagOptions ?. enabled === true ) {
199199 this . #featureFlagEnabled = true ;
200200 // validate feature flag selectors, only load feature flags when enabled
201- this . #classicFfPageWatchers = getClassicFeatureFlagPageWatchers ( options . featureFlagOptions . selectors ) ;
202- this . #ffPageWatchers = getPageWatchers ( options . featureFlagOptions . selectors ) ;
201+ this . #ffPageWatchers = getFeatureFlagPageWatchers ( options . featureFlagOptions . selectors ) ;
202+ this . #enhancedFfPageWatchers = getPageWatchers ( options . featureFlagOptions . selectors ) ;
203203
204204 if ( options . featureFlagOptions . refresh ?. enabled === true ) {
205205 this . #featureFlagRefreshEnabled = true ;
@@ -419,9 +419,9 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
419419 await this . #loadSelectedKeyValues( ) ;
420420
421421 if ( this . #featureFlagEnabled) {
422- const classicFeatureFlags : ConfigurationSetting [ ] = await this . #loadClassicFeatureFlags ( ) ;
423- const featureFlags : FeatureFlag [ ] = await this . #loadFeatureFlags ( ) ;
424- await this . #setFeatureFlags( classicFeatureFlags , featureFlags ) ;
422+ const featureFlags : ConfigurationSetting [ ] = await this . #loadFeatureFlags ( ) ;
423+ const enhancedFeatureFlags : FeatureFlag [ ] = await this . #loadEnhancedFeatureFlags ( ) ;
424+ await this . #setFeatureFlags( featureFlags , enhancedFeatureFlags ) ;
425425 }
426426 this . #isInitialLoadCompleted = true ;
427427 break ;
@@ -614,10 +614,10 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
614614 }
615615 }
616616
617- async #loadClassicFeatureFlags ( ) : Promise < ConfigurationSetting [ ] > {
618- const classicFeatureFlags : Map < string , ConfigurationSetting > = new Map < string , ConfigurationSetting > ( ) ;
617+ async #loadFeatureFlags ( ) : Promise < ConfigurationSetting [ ] > {
618+ const featureFlags : Map < string , ConfigurationSetting > = new Map < string , ConfigurationSetting > ( ) ;
619619 // Deep copy selectors to avoid modification if current client fails.
620- const watchersToUpdate : PagedSettingsWatcher [ ] = structuredClone ( this . #classicFfPageWatchers ) ;
620+ const watchersToUpdate : PagedSettingsWatcher [ ] = structuredClone ( this . #ffPageWatchers ) ;
621621
622622 for ( const selector of watchersToUpdate ) {
623623 let settings : ConfigurationSetting [ ] = [ ] ;
@@ -637,19 +637,19 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
637637
638638 for ( const setting of settings ) {
639639 if ( isFeatureFlag ( setting ) ) {
640- classicFeatureFlags . set ( setting . key , setting ) ;
640+ featureFlags . set ( setting . key , setting ) ;
641641 }
642642 }
643643 }
644644
645- this . #classicFfPageWatchers = watchersToUpdate ;
646- return Array . from ( classicFeatureFlags . values ( ) ) ;
645+ this . #ffPageWatchers = watchersToUpdate ;
646+ return Array . from ( featureFlags . values ( ) ) ;
647647 }
648648
649- async #loadFeatureFlags ( ) : Promise < FeatureFlag [ ] > {
649+ async #loadEnhancedFeatureFlags ( ) : Promise < FeatureFlag [ ] > {
650650 const loadedFeatureFlags : Map < string , FeatureFlag > = new Map < string , FeatureFlag > ( ) ;
651651 // Deep copy selectors to avoid modification if current client fails.
652- const watchersToUpdate : PagedSettingsWatcher [ ] = structuredClone ( this . #ffPageWatchers ) ;
652+ const watchersToUpdate : PagedSettingsWatcher [ ] = structuredClone ( this . #enhancedFfPageWatchers ) ;
653653
654654 for ( const selector of watchersToUpdate ) {
655655 if ( selector . snapshotName ) {
@@ -660,39 +660,39 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
660660 labelFilter : selector . labelFilter ,
661661 tagsFilter : selector . tagFilters
662662 } ;
663- const { items, pageWatchers } = await this . #listFeatureFlags ( listOptions ) ;
663+ const { items, pageWatchers } = await this . #listEnhancedFeatureFlags ( listOptions ) ;
664664 selector . pageWatchers = pageWatchers ;
665665 for ( const featureFlag of items ) {
666666 loadedFeatureFlags . set ( featureFlag . name , featureFlag ) ;
667667 }
668668 }
669669
670- this . #ffPageWatchers = watchersToUpdate ;
670+ this . #enhancedFfPageWatchers = watchersToUpdate ;
671671 return Array . from ( loadedFeatureFlags . values ( ) ) ;
672672 }
673673
674- async #setFeatureFlags( classicFeatureFlags : ConfigurationSetting [ ] , featureFlags : FeatureFlag [ ] ) : Promise < void > {
674+ async #setFeatureFlags( featureFlags : ConfigurationSetting [ ] , enhancedFeatureFlags : FeatureFlag [ ] ) : Promise < void > {
675675 if ( this . #requestTracingEnabled && this . #featureFlagTracing !== undefined ) {
676676 // Reset old feature flag tracing in order to track the information present in the current response from server.
677677 this . #featureFlagTracing. reset ( ) ;
678678 }
679679
680680 // Track whether enhanced feature flags were loaded.
681- this . #useEnhancedFeatureFlag = featureFlags . length > 0 ;
682-
683- // Exclude any classic feature flags that are superseded by a standalone feature flag with the same name.
684- const ineligibleClassicFfKeys = new Set ( featureFlags . map ( ff => featureFlagPrefix + ff . name ) ) ;
685- const eligibleClassicFeatureFlags = await Promise . all (
686- classicFeatureFlags
687- . filter ( setting => ! ineligibleClassicFfKeys . has ( setting . key ) )
688- . map ( setting => this . #parseClassicFeatureFlag ( setting ) )
681+ this . #useEnhancedFeatureFlag = enhancedFeatureFlags . length > 0 ;
682+
683+ // Exclude any feature flags that are superseded by an enhanced feature flag with the same name.
684+ const ineligibleFeatureFlagKeys = new Set ( enhancedFeatureFlags . map ( ff => featureFlagPrefix + ff . name ) ) ;
685+ const eligibleFeatureFlags = await Promise . all (
686+ featureFlags
687+ . filter ( setting => ! ineligibleFeatureFlagKeys . has ( setting . key ) )
688+ . map ( setting => this . #parseFeatureFlag ( setting ) )
689689 ) ;
690- const parsedFeatureFlags = await Promise . all (
691- featureFlags . map ( ff => this . #parseFeatureFlag ( ff ) )
690+ const parsedEnhancedFeatureFlags = await Promise . all (
691+ enhancedFeatureFlags . map ( ff => this . #parseEnhancedFeatureFlag ( ff ) )
692692 ) ;
693693
694694 // feature_management is a reserved key, and feature_flags is an array of feature flags
695- this . #configMap. set ( FEATURE_MANAGEMENT_KEY_NAME , { [ FEATURE_FLAGS_KEY_NAME ] : [ ...eligibleClassicFeatureFlags , ...parsedFeatureFlags ] } ) ;
695+ this . #configMap. set ( FEATURE_MANAGEMENT_KEY_NAME , { [ FEATURE_FLAGS_KEY_NAME ] : [ ...eligibleFeatureFlags , ...parsedEnhancedFeatureFlags ] } ) ;
696696 }
697697
698698 /**
@@ -755,13 +755,13 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
755755 return Promise . resolve ( false ) ;
756756 }
757757
758- const needRefresh = await this . #checkConfigurationSettingsChange( this . #classicFfPageWatchers ) ||
759- await this . #checkFeatureFlagsChange ( this . #ffPageWatchers ) ;
758+ const needRefresh = await this . #checkConfigurationSettingsChange( this . #ffPageWatchers ) ||
759+ await this . #checkEnhancedFeatureFlagsChange ( this . #enhancedFfPageWatchers ) ;
760760
761761 if ( needRefresh ) {
762- const classicFeatureFlags : ConfigurationSetting [ ] = await this . #loadClassicFeatureFlags ( ) ;
763- const featureFlags : FeatureFlag [ ] = await this . #loadFeatureFlags ( ) ;
764- await this . #setFeatureFlags( classicFeatureFlags , featureFlags ) ;
762+ const featureFlags : ConfigurationSetting [ ] = await this . #loadFeatureFlags ( ) ;
763+ const enhancedFeatureFlags : FeatureFlag [ ] = await this . #loadEnhancedFeatureFlags ( ) ;
764+ await this . #setFeatureFlags( featureFlags , enhancedFeatureFlags ) ;
765765 }
766766
767767 this . #ffRefreshTimer! . reset ( ) ;
@@ -850,11 +850,11 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
850850 }
851851
852852 /**
853- * Checks whether the feature flag collection from the dedicated feature flag endpoint has changed.
854- * @param selectors - The @see PagedSettingsWatcher of the feature flag collection.
855- * @returns true if the feature flag collection has changed, false otherwise.
853+ * Checks whether the enhanced feature flag collection from the dedicated feature flag endpoint has changed.
854+ * @param selectors - The @see PagedSettingsWatcher of the enhanced feature flag collection.
855+ * @returns true if the enhanced feature flag collection has changed, false otherwise.
856856 */
857- async #checkFeatureFlagsChange ( selectors : PagedSettingsWatcher [ ] ) : Promise < boolean > {
857+ async #checkEnhancedFeatureFlagsChange ( selectors : PagedSettingsWatcher [ ] ) : Promise < boolean > {
858858 const funcToExecute = async ( client : IAppConfigurationClient ) => {
859859 for ( const selector of selectors ) {
860860 if ( selector . snapshotName ) {
@@ -948,7 +948,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
948948 return await this . #executeWithFailoverPolicy( funcToExecute ) ;
949949 }
950950
951- async #listFeatureFlags ( listOptions : ListFeatureFlagsOptions ) : Promise < { items : FeatureFlag [ ] ; pageWatchers : SettingWatcher [ ] } > {
951+ async #listEnhancedFeatureFlags ( listOptions : ListFeatureFlagsOptions ) : Promise < { items : FeatureFlag [ ] ; pageWatchers : SettingWatcher [ ] } > {
952952 const funcToExecute = async ( client : IAppConfigurationClient ) => {
953953 const pageWatchers : SettingWatcher [ ] = [ ] ;
954954 const pageIterator = client . listFeatureFlags (
@@ -1099,7 +1099,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
10991099 return key ;
11001100 }
11011101
1102- async #parseClassicFeatureFlag ( setting : ConfigurationSetting < string > ) : Promise < any > {
1102+ async #parseFeatureFlag ( setting : ConfigurationSetting < string > ) : Promise < any > {
11031103 const rawFlag = setting . value ;
11041104 if ( rawFlag === undefined ) {
11051105 throw new ArgumentError ( ErrorMessages . CONFIGURATION_SETTING_VALUE_UNDEFINED ) ;
@@ -1117,7 +1117,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
11171117 return featureFlag ;
11181118 }
11191119
1120- async #parseFeatureFlag ( featureFlag : FeatureFlag ) : Promise < any > {
1120+ async #parseEnhancedFeatureFlag ( featureFlag : FeatureFlag ) : Promise < any > {
11211121 const parsedFeatureFlag = convertToMicrosoftSchema ( featureFlag ) ;
11221122
11231123 let featureFlagReference = `${ this . #clientManager. endpoint . origin } /ff/${ featureFlagPrefix } ${ featureFlag . name } ` ;
@@ -1365,7 +1365,7 @@ function getPageWatchers(selectors?: SettingSelector[]): PagedSettingsWatcher[]
13651365 return getValidSettingSelectors ( selectors ) ;
13661366}
13671367
1368- function getClassicFeatureFlagPageWatchers ( selectors ?: SettingSelector [ ] ) : PagedSettingsWatcher [ ] {
1368+ function getFeatureFlagPageWatchers ( selectors ?: SettingSelector [ ] ) : PagedSettingsWatcher [ ] {
13691369 if ( selectors === undefined || selectors . length === 0 ) {
13701370 // Default selector: key/name: *, label: \0
13711371 return [ { keyFilter : `${ featureFlagPrefix } ${ KeyFilter . Any } ` , labelFilter : LabelFilter . Null } ] ;
0 commit comments