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:
@@ -56,13 +56,14 @@ class JsonKvUnit implements KvUnit {
|
|||||||
private readonly onClose: () => void,
|
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()
|
this.assertOpen()
|
||||||
const tables: Record<string, Record<string, unknown>> = {}
|
const tables: Record<string, Record<string, unknown>> = {}
|
||||||
for (const [table, records] of this.state.tables) {
|
for (const [table, records] of this.state.tables) {
|
||||||
tables[table] = Object.fromEntries(records)
|
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> {
|
async putRecord(table: string, key: string, value: unknown): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user