Is your feature improvement request related to a problem? Please describe.
It is common to create a self-contained flow which includes both the flow definition file (e.g. flow.toml) and any related JavaScript code.
When packaging a flow, it is helpful to package the flow into a folder so that all of the files are self-contained and so that it is easier to identify which files belong to which flow.
Currently, if a flow's files are put under a nested directory, the flow's script paths need to be updated to reflect the nested hierarchy which is difficult to manage, and makes the flow less portable/flexible.
Describe the solution you'd like
A flow definition file (e.g. flow.toml) should be able to use relative paths when referencing JavaScript files, but the path should be relative to the flow definition file.
Having the script's path being relative to the flow definition file allows for more flexible packaging options where the "script" property does not need to be changed if the flow's files are moved into nested folders.
For example, below is an example flow definition file using a relative path to the "main.js" JavaScript file.
File: flow.toml
# example flow
input.mqtt.topics = ["foo"]
[[steps]]
script = "main.js"
Then, a flow could be installed at any nested level (as long as the JavaScript is kept alongside the flow.toml file). Below shows the example flow being stored in two different ways, and the relative path is still valid in each case:
tree /etc/tedge/mappers
└── flows
└── flows
├── example
│ ├── flow.toml
│ └── main.js
└── foo
└── example
├── flow.toml
└── main.js
Note: A flow definitions should still be able to support absolute paths
Describe alternatives you've considered
Additional context
Is your feature improvement request related to a problem? Please describe.
It is common to create a self-contained flow which includes both the flow definition file (e.g. flow.toml) and any related JavaScript code.
When packaging a flow, it is helpful to package the flow into a folder so that all of the files are self-contained and so that it is easier to identify which files belong to which flow.
Currently, if a flow's files are put under a nested directory, the flow's script paths need to be updated to reflect the nested hierarchy which is difficult to manage, and makes the flow less portable/flexible.
Describe the solution you'd like
A flow definition file (e.g. flow.toml) should be able to use relative paths when referencing JavaScript files, but the path should be relative to the flow definition file.
Having the script's path being relative to the flow definition file allows for more flexible packaging options where the "script" property does not need to be changed if the flow's files are moved into nested folders.
For example, below is an example flow definition file using a relative path to the "main.js" JavaScript file.
File: flow.toml
Then, a flow could be installed at any nested level (as long as the JavaScript is kept alongside the flow.toml file). Below shows the example flow being stored in two different ways, and the relative path is still valid in each case:
Note: A flow definitions should still be able to support absolute paths
Describe alternatives you've considered
Additional context