Giter VIP home page Giter VIP logo

node-red-contrib-json-rules's Introduction

node-red-contrib-json-rules

Build

Use a current version of Node.js. Install the dependencies, run the tests, and compile the TypeScript code with yarn or npm:

$ yarn
$ yarn test
$ yarn build

Releasing to NPM

Commit all changes and run the following:

$ npm login
$ npm version <update_type>
$ npm publish

โ€ฆ where <update_type> is one of patch, minor, or major. This will update the package.json, and create a tagged Git commit with the version number.


Copyright Ethan Brooks, 2019

node-red-contrib-json-rules's People

Watchers

 avatar

node-red-contrib-json-rules's Issues

Create dynamic fact support in the UI

/**

  • 'account-information' fact executes an api call and retrieves account data, feeding the results
  • into the engine. The major advantage of this technique is that although there are THREE conditions
  • requiring this data, only ONE api call is made. This results in much more efficient runtime performance.
    */
    engine.addFact('account-information', function (params, almanac) {
    return almanac.factValue('accountId')
    .then(accountId => {
    return apiClient.getAccountInformation(accountId)
    })
    })

Add outcomes to almanac to allow rule outcomes to be used in anteceeding rules.

`engine.addRule({
conditions,
event,
onSuccess: function (event, almanac) {
almanac.addRuntimeFact('rule-1-passed', true) // track that the rule passed
},
onFailure: function (event, almanac) {
almanac.addRuntimeFact('rule-1-passed', false) // track that the rule failed
},
priority: 10 // a higher priority ensures this rule will be run prior to subsequent rules
})

// in a later rule:
engine.addRule({
conditions: {
all: [{
fact: 'rule-1-passed',
operator: 'equal',
value: true
}
},
priority: 1 // lower priority ensures this is run AFTER its predecessor
}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.