FileTransform
This plugin is currently in beta. While it is considered safe for use, please be aware that its API could change in ways that are not compatible with earlier versions in future releases, or it might become unsupported.
Execute a JavaScript script using the GraalVM scripting engine.
yaml
type: "io.kestra.plugin.graalvm.js.FileTransform"
yaml
id: transformJs
namespace: company.team
tasks:
- id: download
type: io.kestra.plugin.core.http.Download
uri: https://dummyjson.com/carts/1
- id: jsonToIon
type: io.kestra.plugin.serdes.json.JsonToIon
from: "{{outputs.download.uri}}"
- id: transformJs
type: io.kestra.plugin.graalvm.js.FileTransform
from: "{{ outputs.jsonToIon.uri }}"
script: |
if (row['id'] === 666) {
// remove un-needed row
row = null
} else {
// remove the 'products' column
row['products'] = null;
// add a 'totalItems' column
row['totalItems'] = row['totalProducts'] * row['totalQuantity']
}
Dynamic
YES
Source file containing rows to transform.
Can be a Kestra internal storage URI, a map or a list.
Dynamic
YES
The script to evaluate
Dynamic
YES
Number of concurrent parallel transformations to execute.
Take care that the order is not respected if you use parallelism.
Format
uri
URI of a temporary result file.
The file will be serialized as an ION file.