Skip to content

Commit

Permalink
Ajustements
Browse files Browse the repository at this point in the history
  • Loading branch information
julienmalard committed Oct 2, 2023
1 parent bee7bf0 commit 8f26eb4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,8 @@ export class ClientConstellation extends EventEmitter {
schéma?: JSONSchemaType<T>;
f: schémaFonctionSuivi<T>;
}): Promise<schémaFonctionOublier> {
const fFinale = async (bd: TypedKeyValue<T>) => {
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 });
Expand Down
4 changes: 1 addition & 3 deletions src/epingles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion test/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ if (isNode || isElectronMain) {
id: string,
f: schémaFonctionSuivi<branche>
) => {
return await client.suivreBd<{ [clef: string]: number }>({
return await client.suivreBd({
id,
type: "keyvalue",
schéma: schémaKVNumérique,
Expand Down

0 comments on commit 8f26eb4

Please sign in to comment.