Abstract Class: FlyzeStorageProvider
@flyze/lib-core-angular 1.0.0-alpha.34· latestDefined 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.
Extended by
Section titled “Extended by”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FlyzeStorageProvider():
FlyzeStorageProvider
Returns
Section titled “Returns”FlyzeStorageProvider
Methods
Section titled “Methods”delete()
Section titled “delete()”
abstractdelete(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.
Parameters
Section titled “Parameters”string
The full key, prefix included.
Returns
Section titled “Returns”Promise<void>
Resolves once removed, or once the delete has been dropped.
read()
Section titled “read()”
abstractread<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.
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”string
The full key, prefix included.
Returns
Section titled “Returns”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.
write()
Section titled “write()”
abstractwrite(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.
Parameters
Section titled “Parameters”string
The full key, prefix included.
unknown
Any JSON-serializable value.
Returns
Section titled “Returns”Promise<void>
Resolves once stored, or once the write has been dropped.