import {DataSource} from '../../src/backend/data-source'; export const autoIncrement = async (dataSource: DataSource) => { const data = await dataSource.getMultiple() as Record[]; const highestId = data.reduce( (highestId, d) => (Number(d.id) > highestId ? Number(d.id) : highestId), -Infinity ); if (Number.isFinite(highestId)) { return (highestId + 1); } return 1; };