cult-of-coders / grapher

Grapher: Meteor Collection Joins + Reactive GraphQL like queries
https://atmospherejs.com/cultofcoders/grapher
MIT License
275 stars 53 forks source link

feature: post filtering on subscriptions #478

Open bhunjadi opened 12 months ago

bhunjadi commented 12 months ago

What are we trying to solve with this PR?

For each named query, you should specify a body server-side in createNamedQuery function and these are the fields that can be fetched. Additional fields requested from the client will be ignored. Additionally, you can also use embody to further limit the fields sent to a particular user.

But what if you want to send limited fields for users depending on a value inside a document? This PR focuses on that with subscriptionFilter option where you can access the document in a subscription and change it (remove fields or similar) on the fly before it is sent to the client(s).

Works with scoped queries.

Please see tests for better understanding.

StorytellerCZ commented 11 months ago

Can you please update the docs as well with this?

bhunjadi commented 11 months ago

Docs updated

bhunjadi commented 11 months ago

@StorytellerCZ Any ideas what happened with 2.3.1 tests? I tried with the same version locally, it's running fine.

StorytellerCZ commented 10 months ago

Looks like an issue in the test setup...