Classes · @purista/core

DefaultConfigStore

Process-local in-memory config store for development and tests.

Signature

DefaultConfigStore.ts typescript
class DefaultConfigStore

Examples

example-1.ts typescript
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

Source
constructor.ts typescript
new constructor(config?: { cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... })

Properties

4 entries

cache

Property

Source
cache.ts typescript
cache: ConfigStoreCacheMap

Optional local cache used by store implementations that opt in.

config

Property

Source
config.ts typescript
config: { cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... }

Store configuration including operation toggles and cache settings.

logger

Property

Source
logger.ts typescript
logger: Logger

Child logger scoped to the store name.

name

Property

Source
name.ts typescript
name: string

Store name used in logs and diagnostics.

Methods

7 entries

destroy

Method

Source
destroy.ts typescript
destroy(): Promise<void>

Shutdown hook for store adapters.

getConfig

Method

Source
getConfig.ts typescript
getConfig<ConfigNames>(...configNames: ConfigNames): Promise<ObjectWithKeysFromStringArray<ConfigNames>>

Returns the values for given config properties.

getConfigImpl

Method

Source
getConfigImpl.ts typescript
getConfigImpl<ConfigNames>(...configNames: ConfigNames): Promise<ObjectWithKeysFromStringArray<ConfigNames>>

This method must be overwritten by actual store implementation.

removeConfig

Method

Source
removeConfig.ts typescript
removeConfig(configName: string): Promise<void>

Removes the config item given by config name.

removeConfigImpl

Method

Source
removeConfigImpl.ts typescript
removeConfigImpl(configName: string): Promise<void>

This method must be overwritten by actual store implementation.

setConfig

Method

Source
setConfig.ts typescript
setConfig(configName: string, configValue: unknown): Promise<void>

Sets a config value.

setConfigImpl

Method

Source
setConfigImpl.ts typescript
setConfigImpl(configName: string, configValue: unknown): Promise<void>

This method must be overwritten by actual store implementation.