2.1.1 • Published 2 months ago

@swimlane/turbine-transformations v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Turbine Transformations

Transformation functions for use within Turbine.

Install

npm i @swimlane/turbine-transformations

Building

npm run build

Testing

npm run test

Usage

In order to utilize the transformation functions, you will first need to instantiate an evaluator. The only evaluators that are currently supported are a Native evaluator and a JSONata evaluator. The JSONata evaluator allows the transformation functions to be invoked from within JSONata expressions and the Native evaluator allows the transformation functions to be invoked directly (i.e. no intermediate expression language) via the same abstraction (i.e. the TransformationEvaluator abstraction).

Due to a limitation with JSONata, functions can only be accessed via their namespaced-concatenated names. That is, by concatenating the function's namespace with the function's capitalized name. For example: date.adjust -> dateAdjust.

JSONata

const evaluator = new JSONataEvaluator();
const context: TransformationContext<JSONataInput> = {
  input: {
    expression: `$dateAdjust(date, 5, 'days')`,
    data: {
      date: new Date(Date.now()).toISOString()
    }
  }
};
const result = await evaluator.evaluate(context) as string;

Native

const evaluator = new NativeEvaluator();
const context: TransformationContext<NativeInput> = {
  input: {
    function: 'dateAdjust',
    arguments: [new Date(Date.now()).toISOString(), 5, 'days']
  }
};
const result = await evaluator.evaluate(context) as string;
2.1.1

2 months ago

2.1.0

4 months ago

2.0.0

4 months ago

1.1.1

5 months ago

1.1.0

5 months ago

1.0.13

5 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.12

7 months ago

1.0.9

12 months ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago