Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ npm install @camunda/feel-builtins

## Usage

This package exports multiple collections of FEEL builtins:

* **`camundaBuiltins`**: Collection of builtins of camunda scala FEEL.
* **`feelBuiltins`**: List of standard FEEL built-in functions (excluding Camunda-specific extensions).
* **`camundaExtensions`**: List of FEEL camunda extensions.
* **`camundaReservedNameBuiltins`**: Functions using reserved keywords in their name and need to be added to the parser context during parsing.

You can feed built-ins as context into your favorite [FEEL editor](#feel-editor) or [validator](#feel-lint).

### Feel Editor

In your [FEEL editor](https://github.com/bpmn-io/feel-editor) you can use these builtins to establish the Camunda context:
Expand All @@ -29,6 +38,17 @@ const editor = new FeelEditor({
});
```

If you only want standard FEEL functions, use `feelBuiltins` instead:

```js
import { feelBuiltins } from '@camunda/feel-builtins';

const editor = new FeelEditor({
container,
builtins: feelBuiltins
});
```

### Feel Lint

With [@bpmn-io/feel-lint](https://github.com/bpmn-io/feel-lint) you can also use the builtins to lint expressions in the Camunda world:
Expand Down
25 changes: 21 additions & 4 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
/**
* A collection of builtin of FEEL.
* Collection of builtins of camunda scala FEEL.
*/
export const camundaBuiltins: Builtin[];

/**
* List of standard FEEL built-in functions (excluding Camunda-specific extensions).
*/
export const feelBuiltins: Builtin[];

/**
* List of FEEL camunda extensions.
*/
export const camundaExtensions: Builtin[];

/**
* Camunda built-ins that use reserved keywords in their name and thus must
* be explicitly declared when parsing FEEL.
*/
export const camundaReservedNameBuiltins: Builtin[];

export type Builtin = {
/**
* The name of the builtin function.
Expand All @@ -12,11 +29,11 @@ export type Builtin = {
*/
info: string;
/**
* type of the builtin, always 'function' for builtin functions.
* Type of the builtin, always 'function' for builtin functions.
*/
type?: "function";
type?: 'function';
/**
* function parameters.
* Function parameters.
*/
params?: Array<{
name: string;
Expand Down
50 changes: 50 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"compile-builtins": "node tasks/compileBuiltins.js"
},
"devDependencies": {
"@bpmn-io/lezer-feel": "^2.2.1",
"@types/chai": "^5.2.2",
"@types/mocha": "^10.0.10",
"@types/node": "^24.0.0",
Expand Down
Loading