@codeeffects/repository - npm
Files
- codeeffects.repository.js
- codeeffects.repository.common.css
- codeeffects.repository.light.css
- codeeffects.repository.dark.css
This package is the client side of the Rule Repository (RR). You need it only if your application uses the Rule Repository .NET library and has its license. A stand-alone Rule Editor does not use it.
RR is a self-contained web component. Given an empty element on your page, it draws everything inside it: the tabs, grids, filters, paging, sorting, dialogs, and the Rule Editor instances in which users create and change rules. RR keeps no data of its own. Whenever it needs something, such as a page of a grid, the options of a drop-down list, the details of a record, a save, or a delete, it builds a request, serializes it to a JSON string, and hands the string to a callback function that you provide. Your callback posts the string to your own Repository endpoint, which passes it to the Repository library on the server, and returns the JSON string that the library produces. RR never contacts a server by itself.
The script is an ES module. It declares the CodeEffects.Rule.Repository namespace and exports it as $repo. Unlike the editor's $rule and $ce, $repo is not a global variable; the script adds nothing to the global object except the CodeEffects namespace itself. Reference it as a module script and read the namespace, or import $repo from the module:
<script type="module" src="codeeffects.editor.js"></script>
<script type="module" src="codeeffects.repository.js"></script>
<script type="module" src="your-page.js"></script>
// In your-page.js, which loads after both modules
const $repo = CodeEffects.Rule.Repository;
// Or, in a module that bundles the script
import { $repo } from "./codeeffects.repository.js";
Module scripts run in the order written once the page is parsed, so a script listed after the other two finds both in place.
RR needs the Rule Editor script (codeeffects.editor.js) on the same page: every rule RR shows is a Rule Editor, and the date range filter draws the editor's calendar. The two scripts can be referenced in any order. Load the stylesheets of both packages: the common stylesheet and one of the light or dark themes for each.
RR assumes the user is signed in to your application. It has no sign-in of its own, so the endpoint your callback posts to must require your application's sign-in. The Rule Storage in Rule Repository article describes what RR stores and how your application gets the live rules back.