590
591
async getMetadataObject<T extends Record<string, unknown>>(obj: T): Promise<{ [K in keyof T]: string | undefined }> {
593
>
// eslint-disable-next-line local/code-no-dangerous-type-assertions
594
>
const result = {} as { [K in keyof T]: string | undefined };
595
>
if (keys.length === 0) {
596
return result;
597
}
599
>
const placeholders = keys.map(() => '?').join(',');
600
>
const rows = await dbAll(db, `SELECT key, value FROM session_metadata WHERE key IN (${placeholders})`, keys);
601
>
for (const key of keys) {
602
>
result[key] = undefined;
603
>
}
604
>
for (const row of rows) {
605
result[row.key as keyof T] = row.value as string;
606
}
608
>
}
609
610
setMetadata(key: string, value: string): Promise<void> {