Skip to content
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

Wanted: validated-publication #51

Open
johnslemmer opened this issue May 15, 2016 · 3 comments
Open

Wanted: validated-publication #51

johnslemmer opened this issue May 15, 2016 · 3 comments

Comments

@johnslemmer
Copy link

Doesn't really belong on this project but not sure where else to put it.

But it would be nice to accomplish something that has a similar list benefits that validate method has:

  • Have an object that represents your publication. Refer to it through JavaScript scope rather than by a magic string name.

  • Built-in validation of arguments through aldeed:simple-schema, or roll your own argument validation.

  • Provide access to the same query that will be used inside the publication. Because of reasons described here I often times find myself copying and pasting a lot of the database queries.

  • Or even better than the above be able to do a single call that returns the subscription handler like before, but also, an already fetched list of the documents found. And have it be reactive. Ideally I could write in a ReactMeteorData container something like the following:

    export default createContainer(() => {
    const { handle, data } = publicationObject.subscribeAndFetch();
    return {
      loading: !handle.ready(),
      data: data,
    }
    }, 
    

When it comes down to it I feel like I copy the same pattern pretty often: subscribe, pass along the handle.ready() info, do the same query on the collection as happened in the publication, and pass along that data.

And oh yeah, obviously be able to handle compsite publications.

Would this be bad form to have something like this? It seems like it would be a great nice to have, just like validated-method is wonderful.

@stubailo
Copy link
Contributor

Someone made this and posted on the forum! If enough people try it and it's good we can make it more official.

@johnslemmer
Copy link
Author

I couldn't find it on the forum. I only found this.

So, I created my own. It is pretty much a copy and paste of validated method with the necessary changes. It doesn't have all the features that I want yet. But it does allow for composite publishing and having an object you can reference. I would love to add the ability to add sorting that only happens on the client side and of course the subscribeAndFetch. I don't have time for it now. But maybe someone else can take this and run with it.

@tcastelli
Copy link

tcastelli commented Jan 22, 2017

I have found this package which seems to cover most common cases and shares the same structure that validated-method has. Is there any chance that it becomes a mdg package?

I think many of the points suggested here are included. Integrating it with a subsmanager on the client could be nice, but that seems more like a mixin package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants