{"id":18084853,"url":"https://github.com/coderofsalvation/parse-server-jsreactor","last_synced_at":"2025-09-09T19:36:24.673Z","repository":{"id":51516073,"uuid":"223449246","full_name":"coderofsalvation/parse-server-jsreactor","owner":"coderofsalvation","description":"A flexible IFTTT-engine with generated gui (backend-agnostic)","archived":false,"fork":false,"pushed_at":"2021-05-11T12:55:53.000Z","size":221,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-18T13:06:17.132Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coderofsalvation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":"https://gumroad.com/l/hGYGh"}},"created_at":"2019-11-22T17:04:53.000Z","updated_at":"2022-06-20T03:50:54.000Z","dependencies_parsed_at":"2022-08-02T23:31:21.640Z","dependency_job_id":null,"html_url":"https://github.com/coderofsalvation/parse-server-jsreactor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coderofsalvation/parse-server-jsreactor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fparse-server-jsreactor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fparse-server-jsreactor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fparse-server-jsreactor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fparse-server-jsreactor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderofsalvation","download_url":"https://codeload.github.com/coderofsalvation/parse-server-jsreactor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fparse-server-jsreactor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261162067,"owners_count":23118221,"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":[],"created_at":"2024-10-31T15:08:26.438Z","updated_at":"2025-07-01T11:40:16.708Z","avatar_url":"https://github.com/coderofsalvation.png","language":"JavaScript","funding_links":["https://gumroad.com/l/hGYGh"],"categories":[],"sub_categories":[],"readme":"\u003e WARNING: this project is in BETA\n\nAn flexible IFTTT-engine with generated gui. \nThis is basically a wrapper for [jsreactor](https://npmjs.com/package/@coderofsalvation/jsreactor).\n\n![](https://raw.githubusercontent.com/coderofsalvation/parse-server-jsreactor/master/doc/bre.gif)\n\n## Installation\n\n    npm install parse-server-jsreactor @coderofsalvation/jsreactor --save\n\nthen in your cloud-code entrypoint (`cloud/index.js` e.g.) add this:\n\n```\n// add the business rule engine (BRE) + channels\nvar BRE         = require('parse-server-jsreactor')\nvar Database    = require('parse-server-jsreactor/channel/Database')\nvar Input       = BRE.Channel.Input \n\nvar bre = new BRE(Parse,{languages:['EN'],logConsole:true})\n\nnew Database({bre})\nnew Input({bre})\n\nbre.init()\n```\n\nThen specify which (database) classes you want to expose to it:\n\n![](https://raw.githubusercontent.com/coderofsalvation/parse-server-jsreactor/master/doc/config.png)\n\nDo yourself a favor and **don't** include the `Rule`-class (recursion:the universe will explode)\n\n\u003e NOTE: All the Parse Config-variables are accessible (and refreshed when needed) in the channels thru the `opts`-variable.\nTherefore you could also move the `languages:['EN']`-array from the init-code here (so it can be updated outside of the code)\n\n## Running the BRE\n\nThis will pass {foo:1} into the BRE (channels)\n```\nvar res = await Parse.Cloud.run('bre',{foo:1})\n```\n\n\u003e NOTE: set environment variable `MEMOIZE_AGE=10000` to change database-call-cache for 10 seconds (getting roles, getting schemas) etc. (default is 15sec on production, 5sec on localhost)\n\n## What are Channels?\n\nA channel is basically an object which describes triggers and/or actions.\nFor example, Twilio (the smsservice) can be seen as a channel with triggers (receive sms) and actions (send sms)\n\n\u003e search for `jsreactor-channel` on npm, and check the [jsreactor docs](https://npmjs.com/package/@coderofsalvation/jsreactor) on how to use them    \n\n## Live-coding cloud functions\n\nSetup a cloudfunction-trigger (with name `foo` e.g.), and add a javascript-action like so:\n\n```\nParse.Cloud.on.foo = (req) =\u003e new Promise((resolve,reject) =\u003e {\n  resolve({foo:123})\n})\n```\n\n## Extending the Rule-class\n\nFeel free to just add columns from the Parse dashboard, as your used to.\nHowever, in case your user-interface is using jsonschema to generate itself, you might want to read along:\n\n\u003e NOTE: during runtime this package automatically creates a *Rule* parseClass to store the rules. In case you want to add custom properties to that class then write your own adapter and pass it as `new BRE(Parse,myAdapter)` (Just copy the adapter-code from index.js and modify it)\n\nBear in mind that you probably want to patch the `breGetSchema`-endpoint to hint your custom fields to your frontend-app.\n\n## Forwarding the Parse-email-adapter to BRE\n\nIn case you want to enjoy editable sendgrid templates when using Parse's  __password reset__ feature, you can redirect all email to the BRE:\n\n\u003e Just use this emailadapter when initializing Parse:\n\n```\n    verifyUserEmails:true,\n    emailAdapter: require('parse-server-jsreactor').emailAdapter(),\n```\n\n\u003e NOTE: dont forget to run `npm install jsreactor-channel-sendgrid` and read its [docs](https://npmjs.com/package/jsreactor-channel-sendgrid)\n\n## Multi-tenant: Unique Rules per App \n\nThe `Parse`-object is a singleton by default. \nHowever, we can work around this to enable per-app Parse instances:\n\n```\n     Parse.initializeMulti = (appId, javascriptKey, masterKey, Parse) =\u003e {                                                       \n\t\tObject.keys(require.cache).forEach(function(key) { delete require.cache[key] })\n        var _Parse = require('parse/node')\n        _Parse.initialize( appId, javascriptKey, masterKey )\n        _Parse.Cloud = Parse.Cloud                                                                                                \n\t    return _Parse\n      }                                                                                                                   \n      var init = async (app) =\u003e {\n          // init globally\n          Parse.initialize( app.appId, app.javascriptKey, app.masterKey ) // remember instance\n\t\t\t// but also 'fork' an instance\n          Parse[ app.appId ] = Parse.initializeMulti( app.appId, app.javascriptKey, app.masterKey, Parse )\n          Parse[ app.appId ].serverURL = app.serverURL\n          ...\n\t\t  // use Parse[ app.appId ] from here to initialize BRE\n\t      var bre = new BRE(Parse[ app.appId ],{languages:['EN'],logConsole:true})\n\t\t\n\t  }\n\n\t  for( var i in apps ) await init(apps[i])\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderofsalvation%2Fparse-server-jsreactor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderofsalvation%2Fparse-server-jsreactor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderofsalvation%2Fparse-server-jsreactor/lists"}