how to get the first and last keys from a KV?
how to get the first and last keys from a KV?

async function getFirstAndLast(KV: KVNamespace) {
let listResult = await KV.list();
const first = listResult.keys[0];
while(!listResult.list_complete) {
listResult = await KV.list({cursor: listResult.cursor});
}
const last = listResult.keys[listResult.keys.length - 1];
return { first, last };
}