import {DataSource, dataSources, Resource} from '../../src'; 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).toString(); } return "1"; }; export const dataSource = (resource: Resource) => new dataSources.jsonlFile.DataSource(resource, 'examples/basic');