Skip to content

Adds Hooks API #500

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

Merged
merged 4 commits into from
Feb 25, 2016
Merged

Adds Hooks API #500

merged 4 commits into from
Feb 25, 2016

Conversation

flovilmart
Copy link
Contributor

Adds Parse.Hooks.js in src/cloud-code/Parse.Hooks.js
Moves Cloud code related functions in src/cloud-code

Effort to decouple in small PR's #263

@flovilmart
Copy link
Contributor Author

@gfosco maybe we should move Parse.Hooks.js to parse-cloud-express

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

4 similar comments
@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@gfosco
Copy link
Contributor

gfosco commented Feb 20, 2016

This is great... One thought, how well do you think our current tests cover cloud code usage?

@flovilmart
Copy link
Contributor Author

The tests cover purely hooks creation and calls. The wrapper comes from the multi server cloud code and was fully functioning.

That would be pretty easy to setup a basic http server on local host and run tests from there.

Do you want me to add that to this test suite?

} else {
throw new Parse.Error(143, "invalid hook declaration");
}
//console.log("SAVE!", hook, query);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

function enforceMasterKeyAccess(req) {
return new Promise((fulfill, reject) => {
if (!req.auth.isMaster) {
console.log("REQ AUTH IS NOT MASTER!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets not log stuff via console.log. We probably don't need to log anything here, if we do we should log it via the LoggerAdapter.

@drew-gross
Copy link
Contributor

Awesome PR :) hooks are sweet. Can you mark it as experimental until we can verify that it's compatible with the dashboard? Also we discussed with our backend experts and when we described the strategy of running Cloud Code in a separate process they called it "insane" and "an operational nightmare". It's cool that this supports multiple apps, but I think that the only way we will be able to merge a fully supported way to run multiple apps is if each app has it's own process. If that means that each app has to run on a separate port, then so be it.

@flovilmart
Copy link
Contributor Author

@drew-gross yeah that's the point, I'm decoupling every element to be able to run multiple app in separate PR's that will make it easier for everyone.
The next big one, will be the multiple apps itself without Cloud code (throwing exceptions) :)

@flovilmart
Copy link
Contributor Author

@drew-gross added process.env.PARSE_EXPERIMENTAL_HOOKS_ENABLED for now.
@gfosco Added tests for vanilla express server for function, beforeSave and afterSave.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

1 similar comment
@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@flovilmart
Copy link
Contributor Author

rebased and improved architecture with HooksController, HooksRouter to match what's going on now.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

3 similar comments
@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

Adds Parse.Hooks.js in src/cloud-code/Parse.Hooks.js
Moves Cloud code related functions in src/cloud-code
@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@@ -88,6 +89,11 @@ function ParseServer({
serverURL = requiredParameter('You must provide a serverURL!'),
maxUploadSize = '20mb'
}) {

// Initialize the node client SDK automatically
Parse.initialize(appId, javascriptKey || '', masterKey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The || '' on these two are unnecessary because of the = || '' and requiredParameter('You must provide a serverURL!') in the argument destructuring.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@facebook-github-bot
Copy link

@flovilmart updated the pull request.

drew-gross added a commit that referenced this pull request Feb 25, 2016
@drew-gross drew-gross merged commit e5b1d50 into parse-community:master Feb 25, 2016
@gfosco
Copy link
Contributor

gfosco commented Feb 26, 2016

👍 👍 👍 !

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

Successfully merging this pull request may close these issues.

4 participants