Skip to content

Store

Defined in: store/Store.ts:40

A class representing a store of data, with multiple storage adapters.

new Store(): Store

Store

destroy(): void

Defined in: store/Store.ts:85

Destroys the store and all its adapters.

void

IStore.destroy


getAdapter<T>(adapterId): T

Defined in: store/Store.ts:65

Retrieves a registered storage adapter.

T extends IStorageAdapter = IStorageAdapter

The type of the adapter.

string

The ID of the adapter.

T

The adapter.

IStore.getAdapter


hasAdapter(adapterId): boolean

Defined in: store/Store.ts:78

Checks if a storage adapter is registered.

string

The ID of the adapter.

boolean

True if the adapter is registered, false otherwise.

IStore.hasAdapter


initialize(app): IStore

Defined in: store/Store.ts:160

IApplication

IStore

IStore.initialize


load(adapterId, key): Promise<any>

Defined in: store/Store.ts:152

Loads data from a storage adapter.

string

The ID of the adapter.

string

The key to load the data from.

Promise<any>

A promise that resolves with the loaded data.

IStore.load


registerAdapter(adapter, adapterOptions): Promise<void>

Defined in: store/Store.ts:50

Registers a new storage adapter with the store.

IStorageAdapter

The adapter to register.

any

The options to initialize the adapter with.

Promise<void>

A promise that resolves when the adapter has been registered and initialized.

IStore.registerAdapter


save(adapterId, key, data, awaitSave?): Promise<any>

Defined in: store/Store.ts:100

Saves data with a storage adapter.

The ID of the adapter, or an array of IDs, or an array of save configurations.

string | string[] | Partial<AdapterSaveConfig> | Partial<AdapterSaveConfig>[]

string

The key to save the data under.

any

The data to save.

boolean = true

Whether to wait for the save operation to complete before returning.

Promise<any>

A promise that resolves with the result of the save operation.

IStore.save