-
Notifications
You must be signed in to change notification settings - Fork 134
Description
In my experience, "requestable" methods that mutate a source, such as add, remove, and update, are not appropriate for assisting / rescuing. Instead, these methods provide thin wrappers over transform, and the Transformable interface provides the best way to engage with mutations.
The "requestable" methods that are in fact appropriate for assisting / rescuing are all related to querying a source: find, query, findLink, and findLinked. I think all these methods could be distilled into a single query method, given the right query definition language (see #192).
I believe we should refactor the Requestable interface into a Queryable interface that supports a single query method. This will nicely parallel the Transformable interface that supports a single transform method.
The query method will take two arguments: a query object and an options object. The query object might be as simple as specifying path: '/planets' or path: '/planets/1' or it might involve filters and conditionals (still TBD). It's possible that options should simply be a member of the query object instead of a separate argument.
I believe that this simplification will keep sources as lean and standardized as possible.
Convenience methods such as add, remove, update, and find could be added to a new class Store. A store will wrap a memory source (with a cache of course), and will be the primary interface developers use to interact with data. Behind the scenes, other sources can be wired up with their much simplified interfaces.
Major credit to @gnarf and @opsb for discussions that led to thinking about this new direction.
I'm in the midst of updating the normalized form (as per #157), which seems to make all this much more feasible.