JS Scripting: sending a TimeSeries to an item

using OH5.0.2 on docker.

as described in Understanding "selfmade" timeseries: states not changing for future persisted states - #14 by binderth, I’m searching for a way to store TimeSeries information on a item.
This works in JRuby:

min1 = Time.now + 1.minute
min2 = Time.now + 2.minute
min3 = Time.now + 3.minute

# create and populate a TimeSeries object
ts_data = TimeSeries.new
                    .add(min1, DecimalType.new(1))
                    .add(min2, DecimalType.new(2))
                    .add(min3, DecimalType.new(3))

# Send it to the item
TimeSeriesItem.time_series = ts_data

The docs ( JavaScript Scripting - Automation | openHAB) are using the “wrong” way, they only update persistence, but not the TimeSeries of an item, resulting in “just showing the states” in a chart, but not changing the states if the timestamps are reached:

var timeSeries = new items.TimeSeries('ADD'); // Create a new TimeSeries with policy ADD
timeSeries.add(time.toZDT('2024-01-01T14:53'), Quantity('5 m')).add(time.toZDT().minusMinutes(2), Quantity('0 m')).add(time.toZDT().plusMinutes(5), Quantity('5 m'));
console.log(ts); // Let's have a look at the TimeSeries
items.getItem('MyDistanceItem').persistence.persist(timeSeries, 'influxdb'); // Persist the TimeSeries for the Item 'MyDistanceItem' using the InfluxDB persistence service

So, I’m looking for the equivalent of JRuby’s TimeSeriesItem.time_series = ts_data in JS Scripting, to not bypass the TimeSeries part of an item.