parse-server
parse-server copied to clipboard
feat: Allow short circuit of beforeFind
trafficstars
Pull Request
- Report security issues confidentially.
- Any contribution is under this license.
- Link this pull request to an issue.
Issue
Closes: https://github.com/parse-community/parse-server/issues/8693
Approach
This PR continues and supersedes #8694 by @dblythy. Adds ability to return objects (or an empty array) from a beforeFind trigger.
Tasks
- [x] Add tests
Summary by CodeRabbit
- New Features
- Improved support for returning objects or arrays of objects directly from cloud triggers, allowing for more flexible query responses.
- Bug Fixes
- Ensured that objects returned from triggers are handled correctly without unnecessary conversions.
- Tests
- Added comprehensive tests to verify the behavior of triggers returning objects or arrays, including unsaved objects and empty results.
- Refactor
- Centralized trigger handling for find and get operations to ensure consistent execution and security enforcement.
- Enhanced trigger processing with improved parameter handling, JSON serialization, and query construction for better robustness and clarity.