CacheControl / CacheControl/json-rules-engine
Declarative way for compute facts
- 主要言語
- JavaScript
- スター
- 3.1k
- フォーク
- 507
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi! I consider this repo as a very helpful design approach! I'm looking forward and have thoughts about admin interface for editing and storing rules. But i think we have a lack of ability for storing complex computed facts. For example, i have a a big legacy system underneath my app, and some facts from there have a big value because they computes from multiple fields of big json document. I need to reuse that facts everywhere in my app. What can i do right now? I can use only functions for this objectives. Like this:
```
engine.addFact('account', (params, almanac) => {
return almanac.bigDoc.path1.value + almanac.bigDoc.path2.value;
})
```
Ok, it's very flex and this approach cover all my needs, except storing.
My suggest:
We can use [jsonLogic library ](https://github.com/jwadhams/json-logic-js/) (or similar operators inside this repo) for declaring facts like this:
```
new Fact('derivedFact', [ 'bigDoc' ], { '+' : [
{ 'var' : 'bigDoc.path1.value' },
{ 'var' : 'bigDoc.path2.value' },
]}
)
```
While i was browsing docs, i saw that you considered this as a design bad smell. Why? Can you explain? Or i can suggest PR? 🙂
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
ソースファイルもテストも指定されていません。まず、computed facts に関するドキュメントの説明と既存の addFact/function アプローチを確認し、次に再利用可能な派生 facts のために提案されている json-logic 宣言と比較してください。完了とみなすには、これを engine に含めるべきかどうかについて maintainer の判断があり、受け入れられる場合は、保存と評価に関する範囲を限定した設計が必要です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, json
- 領域
- backend
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100