How to create Sparkplug UDT definitions using Node-red / Nodejs

"Hello!

I need to generate UDT definitions (templates) for MQTT Engine, using scripts or JSON formatting with Node-RED's Sparkplug B nodes. Is there a way to achieve this, and if so, what's the best method? I haven't been able to find information on this in the Sparkplug B or MQTT Engine documentation. Thank you."

I am using the eclipse tahu code base. You can check the example code here: tahu/javascript/examples/simple/example.js at 5736e404889d4b95910613040a99ba79589ffb13 · eclipse-tahu/tahu · GitHub

Or here is a brief description:

UDT definition:

{
    name: "Template1"
    type: "Template",
    value: {
      isDefinition: true,
      metrics: [/* UDT members */],
    },
}

UDT instance:

{
    name: "TemplateInstance1"
    type: "Template",
    value: {
      templateRef: "Template1",
      isDefinition: false,
      metrics: [/* UDT members */]],
    },
}

Thanks for your help. I will do the tests and post the results here, whether successful or not.