@@ -33,6 +33,7 @@ import {
3333 CONDITIONS_KEY_NAME ,
3434 CLIENT_FILTERS_KEY_NAME
3535} from "./featureManagement/constants.js" ;
36+ import { FM_PACKAGE_NAME } from "./requestTracing/constants.js" ;
3637import { AzureKeyVaultKeyValueAdapter } from "./keyvault/AzureKeyVaultKeyValueAdapter.js" ;
3738import { RefreshTimer } from "./refresh/RefreshTimer.js" ;
3839import { RequestTracingOptions , getConfigurationSettingWithTrace , listConfigurationSettingsWithTrace , requestTracingEnabled } from "./requestTracing/utils.js" ;
@@ -66,6 +67,9 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
6667 #isFailoverRequest: boolean = false ;
6768 #featureFlagTracing: FeatureFlagTracingOptions | undefined ;
6869
70+ #isPackageInspected: boolean = false ;
71+ #fmVersion: string | undefined ;
72+
6973 // Refresh
7074 #refreshInProgress: boolean = false ;
7175
@@ -184,7 +188,8 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
184188 initialLoadCompleted : this . #isInitialLoadCompleted,
185189 replicaCount : this . #clientManager. getReplicaCount ( ) ,
186190 isFailoverRequest : this . #isFailoverRequest,
187- featureFlagTracing : this . #featureFlagTracing
191+ featureFlagTracing : this . #featureFlagTracing,
192+ fmVersion : this . #fmVersion
188193 } ;
189194 }
190195
@@ -226,6 +231,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
226231 * Loads the configuration store for the first time.
227232 */
228233 async load ( ) {
234+ await this . #ensurePackageInspected( ) ;
229235 await this . #loadSelectedAndWatchedKeyValues( ) ;
230236 if ( this . #featureFlagEnabled) {
231237 await this . #loadFeatureFlags( ) ;
@@ -281,6 +287,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
281287 * Refreshes the configuration.
282288 */
283289 async refresh ( ) : Promise < void > {
290+ await this . #ensurePackageInspected( ) ;
284291 if ( ! this . #refreshEnabled && ! this . #featureFlagRefreshEnabled) {
285292 throw new Error ( "Refresh is not enabled for key-values or feature flags." ) ;
286293 }
@@ -316,6 +323,19 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
316323 return new Disposable ( remove ) ;
317324 }
318325
326+ async #ensurePackageInspected( ) {
327+ if ( ! this . #isPackageInspected) {
328+ this . #isPackageInspected = true ;
329+ try {
330+ // get feature management package version
331+ const fmPackage = await import ( FM_PACKAGE_NAME ) ;
332+ this . #fmVersion = fmPackage ?. VERSION ;
333+ } catch ( error ) {
334+ // ignore the error
335+ }
336+ }
337+ }
338+
319339 async #refreshTasks( ) : Promise < void > {
320340 const refreshTasks : Promise < boolean > [ ] = [ ] ;
321341 if ( this . #refreshEnabled) {
0 commit comments