Skip to content

Adds Hooks API - #500

Merged
drew-gross merged 4 commits into
parse-community:masterfrom
flovilmart:hooks-API
Feb 25, 2016
Merged

drew-gross merged 4 commits into
parse-community:masterfrom
flovilmart:hooks-API

Conversation

@flovilmart

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@facebook-github-bot

Copy link
Copy Markdown

@flovilmart updated the pull request.

4 similar comments
@facebook-github-bot

Copy link
Copy Markdown

@flovilmart updated the pull request.

@facebook-github-bot

Copy link
Copy Markdown

@flovilmart updated the pull request.

@facebook-github-bot

Copy link
Copy Markdown

@flovilmart updated the pull request.

@facebook-github-bot

Copy link
Copy Markdown

@flovilmart updated the pull request.

@gfosco

gfosco commented Feb 20, 2016

Copy link
Copy Markdown
Contributor

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

@flovilmart

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

@flovilmart updated the pull request.

Comment thread src/hooks.js Outdated
function enforceMasterKeyAccess(req) {
return new Promise((fulfill, reject) => {
if (!req.auth.isMaster) {
console.log("REQ AUTH IS NOT MASTER!");

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

@flovilmart updated the pull request.

1 similar comment
@facebook-github-bot

Copy link
Copy Markdown

@flovilmart updated the pull request.

@flovilmart

Copy link
Copy Markdown
Contributor Author

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

@facebook-github-bot

Copy link
Copy Markdown

@flovilmart updated the pull request.

3 similar comments
@facebook-github-bot

Copy link
Copy Markdown

@flovilmart updated the pull request.

@facebook-github-bot

Copy link
Copy Markdown

@flovilmart updated the pull request.

@facebook-github-bot

Copy link
Copy Markdown

@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
Copy Markdown

@flovilmart updated the pull request.

Comment thread src/index.js Outdated
}) {

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

@flovilmart updated the pull request.

@facebook-github-bot

Copy link
Copy Markdown

@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

gfosco commented Feb 26, 2016

Copy link
Copy Markdown
Contributor

👍 👍 👍 !

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