@naturalcycles/db-lib 10.58.0 → 10.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/file/inMemory.persistence.plugin.d.ts +1 -0
- package/dist/adapter/file/inMemory.persistence.plugin.js +3 -0
- package/dist/inmemory/inMemory.db.d.ts +1 -0
- package/dist/inmemory/inMemory.db.js +3 -0
- package/dist/inmemory/inMemoryKeyValueDB.d.ts +1 -0
- package/dist/inmemory/inMemoryKeyValueDB.js +3 -0
- package/package.json +1 -1
- package/src/adapter/file/inMemory.persistence.plugin.ts +4 -0
- package/src/inmemory/inMemory.db.ts +4 -0
- package/src/inmemory/inMemoryKeyValueDB.ts +4 -0
|
@@ -7,6 +7,7 @@ import type { FileDBPersistencePlugin } from './file.db.model.js';
|
|
|
7
7
|
export declare class InMemoryPersistencePlugin implements FileDBPersistencePlugin {
|
|
8
8
|
data: StringMap<StringMap<ObjectWithId>>;
|
|
9
9
|
ping(): Promise<void>;
|
|
10
|
+
clear(): void;
|
|
10
11
|
getTables(): Promise<string[]>;
|
|
11
12
|
loadFile<ROW extends ObjectWithId>(table: string): Promise<ROW[]>;
|
|
12
13
|
saveFiles(ops: DBSaveBatchOperation<any>[]): Promise<void>;
|
|
@@ -13,6 +13,7 @@ export declare class InMemoryKeyValueDB implements CommonKeyValueDB {
|
|
|
13
13
|
};
|
|
14
14
|
data: StringMap<StringMap<any>>;
|
|
15
15
|
ping(): Promise<void>;
|
|
16
|
+
clear(): void;
|
|
16
17
|
createTable(_table: string, _opt?: CommonDBCreateOptions): Promise<void>;
|
|
17
18
|
deleteByIds(table: string, ids: string[]): Promise<void>;
|
|
18
19
|
getByIds(table: string, ids: string[]): Promise<KeyValueDBTuple[]>;
|
|
@@ -11,6 +11,9 @@ export class InMemoryKeyValueDB {
|
|
|
11
11
|
// data[table][id] => any (can be Buffer, or number)
|
|
12
12
|
data = {};
|
|
13
13
|
async ping() { }
|
|
14
|
+
clear() {
|
|
15
|
+
this.data = {};
|
|
16
|
+
}
|
|
14
17
|
async createTable(_table, _opt) { }
|
|
15
18
|
async deleteByIds(table, ids) {
|
|
16
19
|
this.data[table] ||= {};
|
package/package.json
CHANGED
|
@@ -18,6 +18,10 @@ export class InMemoryKeyValueDB implements CommonKeyValueDB {
|
|
|
18
18
|
|
|
19
19
|
async ping(): Promise<void> {}
|
|
20
20
|
|
|
21
|
+
clear(): void {
|
|
22
|
+
this.data = {}
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
async createTable(_table: string, _opt?: CommonDBCreateOptions): Promise<void> {}
|
|
22
26
|
|
|
23
27
|
async deleteByIds(table: string, ids: string[]): Promise<void> {
|