Skip to content

Commit d1d7bbf

Browse files
authored
Merge pull request #955 from camunda/release-1.19.0
[Release] 1.19.0
2 parents 2b14822 + e0afbd1 commit d1d7bbf

27 files changed

+1296
-5
lines changed

docs/docs/changelog/changelog.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,24 @@ This page contains an overview of the released versions and highlights the major
1010
point of view (i.e. focus on features). The complete changelog, including the patch
1111
versions, can be found on the [GitHub release page](https://github.com/camunda/feel-scala/releases).
1212

13+
## 1.19
14+
15+
<MarkerChangelogVersion versionZeebe="8.7.0" versionC7="not yet" />
16+
17+
**Built-in functions:**
18+
19+
* New built-in
20+
function `is blank()`
21+
to check if a string is blank
22+
* New built-in
23+
function `partition()`
24+
to split a list in sublists of the same size
25+
26+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.19.0).
27+
1328
## 1.18
1429

15-
<MarkerChangelogVersion versionZeebe="8.6.0" versionC7="not yet" />
30+
<MarkerChangelogVersion versionZeebe="8.6.0" versionC7="7.23.0" />
1631

1732
**Built-in functions:**
1833

docs/docusaurus.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,18 @@ module.exports = {
9696
// includes the unreleased version
9797
includeCurrentVersion: true,
9898
// the last released (stable) version
99-
lastVersion: '1.18',
99+
lastVersion: '1.19',
100100
// override the config for specific versions
101101
versions: {
102102
// for the unreleased version
103103
current: {
104104
// add the postfix "unreleased"
105-
label: '1.19 (unreleased)'
105+
label: '1.20 (unreleased)'
106106
},
107107
// for all supported versions: disable the "unmaintained version" banner
108+
'1.18': {
109+
banner: 'none',
110+
},
108111
'1.17': {
109112
banner: 'none',
110113
},
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
id: changelog
3+
title: Changelog
4+
slug: /changelog/
5+
---
6+
7+
import MarkerChangelogVersion from "@site/src/components/MarkerChangelogVersion";
8+
9+
This page contains an overview of the released versions and highlights the major changes from a user
10+
point of view (i.e. focus on features). The complete changelog, including the patch
11+
versions, can be found on the [GitHub release page](https://github.com/camunda/feel-scala/releases).
12+
13+
## 1.19
14+
15+
<MarkerChangelogVersion versionZeebe="8.7.0" versionC7="not yet" />
16+
17+
**Built-in functions:**
18+
19+
* New built-in
20+
function `is blank()`
21+
to check if a string is blank
22+
* New built-in
23+
function `partition()`
24+
to split a list in sublists of the same size
25+
26+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.19.0).
27+
28+
## 1.18
29+
30+
<MarkerChangelogVersion versionZeebe="8.6.0" versionC7="7.23.0" />
31+
32+
**Built-in functions:**
33+
34+
* New built-in
35+
function `is empty()`
36+
to check if a list is empty
37+
* New built-in
38+
function `trim()`
39+
to remove leading and trailing spaces of a string
40+
* New built-in
41+
function `uuid()`
42+
to create a UUID (Universally Unique Identifier)
43+
* New built-in
44+
function `to base64()`
45+
to encode a string in Base64 format
46+
47+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.18.0).
48+
49+
## 1.17
50+
51+
<MarkerChangelogVersion versionZeebe="8.3.0" versionC7="7.21.0" />
52+
53+
**Expressions:**
54+
55+
* Overhauled error handling. Instead of failing the evaluation, for example, because of a non-existing
56+
variable or context entry, it handles these cases and returns `null`.
57+
58+
**Built-in functions:**
59+
60+
* New built-in
61+
function [duplicate values()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-list#duplicate-valueslist)
62+
to find duplicate list items
63+
* New built-in
64+
function [get or else()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-boolean#get-or-elsevalue-default)
65+
to handle `null` values
66+
* New built-in
67+
function [assert()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-boolean#assertvalue-condition)
68+
to fail the evaluation if a condition is not met
69+
70+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.17.0).
71+
72+
## 1.16
73+
74+
<MarkerChangelogVersion versionZeebe="8.2.0" versionC7="7.20.0" />
75+
76+
77+
**Built-in functions:**
78+
79+
* New built-in function [get value()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-context#get-valuecontext-keys) to access a context with a dynamic path
80+
* New built-in function [context put()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-context#context-putcontext-keys-value) to insert a nested value in a context
81+
* New built-in function [last day of month()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-temporal#last-day-of-monthdate) to get the last day of a month
82+
* New built-in function [date and time()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-conversion#date-and-timedate-timezone) to get a date-time for a timezone
83+
* New built-in function [random number()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-numeric#random-number) to get a random number
84+
85+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.16.0).
86+
87+
## 1.15
88+
89+
<MarkerChangelogVersion versionZeebe="8.1.0" versionC7="7.19.0" />
90+
91+
**Expressions:**
92+
93+
* New `@` notation for [temporal literals](https://docs.camunda.io/docs/components/modeler/feel/language-guide/feel-temporal-expressions#literal)
94+
95+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.15.0).
96+
97+
## 1.14
98+
99+
<MarkerChangelogVersion versionZeebe="1.3.1" versionC7="7.18.0" />
100+
101+
**Built-in functions:**
102+
103+
* New function [extract()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-string#extractstring-pattern)
104+
that applies a regular expression to a given a string
105+
* New
106+
function [string join()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-list#string-joinlist)
107+
that merges a list of strings into a single string
108+
* New [range functions](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-range) to compare
109+
ranges and scalar values
110+
* New functions to round numeric values:
111+
* [round up()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-numeric#round-upn-scale)
112+
* [round down()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-numeric#round-downn-scale)
113+
* [round half up()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-numeric#round-half-upn-scale)
114+
* [round half down()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-numeric#round-half-downn-scale)
115+
* Extend function [abs()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-temporal#absn) for
116+
duration values
117+
118+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.14.0).
119+
120+
## 1.13
121+
122+
<MarkerChangelogVersion versionZeebe="1.0.0" versionC7="7.15.0" />
123+
124+
**Expressions:**
125+
126+
* Access the property [weekday](https://docs.camunda.io/docs/components/modeler/feel/language-guide/feel-temporal-expressions#properties)
127+
of date and date-time values
128+
* Allow escape sequences in [string literals](https://docs.camunda.io/docs/components/modeler/feel/language-guide/feel-data-types#string)
129+
130+
**Built-in functions:**
131+
132+
* New
133+
function [context()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-conversion#contextentries)
134+
that creates a context from a given key-value list
135+
* New function [put()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-context#context-putcontext-key-value) that
136+
extends a context by a given entry
137+
* New
138+
function [put all()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-context#context-mergecontexts)
139+
that merges the given contexts
140+
141+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.13.0).
142+
143+
## 1.12
144+
145+
<MarkerChangelogVersion versionZeebe="0.25.0" versionC7="7.14.0" />
146+
147+
**Built-in functions:**
148+
149+
* New function [now()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-temporal#now) that
150+
returns the current date-time
151+
* New function [today()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-temporal#today)
152+
that returns the current date
153+
* New
154+
function [week of year()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-temporal#week-of-yeardate)
155+
that returns the number of the week within the year
156+
* New
157+
function [month of year()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-temporal#month-of-yeardate)
158+
that returns the name of the month
159+
* New
160+
function [day of week()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-temporal#day-of-weekdate)
161+
that returns name of the weekday
162+
* New
163+
function [day of year()](https://docs.camunda.io/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-temporal#day-of-yeardate)
164+
that returns the number of the day within the year
165+
166+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.12.0).
167+
168+
169+
## 1.11
170+
171+
<MarkerChangelogVersion versionZeebe="0.23.0" versionC7="7.13.0" />
172+
173+
**Expressions:**
174+
175+
* Access the [element of a list](https://docs.camunda.io/docs/components/modeler/feel/language-guide/feel-list-expressions#get-element) using a numeric variable
176+
* Disable external functions by default for security reasons
177+
178+
See the full changelog [here](https://github.com/camunda/feel-scala/releases/tag/1.11.0).
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
id: bootstrapping
3+
title: Bootstrapping
4+
---
5+
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
9+
The FEEL engine can be integrated in two different ways
10+
* as a library by calling the engine API
11+
* as a script engine by using the Java's script engine API
12+
13+
:::tip
14+
15+
Have a look at the [FEEL Playground](/playground/playground.mdx) for trying out FEEL expressions quickly in
16+
development.
17+
18+
:::
19+
20+
### The dependency
21+
22+
Add the engine as dependency to your project's `pom.xml`:
23+
24+
```xml
25+
<dependency>
26+
<groupId>org.camunda.feel</groupId>
27+
<artifactId>feel-engine</artifactId>
28+
<version>${VERSION}</version>
29+
</dependency>
30+
```
31+
32+
Or, download the [JAR file](https://github.com/camunda/feel-scala/releases) _(feel-engine-${VERSION}-complete.jar)_ and copy it into your application.
33+
34+
### Use as a library
35+
36+
The FEEL engine provides APIs to parse and evaluate expressions and unary-tests.
37+
38+
<Tabs
39+
defaultValue="scala"
40+
values={[
41+
{label: 'Scala', value: 'scala'},
42+
{label: 'Java', value: 'java'},
43+
]}>
44+
45+
<TabItem value="scala">
46+
47+
Create a new instance of the class `FeelEngine`.
48+
49+
```scala
50+
object MyProgram {
51+
52+
val engine = new FeelEngine
53+
54+
def feel(expression: String, context: Map[String, Any]) {
55+
56+
val result: Either[Failure, Boolean] = engine.evalUnaryTests(expression, context)
57+
// or
58+
val result: Either[Failure, Any] = engine.evalExpression(expression, context)
59+
60+
// handle result
61+
result
62+
.right.map(value => println(s"result is: $value"))
63+
.left.map(failure => println(s"failure: $failure"))
64+
}
65+
}
66+
```
67+
68+
Use the constructor arguments to configure the engine.
69+
70+
```scala
71+
new FeelEngine(configuration = Configuration(externalFunctionsEnabled = true))
72+
```
73+
74+
</TabItem>
75+
<TabItem value="java">
76+
77+
Use the builder to create a new instance of the class `FeelEngine`.
78+
79+
```java
80+
public class MyProgram {
81+
82+
public static void main(String[] args) {
83+
84+
final FeelEngine engine = new FeelEngine.Builder()
85+
.valueMapper(SpiServiceLoader.loadValueMapper())
86+
.functionProvider(SpiServiceLoader.loadFunctionProvider())
87+
.build();
88+
89+
final Map<String, Object> variables = Map.of("x", 21);
90+
final Either<FeelEngine.Failure, Object> result = engine.evalExpression(expression, variables);
91+
92+
if (result.isRight()) {
93+
final Object value = result.right().get();
94+
System.out.println("result is " + value);
95+
} else {
96+
final FeelEngine.Failure failure = result.left().get();
97+
throw new RuntimeException(failure.message());
98+
}
99+
}
100+
}
101+
```
102+
103+
Use the builder to configure the engine.
104+
105+
```java
106+
new FeelEngine.Builder().enableExternalFunctions(true).build()
107+
```
108+
109+
</TabItem>
110+
</Tabs>
111+
112+
113+
:::danger Security
114+
External functions are disabled by default. They would allow calling arbitrary
115+
code or accessing sensitive data. It is recommended to use the
116+
[FunctionProvider API](function-provider-spi.md) instead.
117+
:::
118+
119+
### Use as script engine
120+
121+
Calling the FEEL engine via Java's script engine
122+
API ([JSR 223](https://www.jcp.org/en/jsr/detail?id=223)).
123+
124+
```scala
125+
object MyProgram {
126+
127+
val scriptEngineManager = new ScriptEngineManager
128+
129+
def feel(script: String, context: ScriptContext) {
130+
131+
val scriptEngine: FeelScriptEngine = scriptEngineManager.getEngineByName("feel")
132+
133+
val result: Object = scriptEngine.eval(script, context)
134+
// ...
135+
}
136+
137+
}
138+
```
139+
140+
The engine is registered under the following names:
141+
142+
* `feel`
143+
* `http://www.omg.org/spec/FEEL/20140401` (FEEL namespace)
144+
* `feel-scala`
145+
146+
To evaluate a unary-tests expression, use one of the following names:
147+
148+
* `feel-unary-tests`
149+
* `feel-scala-unary-tests`
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
id: developer-guide-introduction
3+
title: Introduction
4+
slug: /developer-guide/
5+
---
6+
7+
You can embed the FEEL engine in your application in different ways. Have a look
8+
at [Bootstrapping](bootstrapping.md) to see how.
9+
10+
Afterward, you can extend and customize the FEEL engine by implementing one of the following
11+
SPIs (Service Provider Interface):
12+
13+
* [Function Provider SPI](function-provider-spi.md)
14+
* [Value Mapper SPI](value-mapper-spi.md)
15+
* [Clock SPI](feel-engine-clock-spi.md)

0 commit comments

Comments
 (0)