VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.89k forks source link

Connector filter calbacks #2690

Closed Apollinaire closed 3 years ago

Apollinaire commented 3 years ago

Adds a callback to Connector.filter, which allows to iterate on the selector, options and filteredFields used in a collection's multi query.

eric-burel commented 3 years ago

I think for the documentation part, the best way at this point is to register the callback with a description. I don't know if are able to do this currently.

Apollinaire commented 3 years ago

I can't register these callbacks here because the connectors are not initialized on the collection creation, they take the collection as a parameter:

DatabaseConnectors.mongo = {
  filter: async (collection, input, context) => {...}
}

We could register them inside createCollection, but it seems weird to register a callback so far from where it's called, that could lead to confusion. Also, the previous equivalent to these callbacks (`${typeName.toLowerCase()}.parameters`) were not registered. So I guess it's ok to leave it as it is. This is a pretty deep feature, so I guess it's fine to go without the documentation for this one.

eric-burel commented 3 years ago

Yep agreed, feel free to merge