Vect Functions enable the execution of logic to manipulate and interact with your parameters, enhancing your configuration management ✨.
Vect Hooks provide the ability to trigger those functions throughout the Configuration Change Lifecycle ♻️, on every configuration edit, pre-apply, and post-apply.
Functions contain the effects definition. They can be written in JSONata, Javascript (🔜), and Python (🔜)
Function runtime contains injected functionality to interact with the VectFS and configurations.
Functions can change data (Transformations) validate changes (Validations) or perform actions (Side Effects)
They can be ran by Hooks or buttons from Step widgets.
Functions are defined in the .vect/functions directory, the file name corresponds to the functionName property in the Hook definition.

To add a new Function, you can use the Vect Functions panel.
All functions receive the following arguments:
{
"changeEdits": Array<{
path: string;
liveContent: JSON; // full entry content before change
edit: JSON; // full entry content after change
editType: 'ADD' | 'DELETE' | 'MODIFY';
trigger: boolean // did it trigger the specific function
}>,
"metadata": {
"trigger": 'onEdit' | 'onApply' | 'postApply'; // the stage the current change is on
}
}
Transformations are functions of type data, and they can interact with the visible FS.
Transformation functions return an array of file edits:
Array<{ path: string; content: JSON }>;
In turn, those files will be created and modified in the file system.
Side Effects are functions of type action. Outputs of Side Effects are ignored. The only artifact they generate is their exit code, which is stored in the virtual FS and is used to track whether a function executed successfully.