-
Notifications
You must be signed in to change notification settings - Fork 24
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
Adding option to provide a custom dereference function #98
Adding option to provide a custom dereference function #98
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Some notes:
- There could be value in having access to all the properties of the reference (e.g. if it's a
weak
reference), but we can safely add that later when needed. groq-js
doesn't actually have a concept that_id
(well, except that it's used for dereferencing) and_type
are special so theDocument
is maybe a bit tangential. However I don't see much harm in it either.
This was my initial approach but then I saw that the current implementation does not have a concept of weak references, so I did not want to introduce that with these changes - as I would need to do some research before doing that.
Yeah well technically groq would work well if none of the documents have Anyway, thanks for the feedback! |
Hm, the tests appear to fail? Not fully sure why? |
It should be fine now 🤞 some the new types needed to be exported from the entrypoint. Also I found another warning (unnecessary import of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely missed this, which is a shame because it looks like such a high value fix so I'll merge and release this right away if tests are passing 🙌
Thanks so much for your contributions @dios-david 💖
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@dios-david we've implemented this in |
Adding an optional
dereference
function toevaluate
options as discussed in #93Some things I was wondering while working on this:
dereference
function receive thedataset
(original or afterfromJS
transformation) as a second parameter, so it can be used when doing the lookup?PromiseLike<Document | null>
as return value, but having this function as async isn't necessary needed. Shall we add support for sync return value as well?