in src/scaler/scaler-core/state.js [325:346]
static convertToStorage(stateData) {
/** @type {{[x:string]: any}} */
const row = {};
const stateDataKeys = Object.keys(stateData);
// Only copy values into row that have defined column names.
for (const colDef of STATE_KEY_DEFINITIONS) {
if (stateDataKeys.includes(colDef.name)) {
// copy value
// @ts-ignore
row[colDef.name] = stateData[colDef.name];
// convert timestamp
if (colDef.type === 'timestamp' && row[colDef.name] !== null) {
// convert millis to ISO timestamp
row[colDef.name] = new Date(row[colDef.name]).toISOString();
}
}
}
return row;
}