@adobe/aep-rules-engine
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

AEP Rules Engine

Overview

A simple, generic, extensible Rules Engine in TypeScript.

Installation

Although written in TypeScript, the build produces JavaScript implementations that can be used anywhere JavaScript can be evaluated.

Install via npm.

npm install @adobe/aep-rules-engine

Usage

const RulesEngine = require("@adobe/aep-rules-engine");

const ruleset = RulesEngine({
  version: 1,
  rules: [
    {
      condition: {
        definition: {
          conditions: [
            {
              definition: {
                conditions: [
                  {
                    definition: {
                      key: "color",
                      matcher: "eq",
                      values: ["orange", "blue"],
                    },
                    type: "matcher",
                  },
                ],
                logic: "and",
              },
              type: "group",
            },
          ],
          logic: "and",
        },
        type: "group",
      },
      consequences: [
        {
          type: "item",
          detail: {
            hello: "world",
          },
          id: "abc123",
        },
      ],
    },
  ],
});

const consequences = ruleset.execute({ color: "orange" });

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

Readme

Keywords

none

Package Sidebar

Install

npm i @adobe/aep-rules-engine

Weekly Downloads

1,422

Version

2.0.2

License

Apache-2.0

Unpacked Size

88.9 kB

Total Files

57

Last publish

Collaborators

  • stopp-adobe
  • dylandepass
  • djaeggi
  • adobehalls
  • fullcolorcoder
  • marbec
  • tripod
  • garthdb
  • lazd
  • adobe-admin
  • patrickfulton
  • trieloff
  • shazron
  • krisnye
  • dcpfsdk
  • natebaldwin
  • devongovett
  • aspro83
  • symanovi
  • dpfister
  • stefan-guggisberg
  • korra
  • rofe
  • kptdobe