fix(core): recent() accepts options objects like sessions()
Passing { limit } to recent() used to crash with 'Unknown named
parameter limit' because the options object was forwarded as the limit
value. Mirror sessions()'s QueryOptions | number signature.
This commit is contained in:
@@ -383,7 +383,7 @@ function createQueryApi(
|
||||
return db.prepare(`SELECT * FROM sessions s WHERE ${where} ORDER BY ended_at DESC LIMIT ?`).all(...params);
|
||||
};
|
||||
|
||||
const recent = (n = 10) => sessions({ limit: n });
|
||||
const recent = (n: QueryOptions | number = 10) => sessions(typeof n === 'object' && n !== null ? n : { limit: n });
|
||||
|
||||
const summaries = (optsOrSid?: QueryOptions | string) => {
|
||||
const opts = normalizeOpts(optsOrSid);
|
||||
|
||||
Reference in New Issue
Block a user