-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'include' option to memorySource.find and memorySource.findLinked #123
Conversation
I'm wondering if we should be adding the 'include' option to findLinked. I notice that findLinked isn't listed in the methods for requestable in the orbit.js readme so I'm not sure if it's considered part of the public API or not(possibly the readme just hasn't been updated). If it is I think it would be more consistent to allow the 'include' option with findLinked. What's the general feeling? |
Another issue, wondering about the various ways to call find when options are included, you've got:
It's difficult to distinguish between the queryObject and options (they're all objects). The simplest option from an implementation point of view is that options always has to be passed as the 3rd argument. That's pretty ugly though for find('type', null, options). |
One more argument for #110, in which options would always be the second argument. For now though, I think options has to be the third argument. |
Yes, definitely.
Sorry - the readme does need updating. |
Yup, that does make sense, so we'd have:
|
Actually, seeing as type and id are both strings, how would we distinguish between the two? |
|
Ha, that does seem pretty reasonable. |
da2380d
to
ecc428a
Compare
@dgeb This PR now adds support for the include option to both memorySource.find and memorySource.findLinked. I've replaced the source.findLinked implementation, it seems to cover all the existing functionality, at least the tests pass anyway. The options parsing is currently done in memory-source, in orbit-firebase I introduced an Options object which took care of this. It's a bit heavier though so perhaps you're happy with the way it is? (see https://github.com/orbitjs/orbit.js/pull/123/files#diff-3afbad5d9865c146aff683c3f945b68fR111) |
Another thought, I'd expect findLinked to return an empty array rather than null. |
9e493a1
to
46d0c02
Compare
That's great news, @opsb! |
Just opening this to allow discussion.
Adds the following option to find: