Classes · @purista/core
DefaultConfigStore
Process-local in-memory config store for development and tests.
Signature
class DefaultConfigStoreExamples
const store = new DefaultConfigStore({
enableGet: true,
enableRemove: true,
enableSet: true,
config: {
initialValue: 'initial',
},
})
console.log(await store.getConfig('initialValue') // outputs: { initialValue: 'initial' }Constructors
1 entry
constructor
Constructor
new constructor(config?: { cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... })Properties
4 entries
cache
Property
cache: ConfigStoreCacheMapOptional local cache used by store implementations that opt in.
config
Property
config: { cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... }Store configuration including operation toggles and cache settings.
logger
Property
logger: LoggerChild logger scoped to the store name.
name
Property
name: stringStore name used in logs and diagnostics.
Methods
7 entries
destroy
Method
destroy(): Promise<void>Shutdown hook for store adapters.
getConfig
Method
getConfig<ConfigNames>(...configNames: ConfigNames): Promise<ObjectWithKeysFromStringArray<ConfigNames>>Returns the values for given config properties.
getConfigImpl
Method
getConfigImpl<ConfigNames>(...configNames: ConfigNames): Promise<ObjectWithKeysFromStringArray<ConfigNames>>This method must be overwritten by actual store implementation.
removeConfig
Method
removeConfig(configName: string): Promise<void>Removes the config item given by config name.
removeConfigImpl
Method
removeConfigImpl(configName: string): Promise<void>This method must be overwritten by actual store implementation.
setConfig
Method
setConfig(configName: string, configValue: unknown): Promise<void>Sets a config value.
setConfigImpl
Method
setConfigImpl(configName: string, configValue: unknown): Promise<void>This method must be overwritten by actual store implementation.