Skip to content

Abstract Class: FlyzeStorageProvider

@flyze/lib-core-angular 1.0.0-alpha.34· latest

Defined in: projects/lib-core-angular/src/lib/modules/storage/storage-provider.abstract.ts:20

The contract every storage location implements: read, write and delete of opaque JSON, addressed by a key string.

Implementations are data-agnostic. A provider never learns which keys exist or what they mean, and a value is whatever a caller handed over — which is why read promises T only as a convenience and says so: the shape is not to be trusted.

Async throughout, deliberately. IndexedDB and any future backend provider cannot be anything else, and the web-storage providers lose nothing by returning an already-resolved promise. A synchronous contract would make the eventual backend provider a breaking change for every call site. Rationale: docs/decisions/0012-route-client-storage-by-key-path.md

Nothing here throws. A missing storage location, a browser that refuses access, a corrupt entry — every failure degrades to “not remembered”: read resolves null and write / delete resolve as a no-op. A cosmetic preference must not be able to take an app’s bootstrap down.

new FlyzeStorageProvider(): FlyzeStorageProvider

FlyzeStorageProvider

abstract delete(key): Promise<void>

Defined in: projects/lib-core-angular/src/lib/modules/storage/storage-provider.abstract.ts:45

Deletes the entry under a key. Deleting an absent key is not an error.

string

The full key, prefix included.

Promise<void>

Resolves once removed, or once the delete has been dropped.


abstract read<T>(key): Promise<T>

Defined in: projects/lib-core-angular/src/lib/modules/storage/storage-provider.abstract.ts:28

Reads the value stored under a key.

T = unknown

string

The full key, prefix included.

Promise<T>

The stored value, or null if absent, corrupt or unreadable. The shape is not to be trusted — T is a convenience for the caller, not a guarantee.


abstract write(key, value): Promise<void>

Defined in: projects/lib-core-angular/src/lib/modules/storage/storage-provider.abstract.ts:37

Writes a value under a key, replacing whatever was there.

string

The full key, prefix included.

unknown

Any JSON-serializable value.

Promise<void>

Resolves once stored, or once the write has been dropped.