CacheControl / CacheControl/json-rules-engine
Declarative way for compute facts
- Linguagem predominante
- JavaScript
- Estrelas
- 3.1k
- Forks
- 507
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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? 🙂
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Nenhum arquivo-fonte ou teste é mencionado. Comece revisando a discussão da documentação sobre computed facts e a abordagem existente de addFact/function; em seguida, compare a declaração proposta em json-logic para facts derivados reutilizáveis. O trabalho estará concluído quando um maintainer decidir se isso pertence ao engine e, se for aceito, houver um design delimitado para armazenamento e avaliação.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript, json
- Domínio
- backend
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 25/100