Abstract
Abstract
fetchRetrieve an item from the data connector.
The identifier used to retrieve an item.
A promise that resolves with a data payload if available.
The promise returned by this method may be rejected if an error occurs in
retrieving the data. Nonexistence of an id
will succeed with undefined
.
Retrieve the list of items available from the data connector.
Optional
query: WThe optional query filter to apply to the connector request.
A promise that always rejects with an error.
Subclasses should reimplement if they support a back-end that can list.
An abstract class that adheres to the data connector interface.
Typeparam
T - The basic entity response type a service's connector.
Typeparam
U - The basic entity request type, which is conventionally the same as the response type but may be different if a service's implementation requires input data to be different from output responses. Defaults to
T
.Typeparam
V - The basic token applied to a request, conventionally a string ID or filter, but may be set to a different type when an implementation requires it. Defaults to
string
.Typeparam
W - The type of the optional
query
parameter of thelist
method. Defaults tostring
.Notes
The only abstract method in this class is the
fetch
method, which must be reimplemented by all subclasses. Theremove
andsave
methods have a default implementation that returns a promise that will always reject. This class is a convenience superclass for connectors that only need tofetch
.