Api to compress Timeseries data


Is there a method that can be called on a Timeseries that will return a new Timeseries which its data compressed/optimized? For example, the following will produce a Timeseries with ts.optimizedData() == [1]:

var ts = PiTag.evalMetric({
    id: 'test',
    expression: 'identity(1)',
    start: '2019-01-01',
    end: '2019-01-10',
    interval: 'MINUTE'

// 1

however, manually creating a Timeseries as such will produce a non-optimized Timeseries:

function constArray(cValue, length) {
  var result = new Array(length);

  for (var i = 0; i < length; ++i) {
      result[i] = cValue;

  return (result);

var start = "2019-01-01",
  end = "2019-01-10",

ts2 = Timeseries.makeNorm(NormTimeseriesDoubleSpec.make({
  "start": start,
  "end": end,
  "interval": "MINUTE",
  "data": constArray(1, 12960),
  "missing": constArray(0, 12960)

// 12960

Seems like the expression engine is doing the optimization ahead of time, but is there a way to compress the data on a Timeseries after it has been created?