PURISTA API / @purista/core / DefaultConfigStore
Class: DefaultConfigStore
Defined in: packages/core/src/DefaultConfigStore/DefaultConfigStore.impl.ts:28
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
const store = new DefaultConfigStore({
enableGet: true,
enableRemove: true,
enableSet: true,
config: {
initialValue: 'initial',
},
})
console.log(await store.getConfig('initialValue') // outputs: { initialValue: 'initial' }
Extends
Implements
Constructors
new DefaultConfigStore()
new DefaultConfigStore(
config
?):DefaultConfigStore
Defined in: packages/core/src/DefaultConfigStore/DefaultConfigStore.impl.ts:30
Parameters
config?
cacheTtl?
number
Cache time to live in ms
enableCache?
boolean
Enable cache
enableGet?
boolean
Enable generally get method
enableRemove?
boolean
Enable generally remove method
enableSet?
boolean
Enable generally set method
logger?
A logger instance
logLevel?
A log level for new logger if logger is not set
Returns
Overrides
ConfigStoreBaseClass
.constructor
Properties
cache
cache:
ConfigStoreCacheMap
Defined in: packages/core/src/core/ConfigStore/ConfigStoreBaseClass.impl.ts:26
Inherited from
config
config:
object
Defined in: packages/core/src/core/ConfigStore/ConfigStoreBaseClass.impl.ts:22
Index Signature
[key
: string
]: unknown
cacheTtl?
optional
cacheTtl:number
Cache time to live in ms
enableCache?
optional
enableCache:boolean
Enable cache
enableGet?
optional
enableGet:boolean
Enable generally get method
enableRemove?
optional
enableRemove:boolean
Enable generally remove method
enableSet?
optional
enableSet:boolean
Enable generally set method
logger?
optional
logger:Logger
A logger instance
logLevel?
optional
logLevel:LogLevelName
A log level for new logger if logger is not set
Inherited from
logger
logger:
Logger
Defined in: packages/core/src/core/ConfigStore/ConfigStoreBaseClass.impl.ts:21
Inherited from
name
name:
string
Defined in: packages/core/src/core/ConfigStore/ConfigStoreBaseClass.impl.ts:24
name of store
Implementation of
Inherited from
Methods
destroy()
destroy():
Promise
<void
>
Defined in: packages/core/src/core/ConfigStore/ConfigStoreBaseClass.impl.ts:126
disconnects and shuts down the config store
Returns
Promise
<void
>
Implementation of
Inherited from
getConfig()
getConfig<
ConfigNames
>(...configNames
):Promise
<ObjectWithKeysFromStringArray
<ConfigNames
>>
Defined in: packages/core/src/core/ConfigStore/ConfigStoreBaseClass.impl.ts:62
get a config value
Type Parameters
• ConfigNames extends string
[]
Parameters
configNames
...ConfigNames
Returns
Promise
<ObjectWithKeysFromStringArray
<ConfigNames
>>
the config
an object of
Param
name of config
Throws
UnhandledError
Implementation of
ConfigStore.getConfig
Inherited from
ConfigStoreBaseClass
.getConfig
getConfigImpl()
protected
getConfigImpl<ConfigNames
>(...configNames
):Promise
<ObjectWithKeysFromStringArray
<ConfigNames
>>
Defined in: packages/core/src/DefaultConfigStore/DefaultConfigStore.impl.ts:40
This method must be overwritten by actual store implementation.
Type Parameters
• ConfigNames extends string
[]
Parameters
configNames
...ConfigNames
list of config items
Returns
Promise
<ObjectWithKeysFromStringArray
<ConfigNames
>>
an object of
Overrides
ConfigStoreBaseClass
.getConfigImpl
removeConfig()
removeConfig(
configName
):Promise
<void
>
Defined in: packages/core/src/core/ConfigStore/ConfigStoreBaseClass.impl.ts:89
delete a config value
Parameters
configName
string
Returns
Promise
<void
>
Param
name of config
Throws
UnhandledError
Implementation of
ConfigStore.removeConfig
Inherited from
ConfigStoreBaseClass
.removeConfig
removeConfigImpl()
protected
removeConfigImpl(configName
):Promise
<void
>
Defined in: packages/core/src/DefaultConfigStore/DefaultConfigStore.impl.ts:62
This method must be overwritten by actual store implementation.
Parameters
configName
string
Returns
Promise
<void
>
Overrides
ConfigStoreBaseClass
.removeConfigImpl
setConfig()
setConfig(
configName
,configValue
):Promise
<void
>
Defined in: packages/core/src/core/ConfigStore/ConfigStoreBaseClass.impl.ts:116
set a config value
Parameters
configName
string
configValue
unknown
Returns
Promise
<void
>
Param
name of config
Param
value of config
Throws
UnhandledError
Implementation of
ConfigStore.setConfig
Inherited from
ConfigStoreBaseClass
.setConfig
setConfigImpl()
protected
setConfigImpl(configName
,configValue
):Promise
<void
>
Defined in: packages/core/src/DefaultConfigStore/DefaultConfigStore.impl.ts:58
This method must be overwritten by actual store implementation.
Parameters
configName
string
configValue
unknown
Returns
Promise
<void
>