parse-community / parse-community/parse-server
Make trigger context accessible in all triggers
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
Is your feature request related to a problem? Please describe.
Sometime we need to pass some context to adapt the behavior / action of a trigger.
Currently context is only available on these triggers: beforeSave - afterSave - beforeDelete - afterDelete - beforeFind
See #6459 #6626 #6666
Describe the solution you'd like
It should be possible to pass arguments from all 'actions' (e.g. find, login, liveQuery, etc...) to the triggers.
As I said the logic is already implemented for some of them and the concept seems to have been accepted.
I make sense to be able to use context in all triggers.
query.find( { context: {example: "abc"} } )
// currently we can use context with beforeFind :)
Parse.Cloud.beforeFind("myClass", async (request) => {
if request.context.example == "abc" {
// To some particular actions
}
})
// currently we can't use context with afterFind :(
Parse.Cloud.afterFind("myClass", async (request) => {
if request.context.example == "abc" {
// To some particular actions
}
})
I hope this feature will help a lot of devs ;)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing context handling for beforeSave, afterSave, beforeDelete, afterDelete, and beforeFind, then compare how actions such as find, login, and liveQuery invoke triggers. Done means context passed by an action is available consistently in all relevant trigger callbacks, including afterFind, with coverage for the supported actions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100