@swimlane/turbine-transformations
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

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;

Package Sidebar

Install

npm i @swimlane/turbine-transformations

Weekly Downloads

466

Version

2.1.1

License

MIT

Unpacked Size

317 kB

Total Files

96

Last publish

Collaborators

  • ajaypalswimlane
  • adityagonnade
  • ashraygupta
  • prasanthsaiboyina
  • abhiswimlane0410
  • varsha_swimlane
  • kodalipraveen
  • mohanalakshmi.s
  • nikshithkolan
  • steveblue
  • kasiviswanathan.mangudi
  • koushik.kumar
  • dmytro_skorokhodov
  • melissa.vankempen
  • sasha.polishchuk
  • dabbott-sl
  • daniel.selig
  • jogaj_26
  • markcoleman1
  • caleb.bass
  • hansstoetzer
  • sarath.pantula
  • nikkuman
  • agustin.firpo
  • tmcclure
  • ischultz-swimlane
  • bensteele7
  • brantw
  • marjan-georgiev
  • danstory
  • seangrimes
  • adamfrank
  • bageldawg
  • it.admin.swim
  • smartinski
  • lisa-reynolds
  • royar95
  • mr_charlie
  • swimlane.dev