validated-method | Meteor methods with better scoping | Web Framework library
kandi X-RAY | validated-method Summary
kandi X-RAY | validated-method Summary
This is a simple wrapper package for Meteor.methods. The need for such a package came when the Meteor Guide was being written and we realized there was a lot of best-practices boilerplate around methods that could be easily abstracted away. Note: the code samples in this README use the Meteor 1.3 import/export syntax, but this package works great in Meteor 1.2 as well. In that case, we recommend attaching your ValidatedMethod objects to the relevant collection, like Lists.methods.insert = new ValidatedMethod(...).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Apply arguments .
validated-method Key Features
validated-method Examples and Code Snippets
Community Discussions
Trending Discussions on validated-method
QUESTION
I am updating one of my projects to use meteor version 1.7 from 1.4 and the following error is happening. I tried to reinstall meteor, downgrading to 1.6 and also added .babelrc
file but no luck. I think the error is about the ecmascript
and babel-compiler
package version because it works fine when it is at version 1.4. Does anyone have idea on how to resolve this problem? Thank you very much!
ANSWER
Answered 2018-Jul-15 at 11:40Using yarn install
instead of npm install
solved the problem.
QUESTION
I found an important security fault in my meteor app regarding subscriptions (maybe methods are also affected by this).
Even though I use the check
package and check()
assuring that the correct parameters data types are received inside the publication, I have realised that if a user maliciously subscribes to that subscription with wrong parameter data types it is affecting all other users that are using the same subscription because the meteor server is not running the publication while the malicious user is using incorrect parameters.
How can I prevent this?
Packages used:
...ANSWER
Answered 2018-Apr-09 at 10:25There is one thing to know about check
and strings which is, that it accepts empty strings like ''
which you basically showed in your malicious example.
Without guarantee to solve your publication issue I can at least suggest you to modify your check
code and include a check for non-empty Strings.
A possible approach could be:
QUESTION
I have my method here : imports/api/Books/methods
Following the guide, we can import this method from server or from both (server and client) if we want optimistic UI.
However, if we use this package : https://github.com/meteor/validated-method : is it necessary to import from both ? Can we just import from server ?
Thank you
update
I already read this :
...ANSWER
Answered 2018-Feb-13 at 11:52Optimistic UI works by running the method against the minimongo on the client to give you the most likely result from running the query on the server. Therefore the method needs to be available from both the client and server to enable optimistic UI.
If you want to do something differently on the client or server you have the isSimulation
boolean that will be true in the case it is running on the client and false on the server side.
QUESTION
I am using validated methods (mdg:validated-method
) with LoggedInMixin (tunifight:loggedin-mixin
).
Now I have a problem with my unit tests, as they fail with notLogged
error, because in the unit tests there is no logged user of course.
How do I have to stub that?
method
...ANSWER
Answered 2017-Oct-10 at 20:28validated-method
has a built-in way of providing a context and it is documented in the README
, exactly for cases like the one in your question.
method#_execute(context: Object, args: Object)
Call this from your test code to simulate calling a method on behalf of a particular user:
(source)
QUESTION
I don't understand, I created this method
...ANSWER
Answered 2017-Aug-19 at 13:33I found this issue,
'createUser' comes from 'accounts-password package' when you do : meteor add accounts-password
you can check in your application
/MyAPPLICATION/.meteor/local/build/programs/server/packages/accounts-password.js
we can find this :
QUESTION
I'm trying to update a MongoDB collection using $set. The field within the collection doesn't exist. When I try to add the field, the collection briefly stores the data and then the data disappears and returns an error ClientError: name.first is not allowed by the schema
. I have no idea what I'm doing wrong here and I've been searching google for hours.
I'm using:
- Meteor
- Simple-Schema (NPM)
- meteor-collection2-core
Path: Simple-Schema
ANSWER
Answered 2017-May-31 at 07:56Can you try replacing:
QUESTION
I am using Meteor. As you can see in the README of ValidatedMethod on Github, it is using the returnStubValue option when calling a method, but it doesn't seem to work for me. I would like to know what you think about it.
I've uploaded a simple Meteor project that reproduce the problem on Github : Link to the repository
Here is my server side method:
...ANSWER
Answered 2017-May-25 at 00:23mdg:validated-method
is doing fine. If you call (actually Meteor.apply
) a regular Meteor method without introducing validated-method
, the same result will be observed.
Here is the thing. In the documentation of Meteor,
The return value of the Method simulation is discarded, unless the returnStubValue option is passed when calling the Method, in which case it is returned to the Method caller. ValidatedMethod passes this option by default.
Notice the bold. In your example project, the returned object { finished: false }
from simulation is the return value of the call, not the callback. Therefore, the following transformation of how you make the client call
QUESTION
Simple Schema is accepting and inserting null
into required fields. Shouldn't it error? Can someone please point out what I'm doing wrong here.
I'm using these packages.
- mdg:validated-method
- mdg:validation-error
- simpl-schema
Simple Schema
ANSWER
Answered 2017-May-12 at 03:26OK, it appears as though I needed to also install collection2-core
QUESTION
I have an AutoForm with this options:
...ANSWER
Answered 2017-Mar-29 at 01:08meteormethod argument should call a Meteor.Method.
you should have define:
QUESTION
I'm using aldeed:autoform, aldeed:simple-schema, aldeed:collection2 and mdg:validated-method for doing an insert over a collection.
This is the tempalte with the AutoForm:
...ANSWER
Answered 2017-Feb-10 at 00:54autoform treats required keys in the schema as being required in the form input which doesn't work for the _id
key.
If you make the _id optional: true then your insert will work and Meteor will automatically insert the _id
OR you can use a variation of the schema for the autoform which omits the _id
key altogether:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install validated-method
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page