{"id":15384106,"url":"https://github.com/theashraf/parse-cloud-classes","last_synced_at":"2025-03-14T11:44:33.413Z","repository":{"id":57319321,"uuid":"164440099","full_name":"theashraf/parse-cloud-classes","owner":"theashraf","description":"Easily extend parse cloud triggers behaviour","archived":false,"fork":false,"pushed_at":"2019-01-07T15:54:13.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-21T17:47:46.642Z","etag":null,"topics":["parse","parse-cloud-code","parse-server","parse-server-api","parse-triggers"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theashraf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-07T13:55:33.000Z","updated_at":"2019-01-07T15:52:53.000Z","dependencies_parsed_at":"2022-08-26T01:10:11.798Z","dependency_job_id":null,"html_url":"https://github.com/theashraf/parse-cloud-classes","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theashraf%2Fparse-cloud-classes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theashraf%2Fparse-cloud-classes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theashraf%2Fparse-cloud-classes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theashraf%2Fparse-cloud-classes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theashraf","download_url":"https://codeload.github.com/theashraf/parse-cloud-classes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243573165,"owners_count":20312879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parse","parse-cloud-code","parse-server","parse-server-api","parse-triggers"],"created_at":"2024-10-01T14:40:38.634Z","updated_at":"2025-03-14T11:44:33.389Z","avatar_url":"https://github.com/theashraf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parse Cloud Classes\n\n[![npm](https://img.shields.io/npm/v/parse-cloud-classes.svg)](https://www.npmjs.com/package/parse-cloud-classes)\n[![license](https://img.shields.io/github/license/theashraf/parse-cloud-classes.svg)](https://github.com/theashraf/parse-cloud-classes/blob/master/LICENSE)\n[![npm](https://img.shields.io/npm/dw/parse-cloud-classes.svg)](https://www.npmjs.com/package/parse-cloud-classes)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](#badge)\n\n\u003e Easily extend parse cloud triggers behaviour\n\nAn easy way to extend parse cloud triggers behaviour\n\n## Installation\n\n```sh\nnpm i parse-cloud-classes\n```\n\n## Example\n\nA working example can be found [here](example)\n\n### Supported versions\n\n- parse-server \u003e= 3.0.0\n- node \u003e= 6.4\n\n### Basic Usage\n\n```js\n//parse cloud code file\nconst ParseClass = require('parse-cloud-classes')\nconst Joi = require('joi')\n\n//validation service\nconst validation = async req =\u003e {\n\tconst { object } = req\n\tconst { error } = Joi.validate(object.toJSON(), validationSchema)\n\tif (error) throw error.details[0].message\n\treturn req.object\n}\n//sendWelcomeMail service\nconst sendWelcomeMail = async req =\u003e {\n\tconst { object } = req\n\tif (!object.existed()) {\n\t\t//send welcome email here\n\t}\n}\n//analytics service\nanalytics = {\n\tafterDelete: async req =\u003e {\n\t\tconst analytic = new Parse.Object('Analytic')\n\t\tanalytic.set('event', 'deleted')\n\t\tanalytic.set('object', {\n\t\t\tclassName: req.object.className,\n\t\t\tid: req.object.id,\n\t\t})\n\t\tawait analytic.save({}, { userMasterKey: true })\n\t},\n\tafterSave: async req =\u003e {\n\t\tconst analytic = new Parse.Object('Analytic')\n\t\tanalytic.set('event', 'created')\n\t\tanalytic.set('object', {\n\t\t\tclassName: req.object.className,\n\t\t\tid: req.object.id,\n\t\t})\n\t\tawait analytic.save({}, { userMasterKey: true })\n\t},\n}\n\nnew ParseClass(Parse.User)\n\t.beforeSave([validation])\n\t.afterSave([analytics.afterSave, sendWelcomeMail])\n\t.afterDelete([analytics.afterDelete])\n\t.beforeDelete([\n\t\tasync req =\u003e {\n\t\t\tif (!req.master) throw 'unauthorized'\n\t\t\treturn req.object\n\t\t},\n\t])\n```\n\n## Development setup\n\n```sh\nnpm install \u0026\u0026 npm run dev\n```\n\n## Contribution\n\n1. Fork the project\n2. Create your feature branch (`git checkout -b feature/fooBar`), or hotfix branch (`git checkout -b hotfix/fooBar`)\n3. Commit your changes (`npm run cz`)\n4. Push to the feature branch (`git push origin feature/fooBar`), or hotfix branch (`git push origin hotfix/fooBar`)\n5. Create a new Pull Request\n\n## License\n\nThis project is licensed under the MIT License, See [LICENSE](LICENSE) for more information\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheashraf%2Fparse-cloud-classes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheashraf%2Fparse-cloud-classes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheashraf%2Fparse-cloud-classes/lists"}