Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@o3r/rules-engine

Package Overview
Dependencies
Maintainers
0
Versions
1698
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@o3r/rules-engine

This module provides a rule engine that can be executed on your Otter application to customize your application (translations, placeholders and configs) based on a json file generated by your CMS.

  • 11.5.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Otter rules-engine

Super cute Otter!

This package is an Otter Framework Module.

Description

Stable Version Bundle Size

This module provides a rules engine that can run on your user's browser to customize the (translations, [//]: # (Should we target placeholder or the component npmjs, and we add a section on the placeholder there?) placeholders and configurations) of your application at runtime.

The rules engine interprets a list of actions to execute based on the evaluation of Rulesets and their conditions. Conditions are logical expressions relying on operators and variables we call facts.

You can store your list of Rulesets on a static JSON file.

This mechanism allows you to bring UI personalization based on runtime events without the need of a backend service. This can be useful if you want to drive dynamic behavior.

For example, you could consider leveraging this feature to display assets based on the current season or for some special events, or to drive A/B testing on your components.

You will find more information on the concepts behind the rules engine in its dedicated documentation. For a demonstration of the rules engine capabilities, you can refer to the live example in the Otter showcase.

How to install

ng add @o3r/rules-engine

[!WARNING] This module requires @o3r/core to be installed.

How to use

The package exposes the RulesEngineRunnerService that can drive all the Otter customization-based services in order to personalize the user experience. On its own, the service will do nothing and will need action handlers to register with the list of supported actions and their implementation.

Not only this allows for a better extensibility of the service, but it also keeps the number of imported module to the bare minimum for a lighter application.

Find more information on the Otter rules engine documentation.

Examples

Several examples of the rules engine usage are available on the following links:

Generators

Otter framework provides a set of code generators based on Angular schematics.

SchematicsDescriptionHow to use
addInclude Otter rules-engine module in a library / application.ng add @o3r/rules-engine
rules-engine-to-componentAdd rules-engine to an Otter componentng g rules-engine-to-component
facts-serviceGenerate a facts serviceng g facts-service
operatorsGenerate an operatorng g operator

Debug

A whole section of the Otter Chrome Devtool extension is dedicated to the debug of the rules engine with a visual representation of your Rulesets and a history of the run, conditions met and actions applied.

Find more information on the tool in the Otter Chrome Devtool extension documentation and its dedicated section in the rules engine documentation.

More details regarding the way the rules engine is working can be found in the documentation.
A live example is available in the Otter Showcase Application with reference to its code source.

Keywords

FAQs

Package last updated on 13 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc