diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-08-10 14:37:20 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-08-10 14:37:20 +0530 |
commit | 5f8714091aac80144be118fa6427d65222e7509c (patch) | |
tree | a897f42a894b299a78a44e8d9b96a2a9a8342d0c /packages/idb-bridge/src/MemoryBackend.ts | |
parent | 6990b3b5ec09ed5c1cc9d3eab4c5f8ad31d351ff (diff) | |
download | wallet-core-5f8714091aac80144be118fa6427d65222e7509c.tar.xz |
use API extractor for cleaner package separation
Diffstat (limited to 'packages/idb-bridge/src/MemoryBackend.ts')
-rw-r--r-- | packages/idb-bridge/src/MemoryBackend.ts | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/packages/idb-bridge/src/MemoryBackend.ts b/packages/idb-bridge/src/MemoryBackend.ts index c5fac41a9..e8aec766e 100644 --- a/packages/idb-bridge/src/MemoryBackend.ts +++ b/packages/idb-bridge/src/MemoryBackend.ts @@ -36,7 +36,7 @@ import { } from "./util/errors"; import BTree, { ISortedMapF } from "./tree/b+tree"; import compareKeys from "./util/cmp"; -import { Key, Value, KeyPath } from "./util/types"; +import { Key, Value, KeyPath, TransactionMode } from "./util/types"; import { StoreKeyResult, makeStoreKeyValue } from "./util/makeStoreKeyValue"; import getIndexKeys from "./util/getIndexKeys"; import openPromise from "./util/openPromise"; @@ -89,24 +89,28 @@ interface Database { connectionCookie: string | undefined; } -interface IndexDump { +/** @public */ +export interface IndexDump { name: string; records: IndexRecord[]; } -interface ObjectStoreDump { +/** @public */ +export interface ObjectStoreDump { name: string; keyGenerator: number; records: ObjectStoreRecord[]; indexes: { [name: string]: IndexDump }; } -interface DatabaseDump { +/** @public */ +export interface DatabaseDump { schema: Schema; objectStores: { [name: string]: ObjectStoreDump }; } -interface MemoryBackendDump { +/** @public */ +export interface MemoryBackendDump { databases: { [name: string]: DatabaseDump }; } @@ -132,12 +136,14 @@ interface Connection { objectStoreMap: { [currentName: string]: ObjectStoreMapEntry }; } -interface IndexRecord { +/** @public */ +export interface IndexRecord { indexKey: Key; primaryKeys: Key[]; } -interface ObjectStoreRecord { +/** @public */ +export interface ObjectStoreRecord { primaryKey: Key; value: Value; } @@ -210,6 +216,8 @@ function furthestKey( /** * Primitive in-memory backend. + * + * @public */ export class MemoryBackend implements Backend { private databases: { [name: string]: Database } = {}; @@ -471,7 +479,7 @@ export class MemoryBackend implements Backend { async beginTransaction( conn: DatabaseConnection, objectStores: string[], - mode: import("./util/types").TransactionMode, + mode: TransactionMode, ): Promise<DatabaseTransaction> { if (this.enableTracing) { console.log(`TRACING: beginTransaction`); @@ -781,7 +789,7 @@ export class MemoryBackend implements Backend { btx: DatabaseTransaction, indexName: string, objectStoreName: string, - keyPath: import("./util/types").KeyPath, + keyPath: KeyPath, multiEntry: boolean, unique: boolean, ): void { |