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 宣告。只有在 maintainer 決定這是否屬於 engine,並且在接受的情況下形成一份範圍明確的儲存與評估設計後,才算完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, json
- 領域
- backend
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100