npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mostajs/rules-trigger-editor

v0.0.1

Published

Éditeur + moteur de configuration ECA (Événement → Condition → Action) générique, façon Drupal Rules+Trigger+Workflow. Registres déclaratifs events/conditions/actions, data-selectors, config persistée (DI ORM), export/import JSON, demi-workflow (états/tra

Readme

@mostajs/rules-trigger-editor

Auteur : Dr Hamid MADANI [email protected] · Licence : AGPL-3.0-or-later

Éditeur + moteur de configuration ECA (Événement → Condition → Action) générique et réutilisable, façon Drupal Rules + Trigger + Workflow : un administrateur configure « quand ceci, si cela, alors fais cela » sans toucher au code. Compose les moteurs @mostajs/{rules, trigger, statemachine, workflow, graph-editor} (par injection) ; n'apporte que les registres déclaratifs, les data-selectors, la persistance de config, le demi-workflow (états / transitions / historique / planifiées) et l'éditeur hybride (graphe + formulaires). Autosuffisant (sans @mostajs/socle).

Statut : 0.0.1 (scaffold) — types + registres + selectors + schémas rte_* + RuleStore (CRUD/validate/export). Runtime (compileRule), éditeur ./client et export UPPERCASE : jalons suivants. Livrables DEVRULES #1–#3 dans docs/. API dense : llms.txt.

Concepts

  • Registres déclaratifs : l'app hôte déclare son catalogue d'events / conditions / actions.
  • Règle : ON event(s) → IF (arbre AND/OR/NOT) → DO (actions ordonnées, +loop).
  • Data-selector : un paramètre vaut un littéral ({mode:"input"}) ou un chemin dans le contexte ({mode:"select", path:"order:customer:email"}).
  • Demi-workflow (optionnel) : états + transitions config + historique exécuté + transitions planifiées.

Usage (serveur)

import {
  defineEvent, defineCondition, defineAction, RuleStore, RTE_SCHEMAS,
} from "@mostajs/rules-trigger-editor";

// 1) L'app déclare SON catalogue (runtime)
defineEvent({ key: "order.assigned", label: "Commande assignée", variables: { order: { type: "entity:order", label: "Commande" } } });
defineCondition({ key: "order.state.is", label: "L'état de la commande est…", params: { state: { type: "text", label: "État" } } });
defineAction({ key: "notify_user", label: "Notifier l'utilisateur", params: { message: { type: "text", label: "Message" } } });

// 2) Persistance (dialecte ORM injecté ; ajouter RTE_SCHEMAS au registre de schémas de l'app)
const store = new RuleStore(dialect);

// 3) Définir et valider une règle
const rule = {
  name: "auto_notify", label: "Notifier à l'assignation", active: true, weight: 0,
  on: [{ event: "order.assigned" }],
  if: { type: "and", children: [ { type: "condition", name: "order.state.is", params: { state: { mode: "input", value: "nouvelle" } } } ] },
  do: [ { type: "action", name: "notify_user", params: { message: { mode: "select", path: "order:number" } } } ],
};
const check = store.validateRule(rule);     // { ok, errors[] } — refuse events/conditions/actions inconnus
if (check.ok) await store.saveRule(rule);

// 4) Export / import portable
const json = await store.exportJson();
await store.importJson(json);

Vérification / exemple

examples/traffic-lights/gestion des feux d'un croisement pilotée 100 % par des règles ECA, avec le graphe des phases édité via @mostajs/graph-editor (DEVRULES §12). Headless : node examples/traffic-lights/sim.mjs (cycle + 4 assertions, invariant « jamais deux axes au vert »). Navigateur : bash examples/traffic-lights/sync-vendor.sh puis servir le dossier.

examples/rule-builder/éditeur ./client en action : <RuleEditor> (formulaires ON/IF/DO) + <StatesGraph> (graphe @mostajs/graph-editor) + aperçu config UPPERCASE en direct.

Architecture (composition — règle d'or)

Conditions → @mostajs/rules · Exécution + scheduler → @mostajs/trigger · États → @mostajs/ statemachine + @mostajs/workflow · UI graphe → @mostajs/graph-editor · Persistance → @mostajs/orm (DI) · Trace → @mostajs/audit. Aucune de ces capacités n'est réimplémentée.

Peers (tous optionnels sauf @mostajs/orm) : voir package.json. Tables NEUVES rte_* (pas d'ALTER).