From 1ad2f4cbe9d231f7f2324b37ae0e0cc97fbb1216 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 29 Aug 2023 20:35:49 +0200 Subject: wallet-core: do p2p coin selection based on coin availability records --- packages/taler-wallet-core/src/util/query.ts | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'packages/taler-wallet-core/src/util/query.ts') diff --git a/packages/taler-wallet-core/src/util/query.ts b/packages/taler-wallet-core/src/util/query.ts index 527cbdf63..71f80f8aa 100644 --- a/packages/taler-wallet-core/src/util/query.ts +++ b/packages/taler-wallet-core/src/util/query.ts @@ -429,6 +429,46 @@ export type GetReadOnlyAccess = { : unknown; }; +export type StoreNames = StoreMap extends { + [P in keyof StoreMap]: StoreWithIndexes; +} + ? keyof StoreMap + : unknown; + +export type DbReadOnlyTransaction< + StoreMap, + Stores extends StoreNames & string, +> = StoreMap extends { + [P in Stores]: StoreWithIndexes; +} + ? { + [P in Stores]: StoreMap[P] extends StoreWithIndexes< + infer SN, + infer SD, + infer IM + > + ? StoreReadOnlyAccessor, IM> + : unknown; + } + : unknown; + +export type DbReadWriteTransaction< + StoreMap, + Stores extends StoreNames & string, +> = StoreMap extends { + [P in Stores]: StoreWithIndexes; +} + ? { + [P in Stores]: StoreMap[P] extends StoreWithIndexes< + infer SN, + infer SD, + infer IM + > + ? StoreReadWriteAccessor, IM> + : unknown; + } + : unknown; + export type GetReadWriteAccess = { [P in keyof BoundStores]: BoundStores[P] extends StoreWithIndexes< infer SN, -- cgit v1.2.3