"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const pool_1 = __importDefault(require("@cocalc/database/pool"));
// Returns undefined if no stats data is available.
async function getStats() {
    const pool = (0, pool_1.default)('long');
    const result = await pool.query("SELECT * FROM stats ORDER BY time DESC LIMIT 1");
    if (result.rows.length == 0)
        return;
    const data = result.rows[0];
    data.time = data.time.valueOf();
    return data;
}
exports.default = getStats;
//# sourceMappingURL=stats.js.map