fix(storage): keep the json loadAll closed guard a rejection

Dropping async for the lint gate turned the closed-unit guard into a
synchronous throw, breaking the conformance clause that every post-close
operation rejects. Restore async with a justified require-await disable;
the guard's rejection semantics are what the shared suite pins.
This commit is contained in:
imccyu
2026-07-25 11:08:04 +08:00
parent 2e986ee1e3
commit 1bddf5269a
+3 -2
View File
@@ -56,13 +56,14 @@ class JsonKvUnit implements KvUnit {
private readonly onClose: () => void,
) {}
loadAll(): Promise<{ tables: Record<string, Record<string, unknown>>; global: unknown }> {
// eslint-disable-next-line @typescript-eslint/require-await -- async keeps the closed guard a rejection, not a synchronous throw
async loadAll(): Promise<{ tables: Record<string, Record<string, unknown>>; global: unknown }> {
this.assertOpen()
const tables: Record<string, Record<string, unknown>> = {}
for (const [table, records] of this.state.tables) {
tables[table] = Object.fromEntries(records)
}
return Promise.resolve({ tables, global: this.state.global })
return { tables, global: this.state.global }
}
async putRecord(table: string, key: string, value: unknown): Promise<void> {