createStoreContext()
Creates a StoreContext with an optional configuration.
type createStoreContext = (context: StoreContext, validatedMap: StaticValidatedMap) => Store;
Return value
Returns a StoreContext, required to create both for staticStoreBuilder() and createStaticStore()
Params
༶ context
: StoreContext
A context object that exposes the StoreOptions and collects eventual errors produced building the store.
It is recommended to declare the options object directly in a dd.config.mjs
file in the root of the project and then load it via loadConfig().
Params
༶ validatedMap
: StaticValidatedMap
Holds all decision input data and provides an API to retrieve decision records and validation errors.
Usage
Create a context with configuration and provide to the staticStoreBuilder()
.
const config = await loadConfig();const context = createStoreContext(config.store);const builder = staticStoreBuilder(context);