How do I access to beforeSave's request and response objects?
It looks like ParseMockDB.registerHook expects a promise, even though regular Cloud Code beforeX handlers are of type function(request,response). ~~The contract should be identical to Cloud Code's for fidelity.~~ callbacks are a pain!
EDIT: Okay, instead of function(request,response), how about we replace the response part with promise syntax, but leave the request as a parameter: i.e. function(request).
Check the Parse.Object docs. Most *Request types are the same as each other and the *Response types are the same as each other too:
Parse.Cloud.AfterDeleteRequest Parse.Cloud.AfterSaveRequest Parse.Cloud.BeforeDeleteRequest Parse.Cloud.BeforeDeleteResponse Parse.Cloud.BeforeSaveRequest Parse.Cloud.BeforeSaveResponse
Note: some assumptions have to be made about the masterKey.
+1, following:
Parse.Cloud.AfterDeleteRequest Parse.Cloud.AfterSaveRequest Parse.Cloud.BeforeDeleteRequest Parse.Cloud.BeforeDeleteResponse Parse.Cloud.BeforeSaveRequest Parse.Cloud.BeforeSaveResponse