@@ -4,7 +4,9 @@ import type { IAutoPollOptions, ILazyLoadingOptions, IManualPollOptions, Options
44import { PollingMode } from "./ConfigCatClientOptions" ;
55import type { IConfigCatLogger } from "./ConfigCatLogger" ;
66import { ConfigCatConsoleLogger , LogLevel } from "./ConfigCatLogger" ;
7+ import { FlagOverrides , MapOverrideDataSource , OverrideBehaviour } from "./FlagOverrides" ;
78import { setupPolyfills } from "./Polyfills" ;
9+ import type { SettingValue } from "./ProjectConfig" ;
810
911setupPolyfills ( ) ;
1012
@@ -37,6 +39,19 @@ export function createConsoleLogger(logLevel: LogLevel): IConfigCatLogger {
3739 return new ConfigCatConsoleLogger ( logLevel ) ;
3840}
3941
42+ /**
43+ * Creates an instance of `FlagOverrides` that uses a map data source.
44+ * @param map The map that contains the overrides.
45+ * @param behaviour The override behaviour.
46+ * Specifies whether the local values should override the remote values
47+ * or local values should only be used when a remote value doesn't exist
48+ * or the local values should be used only.
49+ * @param watchChanges If set to `true`, the input map will be tracked for changes.
50+ */
51+ export function createFlagOverridesFromMap ( map : { [ name : string ] : NonNullable < SettingValue > } , behaviour : OverrideBehaviour , watchChanges ?: boolean ) : FlagOverrides {
52+ return new FlagOverrides ( new MapOverrideDataSource ( map , watchChanges ) , behaviour ) ;
53+ }
54+
4055/* Public types for platform-specific SDKs */
4156
4257// List types here which are required to implement the platform-specific SDKs but shouldn't be exposed to end users.
@@ -51,14 +66,10 @@ export type { OptionsBase } from "./ConfigCatClientOptions";
5166
5267export type { IConfigCache } from "./ConfigCatCache" ;
5368
54- export { ExternalConfigCache } from "./ConfigCatCache" ;
69+ export { InMemoryConfigCache , ExternalConfigCache } from "./ConfigCatCache" ;
5570
5671export type { IEventProvider , IEventEmitter } from "./EventEmitter" ;
5772
58- export type { IOverrideDataSource } from "./FlagOverrides" ;
59-
60- export { FlagOverrides , MapOverrideDataSource } from "./FlagOverrides" ;
61-
6273/* Public types for end users */
6374
6475// List types here which are part of the public API of platform-specific SDKs, thus, should be exposed to end users.
@@ -101,7 +112,9 @@ export type { UserAttributeValue } from "./User";
101112
102113export { User } from "./User" ;
103114
104- export { OverrideBehaviour } from "./FlagOverrides" ;
115+ export type { FlagOverrides } ;
116+
117+ export { OverrideBehaviour } ;
105118
106119export { ClientCacheState , RefreshResult } from "./ConfigServiceBase" ;
107120
0 commit comments