Detalhes do pacote

feelin

nikku139kMIT4.3.0

A FEEL parser and interpreter

readme (leia-me)

feelin

CI

A DMN FEEL parser and interpreter written in JavaScript. :arrow_right: Try it out.

Usage

import {
  unaryTest,
  evaluate
} from 'feelin';

unaryTest('1', { '?': 1 }); // true
unaryTest('[1..end]', { '?': 1, end: 10 }); // true

evaluate("Mike's daughter.name", {
  'Mike\'s daughter.name': 'Lisa'
}); // "Lisa"

evaluate('for a in [1, 2, 3] return a * 2'); // [ 2, 4, 6 ]

evaluate('every rate in rates() satisfies rate < 10', {
  rates() {
    return [ 10, 20 ];
  }
}); // false

Features

  • [x] Recognizes full FEEL grammar
  • [x] Context sensitive (incl. names with spaces)
  • [x] Recovers on errors
  • [x] Temporal types and operations
  • [x] Built-in FEEL functions
  • [ ] Full DMN TCK compliance

Build and Run

# build the library and run all tests
npm run all

# spin up for local development
npm run dev

# execute FEEL tests in DMN TCK
npm run tck

Related

License

MIT

changelog (log de mudanças)

Changelog

All notable changes to feelin are documented here. We use semantic versioning for releases.

Unreleased

_Note: Yet to be released changes appear here._

4.3.0

  • FEAT: improve date and time input validation (#102)

4.2.0

  • FEAT: support dependent evaluation inside InExpressions (#101)

4.1.0

4.0.0

  • FEAT: support matches built-in (#22, #96)
  • FEAT: improve pattern parsing for matches, replace, and split built-ins (#100, #96)
  • FIX: strictly parse regular expression flags (#99)
  • FIX: correct parsing of \r\n\t special characters (#97)

Breaking Changes

  • Special characters \r\n\t are now parsed in accordance with the DMN specification (#97).
  • Flags not supported by the DMN specification are no longer accepted (#99).

3.2.0

  • FEAT: support passing parser dialect (#86)
  • DEPS: update to lezer-feel@1.4.0

3.1.2

  • FIX: correctly get value not returning falsy values (#76)
  • FIX: correct addition of temporal and duration (#56)

3.1.1

  • FIX: use bankers round for decimal (#77)
  • DEPS: update to lezer-feel@1.2.9
  • DEPS: update to luxon@3.5.0
  • DEPS: update to @lezer/lr@1.4.2

3.1.0

  • FIX: properly handle unary test against 0 (#50)
  • DEPS: update to luxon@3.4.0
  • DEPS: update to lezer-feel@1.2.8

3.0.1

  • FIX: correct overriding of date and time and other built-ins (#62)
  • FIX: correct list indexing with variables (#59)
  • DEPS: update to lezer-feel@1.2.5

3.0.0

  • FEAT: report parse errors as SyntaxError, exposing additional details

2.3.0

  • FEAT: add duration ranges (#47)
  • FIX: correct floor and ceiling scale + invalid argument handling (fe1d458, c283cbe)

2.2.0

  • FEAT: add list replace built-in (#41)
  • FIX: correct time arithmentics (#43)
  • FIX: make is compare temporals strictly (#43)
  • FIX: correct local temporal type handling in UTC timezone (#43)
  • FIX: string serialize local time without offset (#43)
  • CHORE: execute DMN TCK tests against CI

2.1.0

  • FEAT: add overlaps built-in (0bf3020)
  • FEAT: add sort built-in (1330a940)
  • FEAT: add context merge built-in (79e21f6a)
  • FEAT: add context put built-in (89dc1b79)

2.0.0

  • FEAT: add string join built-in (#35)
  • FEAT: add context built-in (fcea4d6)
  • FEAT: add day of week, day of month, week of year and day of year built-ins (d408ac5)
  • FEAT: support number built-in (#19)
  • FEAT: guard functions against too many arguments (#12)
  • FEAT: ensure named var-arg is a list (2be53bd)
  • FEAT: support basic temporal arithmetics (#16, #31)

Breaking Changes

  • Variable argument functions must now declare variable parts via ...varArg syntax (8f21960).

1.2.0

  • DEPS: update to lezer-feel@1.2.0

1.1.0

  • FEAT: support distinct values built-in (#29)
  • FEAT: support union built-in (#30)
  • FEAT: support temporal ranges (#27, #15)
  • FIX: do not unbox path expression results on lists (#28)

1.0.1

  • FIX: correctly name cjs export (#26, #23)
  • DEPS: update to lezer-feel@1.0.2

1.0.0

  • FEAT: parse single expression rather than expressions
  • FIX: correct various spacing related evaluation bugs
  • DEPS: update to lezer-feel@1.0.0

Breaking Changes

  • We now parse a single expression rather than a list of expressions. The result is the actual value, not a list of values.

0.45.0

  • FEAT: return null on non-function invocations
  • DEPS: update dependencies

0.44.1

  • FIX: correct path extraction filtering null values

0.44.0

  • DEPS: update to lezer-feel@0.17.0

0.43.1

  • FIX: correctly handle comparison with null (#20)
  • FIX: filter null values when path shorthand filtering (#21)
  • FIX: correct parsing of IfExpression (required else block)
  • DEPS: bump to lezer-feel@0.16.1

0.43.0

  • FEAT: properly parse List shape
  • DEPS: bump to lezer-feel@0.16.0

0.42.0

  • DEPS: bump to lezer-feel@0.15.0

0.41.0

  • DEPS: bump to lezer-feel@0.13.0

0.40.0

  • FEAT: preserve context names
  • FIX: safely stringify functions
  • FIX: coerce path expression value to singleton
  • DEPS: bump to lezer-feel@0.12.1

0.39.0

  • FEAT: generate ES2015 bundle
  • DEPS: update to lezer-feel@0.11.1

0.38.0

  • FEAT: generate sourcemaps
  • DEPS: update to lezer-feel@0.11.0

0.37.1

  • FIX: coerce incompatible InExpression input to null

0.37.0

  • FEAT: make InExpressions null-safe

0.36.0

  • FEAT: add + string concatenation
  • FEAT: support path on scalars (returning null)

0.35.2

  • FIX: correct is argument handling

0.35.1

  • FIX: actually parse that shit

0.35.0

  • FEAT: parse unicode escape sequences (#5)
  • FIX: correct string escaping

0.34.0

  • FIX: parse positional arguments inside functions

0.33.0

  • FEAT: support temporal functions (#13)
  • FEAT: implement string for temporals
  • FEAT: type cast built-ins
  • FIX: do not unbox values in ArithmeticException
  • DEPS: bump to lezer-feel@0.9.1

0.32.0

  • FEAT: implement range type (#6, #10, #11)
  • FEAT: implement first round of range builtins
  • FEAT: implement is builtin

0.31.0

  • FEAT: support tests in ForExpression
  • FEAT: implement stddev
  • FEAT: implement mode
  • FEAT: implement median
  • FIX: correct log invalid argument handling
  • FIX: correct odd negative argument handling
  • FIX: handle modulo invalid divisor argument
  • FIX: correct split argument name
  • FIX: correct string escaping behavior
  • FIX: correct type + unboxing behavior in ArithmenticExpression
  • FIX: correct null handling in Conjunction and Disjunction
  • FIX: correct equality null handling

0.30.0

  • FEAT: implement FEEL equality check
  • FIX: correct filter on non lists
  • FIX: correct various built-in issues (argument names, ...)
  • FIX: annotate built-in list functions

0.29.0

  • FEAT: support named function invocation (#1)

0.28.0

  • FEAT: support FunctionDefinition
  • DEPS: bump to lezer-feel@0.8.8

0.27.0

  • FEAT: support context sensitive parsing
  • FEAT: support incremental context definition
  • DEPS: bump to lezer-feel@0.8.0

Breaking Changes

  • Simplified interpreter API: No more parsed context is returned

0.26.0

  • CHORE: improve typings
  • DEPS: bump to lezer-feel@0.6.0

0.25.0

  • CHORE: add typings
  • DEPS: bump to lezer-feel@0.5
  • DEPS: bump to lezer@1

0.24.0

  • CHORE: build upon lezer-feel

...

Undocumented releases