feat(templates): add utility functions for template variable generation

- Implement new utility functions in template processing
- Add support for generating UUID, timestamp, and random port
- Extend template variable processing capabilities
This commit is contained in:
Mauricio Siu 2025-03-09 21:18:05 -06:00
parent 53312f6fa7
commit a45af37b5d

View File

@ -84,6 +84,18 @@ function processValue(
const length = Number.parseInt(varName.split(":")[1], 10) || 8;
return generateHash(length);
}
if (varName === "uuid") {
return crypto.randomUUID();
}
if (varName === "timestamp") {
return Date.now().toString();
}
if (varName === "randomPort") {
return Math.floor(Math.random() * 65535).toString();
}
// If not a utility function, try to get from variables
return variables[varName] || match;
});