I’ve been using mdg:validated-method (https://github.com/meteor/validated-method) and really loving it. I like how it forces you into using best-practices. I think we should do the same thing for publications.
Ideas:
Would define Meteor.validatedPublication
name
validate: validate using SimpleSchema
maxLimit: prevent over-fetching data
userRequired: calls this.ready() if user not logged-in
permissionCheck: calls this.ready() if returns false
There’s one thing I’ve realized when building ValidatedMethod - it’s not really possible to anticipate all of the extensions and wrapper packages up front. For pub/sub, you might want some or all of the following:
Server:
Publish composite
Reactive publish
Argument validation
Permissions
REST
Client:
Subs manager
Template subscriptions
Basically, I think both Methods and Publications/Subscriptions need some sort of mixin/extension system, much like React components have mixins. That way, you can mix and match the different functionality you need, and it can be published by different people rather than having to be built into the core package itself.
Also, I wouldn’t attach it to Meteor.validatedPublication - probably a top-level symbol, or in 1.3 it would just be a module - import ValidatedPublication from 'validated-publication'.