From 8f26eb44038ddf9f85def4b75fa67cbb8d2c998d Mon Sep 17 00:00:00 2001 From: julienmalard Date: Mon, 2 Oct 2023 16:20:57 +0200 Subject: [PATCH] Ajustements --- src/client.ts | 4 ++-- src/epingles.ts | 4 +--- test/client.spec.ts | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/client.ts b/src/client.ts index 1a133fbde1..0f9f124fd6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1112,8 +1112,8 @@ export class ClientConstellation extends EventEmitter { schéma?: JSONSchemaType; f: schémaFonctionSuivi; }): Promise { - const fFinale = async (bd: TypedKeyValue) => { - const valeurs = bd ? await bd.allAsJSON() : ({} as T); + const fFinale = async (bd: KeyValue) => { + const valeurs = (bd ? Object.fromEntries((await bd.all()).map(x=>[x.key, x.value])) : {}) as T; await f(valeurs); }; return await this.suivreBd({ id, type: "keyvalue", schéma, f: fFinale }); diff --git a/src/epingles.ts b/src/epingles.ts index 0ff0fb179a..7b7d4d2b57 100644 --- a/src/epingles.ts +++ b/src/epingles.ts @@ -185,9 +185,7 @@ export default class Épingles { if (bd.type === "keyvalue") { const fOublierBd = await this.client.suivreBdDic({ id, - // @ts-ignore - f: async (x: { key: string; value: élémentsBd; hash: string }[]) => - await fSuivre(Object.fromEntries(x.map((y) => [y.key, y.value]))), + f: fSuivre, }); this.fsOublier[id] = fOublierBd; } else if (bd.type === "feed") { diff --git a/test/client.spec.ts b/test/client.spec.ts index 17a1173eb4..306cf8e811 100644 --- a/test/client.spec.ts +++ b/test/client.spec.ts @@ -1035,7 +1035,7 @@ if (isNode || isElectronMain) { id: string, f: schémaFonctionSuivi ) => { - return await client.suivreBd<{ [clef: string]: number }>({ + return await client.suivreBd({ id, type: "keyvalue", schéma: schémaKVNumérique,