Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
Hello,
I'm using Parse Server 4.4.0 and @types/parse 2.12.7 with TypeScript.
All is working as expected, thanks for your work :)
But, I'm trying to add a validation handler on a before save trigger, as described on the documentaion :
Parse.Cloud.beforeSave("Review", (request) => { // do any additional beforeSave logic here },{ fields: { stars : { required:true, options: stars => { return stars >= 1 && stars =< 5; }, error: 'Your review must be between one and five stars' } } });
But, in the index.d.ts used by Typescript, here is the declaration :
function beforeSave(arg1: any, func?: (request: BeforeSaveRequest) => Promise<void> | void): void;
And here is the JS code from your GitHub sources :
ParseCloud.beforeSave = function (parseClass, handler, validationHandler) {
As you can see, the "validationHandler" arguments for the method ParseCloud.beforeSave is missing in the declaration of the index.d.ts file. So, in Typescript, I can't add field validation like it's done in the documentation.
Am I missing somthing or is it really an issue ?
Thanks for help.
Steps to reproduce
Just install parse-server and @types/parse and use it with typescript.
Actual Outcome
In the index.d.ts :
function beforeSave(arg1: any, func?: (request: BeforeSaveRequest) => Promise<void> | void): void;
Expected Outcome
In the index.d.ts :
function beforeSave(arg1: any, func?: (request: BeforeSaveRequest) => Promise<void> | void, func?: (any) => Promise<void> | void): void;
Environment
Server
- Parse Server version: 4.4.0
- Parse Server @types version: 2.12.7
- Operating system: Windows 10
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local
Database
- System (MongoDB or Postgres): MongoDB
- Database version: 4.2
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScriot
- SDK version: 2.18.0