Skip to content

PURISTA API / Modules / @purista/core / DefaultConfigStore

Class: DefaultConfigStore

@purista/core.DefaultConfigStore

The DefaultConfigStore is a placeholder which offers all needed methods. Getters and setters will throw a UnhandledError with status Unauthorized, when a disabled operation is called.

For development and testing purpose, you can initiate the store with values.

Example

typescript
const store = new DefaultConfigStore({
   enableGet: true,
   enableRemove: true,
   enableSet: true,
   config: {
     initialValue: 'initial',
   },
})

console.log(await store.getConfig('initialValue') // outputs: { initialValue: 'initial' }

Hierarchy

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DefaultConfigStore(config?): DefaultConfigStore

Parameters

NameTypeDescription
config?Object-
config.cacheTtl?numberCache time to live in ms
config.enableCache?booleanEnable cache
config.enableGet?booleanEnable generally get method
config.enableRemove?booleanEnable generally remove method
config.enableSet?booleanEnable generally set method
config.logLevel?LogLevelNameA log level for new logger if logger is not set
config.logger?LoggerA logger instance

Returns

DefaultConfigStore

Overrides

ConfigStoreBaseClass.constructor

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:30

Properties

cache

cache: ConfigStoreCacheMap

Inherited from

ConfigStoreBaseClass.cache

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:26


config

config: Object

Type declaration

NameTypeDescription
cacheTtl?numberCache time to live in ms
enableCache?booleanEnable cache
enableGet?booleanEnable generally get method
enableRemove?booleanEnable generally remove method
enableSet?booleanEnable generally set method
logLevel?LogLevelNameA log level for new logger if logger is not set
logger?LoggerA logger instance

Inherited from

ConfigStoreBaseClass.config

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:22


logger

logger: Logger

Inherited from

ConfigStoreBaseClass.logger

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:21


map

Private map: Map<string, unknown>

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:29


name

name: string

name of store

Implementation of

ConfigStore.name

Inherited from

ConfigStoreBaseClass.name

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:24

Methods

destroy

destroy(): Promise<void>

disconnects and shuts down the config store

Returns

Promise<void>

Implementation of

ConfigStore.destroy

Inherited from

ConfigStoreBaseClass.destroy

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:126


getConfig

getConfig<ConfigNames>(...configNames): Promise<ObjectWithKeysFromStringArray<ConfigNames>>

Returns the values for given config properties. This function SHOULD NOT be overwritten by store implementation. For implementation overwrite protected getConfigImpl

Type parameters

NameType
ConfigNamesextends string[]

Parameters

NameType
...configNamesConfigNames

Returns

Promise<ObjectWithKeysFromStringArray<ConfigNames>>

an object of

Implementation of

ConfigStore.getConfig

Inherited from

ConfigStoreBaseClass.getConfig

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:62


getConfigImpl

getConfigImpl<ConfigNames>(...configNames): Promise<ObjectWithKeysFromStringArray<ConfigNames>>

This method must be overwritten by actual store implementation.

Type parameters

NameType
ConfigNamesextends string[]

Parameters

NameTypeDescription
...configNamesConfigNameslist of config items

Returns

Promise<ObjectWithKeysFromStringArray<ConfigNames>>

an object of

Overrides

ConfigStoreBaseClass.getConfigImpl

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:40


removeConfig

removeConfig(configName): Promise<void>

Removes the config item given by config name. This function SHOULD NOT be overwritten by store implementation. For implementation overwrite protected removeConfigImpl

Parameters

NameType
configNamestring

Returns

Promise<void>

Implementation of

ConfigStore.removeConfig

Inherited from

ConfigStoreBaseClass.removeConfig

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:89


removeConfigImpl

removeConfigImpl(configName): Promise<void>

This method must be overwritten by actual store implementation.

Parameters

NameType
configNamestring

Returns

Promise<void>

Overrides

ConfigStoreBaseClass.removeConfigImpl

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:61


setConfig

setConfig(configName, configValue): Promise<void>

Sets a config value This function SHOULD NOT be overwritten by store implementation. For implementation overwrite protected setConfigImpl

Parameters

NameType
configNamestring
configValueunknown

Returns

Promise<void>

Implementation of

ConfigStore.setConfig

Inherited from

ConfigStoreBaseClass.setConfig

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:116


setConfigImpl

setConfigImpl(configName, configValue): Promise<void>

This method must be overwritten by actual store implementation.

Parameters

NameType
configNamestring
configValueunknown

Returns

Promise<void>

Overrides

ConfigStoreBaseClass.setConfigImpl

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:57