@aztec/kv-store 0.82.3-nightly.20250403 → 0.83.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/dest/indexeddb/array.d.ts +2 -1
- package/dest/indexeddb/array.d.ts.map +1 -1
- package/dest/indexeddb/array.js +3 -0
- package/dest/indexeddb/map.d.ts +2 -2
- package/dest/indexeddb/map.d.ts.map +1 -1
- package/dest/indexeddb/map.js +2 -0
- package/dest/indexeddb/multi_map.d.ts +2 -2
- package/dest/indexeddb/multi_map.d.ts.map +1 -1
- package/dest/indexeddb/multi_map.js +20 -10
- package/dest/indexeddb/singleton.d.ts +2 -1
- package/dest/indexeddb/singleton.d.ts.map +1 -1
- package/dest/indexeddb/singleton.js +3 -1
- package/dest/indexeddb/store.d.ts +8 -6
- package/dest/indexeddb/store.d.ts.map +1 -1
- package/dest/indexeddb/store.js +7 -0
- package/dest/interfaces/array.d.ts +4 -3
- package/dest/interfaces/array.d.ts.map +1 -1
- package/dest/interfaces/array.js +1 -3
- package/dest/interfaces/common.d.ts +1 -0
- package/dest/interfaces/common.d.ts.map +1 -1
- package/dest/interfaces/map.d.ts +4 -4
- package/dest/interfaces/map.d.ts.map +1 -1
- package/dest/interfaces/multi_map.d.ts +3 -3
- package/dest/interfaces/multi_map.d.ts.map +1 -1
- package/dest/interfaces/multi_map_test_suite.d.ts.map +1 -1
- package/dest/interfaces/multi_map_test_suite.js +7 -0
- package/dest/interfaces/store.d.ts +9 -9
- package/dest/interfaces/store.d.ts.map +1 -1
- package/dest/lmdb/array.d.ts +2 -1
- package/dest/lmdb/array.d.ts.map +1 -1
- package/dest/lmdb/map.d.ts +2 -2
- package/dest/lmdb/map.d.ts.map +1 -1
- package/dest/lmdb/multi_map.d.ts +2 -2
- package/dest/lmdb/multi_map.d.ts.map +1 -1
- package/dest/lmdb/store.d.ts +4 -4
- package/dest/lmdb/store.d.ts.map +1 -1
- package/dest/lmdb-v2/array.d.ts +2 -1
- package/dest/lmdb-v2/array.d.ts.map +1 -1
- package/dest/lmdb-v2/map.d.ts +2 -2
- package/dest/lmdb-v2/map.d.ts.map +1 -1
- package/dest/lmdb-v2/multi_map.d.ts +2 -2
- package/dest/lmdb-v2/multi_map.d.ts.map +1 -1
- package/dest/lmdb-v2/store.d.ts +5 -5
- package/dest/lmdb-v2/store.d.ts.map +1 -1
- package/package.json +6 -5
- package/src/indexeddb/array.ts +5 -1
- package/src/indexeddb/map.ts +4 -2
- package/src/indexeddb/multi_map.ts +26 -14
- package/src/indexeddb/singleton.ts +4 -1
- package/src/indexeddb/store.ts +15 -7
- package/src/interfaces/array.ts +5 -3
- package/src/interfaces/common.ts +2 -0
- package/src/interfaces/map.ts +4 -4
- package/src/interfaces/multi_map.ts +3 -3
- package/src/interfaces/multi_map_test_suite.ts +7 -0
- package/src/interfaces/store.ts +9 -9
- package/src/lmdb/array.ts +2 -1
- package/src/lmdb/map.ts +2 -2
- package/src/lmdb/multi_map.ts +2 -2
- package/src/lmdb/store.ts +4 -4
- package/src/lmdb-v2/array.ts +2 -1
- package/src/lmdb-v2/map.ts +2 -2
- package/src/lmdb-v2/multi_map.ts +2 -2
- package/src/lmdb-v2/store.ts +5 -5
package/src/lmdb/store.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { tmpdir } from 'os';
|
|
|
7
7
|
import { join } from 'path';
|
|
8
8
|
|
|
9
9
|
import type { AztecArray, AztecAsyncArray } from '../interfaces/array.js';
|
|
10
|
-
import type { Key, StoreSize } from '../interfaces/common.js';
|
|
10
|
+
import type { Key, StoreSize, Value } from '../interfaces/common.js';
|
|
11
11
|
import type { AztecAsyncCounter, AztecCounter } from '../interfaces/counter.js';
|
|
12
12
|
import type { AztecAsyncMap, AztecMap } from '../interfaces/map.js';
|
|
13
13
|
import type { AztecAsyncMultiMap, AztecMultiMap } from '../interfaces/multi_map.js';
|
|
@@ -80,7 +80,7 @@ export class AztecLmdbStore implements AztecKVStore, AztecAsyncKVStore {
|
|
|
80
80
|
* @param name - Name of the map
|
|
81
81
|
* @returns A new AztecMap
|
|
82
82
|
*/
|
|
83
|
-
openMap<K extends Key, V>(name: string): AztecMap<K, V> & AztecAsyncMap<K, V> {
|
|
83
|
+
openMap<K extends Key, V extends Value>(name: string): AztecMap<K, V> & AztecAsyncMap<K, V> {
|
|
84
84
|
return new LmdbAztecMap(this.#data, name);
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -98,7 +98,7 @@ export class AztecLmdbStore implements AztecKVStore, AztecAsyncKVStore {
|
|
|
98
98
|
* @param name - Name of the map
|
|
99
99
|
* @returns A new AztecMultiMap
|
|
100
100
|
*/
|
|
101
|
-
openMultiMap<K extends Key, V>(name: string): AztecMultiMap<K, V> & AztecAsyncMultiMap<K, V> {
|
|
101
|
+
openMultiMap<K extends Key, V extends Value>(name: string): AztecMultiMap<K, V> & AztecAsyncMultiMap<K, V> {
|
|
102
102
|
return new LmdbAztecMultiMap(this.#multiMapData, name);
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -111,7 +111,7 @@ export class AztecLmdbStore implements AztecKVStore, AztecAsyncKVStore {
|
|
|
111
111
|
* @param name - Name of the array
|
|
112
112
|
* @returns A new AztecArray
|
|
113
113
|
*/
|
|
114
|
-
openArray<T>(name: string): AztecArray<T> & AztecAsyncArray<T> {
|
|
114
|
+
openArray<T extends Value>(name: string): AztecArray<T> & AztecAsyncArray<T> {
|
|
115
115
|
return new LmdbAztecArray(this.#data, name);
|
|
116
116
|
}
|
|
117
117
|
|
package/src/lmdb-v2/array.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Encoder } from 'msgpackr/pack';
|
|
2
2
|
|
|
3
3
|
import type { AztecAsyncArray } from '../interfaces/array.js';
|
|
4
|
+
import type { Value } from '../interfaces/common.js';
|
|
4
5
|
import type { AztecAsyncSingleton } from '../interfaces/singleton.js';
|
|
5
6
|
import type { ReadTransaction } from './read_transaction.js';
|
|
6
7
|
// eslint-disable-next-line import/no-cycle
|
|
7
8
|
import { AztecLMDBStoreV2, execInReadTx, execInWriteTx } from './store.js';
|
|
8
9
|
import { deserializeKey, serializeKey } from './utils.js';
|
|
9
10
|
|
|
10
|
-
export class LMDBArray<T> implements AztecAsyncArray<T> {
|
|
11
|
+
export class LMDBArray<T extends Value> implements AztecAsyncArray<T> {
|
|
11
12
|
private length: AztecAsyncSingleton<number>;
|
|
12
13
|
private encoder = new Encoder();
|
|
13
14
|
private prefix: string;
|
package/src/lmdb-v2/map.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Encoder } from 'msgpackr';
|
|
2
2
|
|
|
3
|
-
import type { Key, Range } from '../interfaces/common.js';
|
|
3
|
+
import type { Key, Range, Value } from '../interfaces/common.js';
|
|
4
4
|
import type { AztecAsyncMap } from '../interfaces/map.js';
|
|
5
5
|
import type { ReadTransaction } from './read_transaction.js';
|
|
6
6
|
// eslint-disable-next-line import/no-cycle
|
|
7
7
|
import { type AztecLMDBStoreV2, execInReadTx, execInWriteTx } from './store.js';
|
|
8
8
|
import { deserializeKey, maxKey, minKey, serializeKey } from './utils.js';
|
|
9
9
|
|
|
10
|
-
export class LMDBMap<K extends Key, V> implements AztecAsyncMap<K, V> {
|
|
10
|
+
export class LMDBMap<K extends Key, V extends Value> implements AztecAsyncMap<K, V> {
|
|
11
11
|
private prefix: string;
|
|
12
12
|
private encoder = new Encoder();
|
|
13
13
|
|
package/src/lmdb-v2/multi_map.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Encoder } from 'msgpackr/pack';
|
|
2
2
|
|
|
3
|
-
import type { Key, Range } from '../interfaces/common.js';
|
|
3
|
+
import type { Key, Range, Value } from '../interfaces/common.js';
|
|
4
4
|
import type { AztecAsyncMultiMap } from '../interfaces/multi_map.js';
|
|
5
5
|
import type { ReadTransaction } from './read_transaction.js';
|
|
6
6
|
import { type AztecLMDBStoreV2, execInReadTx, execInWriteTx } from './store.js';
|
|
7
7
|
import { deserializeKey, maxKey, minKey, serializeKey } from './utils.js';
|
|
8
8
|
|
|
9
|
-
export class LMDBMultiMap<K extends Key, V> implements AztecAsyncMultiMap<K, V> {
|
|
9
|
+
export class LMDBMultiMap<K extends Key, V extends Value> implements AztecAsyncMultiMap<K, V> {
|
|
10
10
|
private prefix: string;
|
|
11
11
|
private encoder = new Encoder();
|
|
12
12
|
constructor(private store: AztecLMDBStoreV2, name: string) {
|
package/src/lmdb-v2/store.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { AsyncLocalStorage } from 'async_hooks';
|
|
|
6
6
|
import { mkdir, rm } from 'fs/promises';
|
|
7
7
|
|
|
8
8
|
import type { AztecAsyncArray } from '../interfaces/array.js';
|
|
9
|
-
import type { Key, StoreSize } from '../interfaces/common.js';
|
|
9
|
+
import type { Key, StoreSize, Value } from '../interfaces/common.js';
|
|
10
10
|
import type { AztecAsyncCounter } from '../interfaces/counter.js';
|
|
11
11
|
import type { AztecAsyncMap } from '../interfaces/map.js';
|
|
12
12
|
import type { AztecAsyncMultiMap } from '../interfaces/multi_map.js';
|
|
@@ -102,19 +102,19 @@ export class AztecLMDBStoreV2 implements AztecAsyncKVStore, LMDBMessageChannel {
|
|
|
102
102
|
return currentWrite;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
openMap<K extends Key, V>(name: string): AztecAsyncMap<K, V> {
|
|
105
|
+
openMap<K extends Key, V extends Value>(name: string): AztecAsyncMap<K, V> {
|
|
106
106
|
return new LMDBMap(this, name);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
openMultiMap<K extends Key, V>(name: string): AztecAsyncMultiMap<K, V> {
|
|
109
|
+
openMultiMap<K extends Key, V extends Value>(name: string): AztecAsyncMultiMap<K, V> {
|
|
110
110
|
return new LMDBMultiMap(this, name);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
openSingleton<T>(name: string): AztecAsyncSingleton<T> {
|
|
113
|
+
openSingleton<T extends Value>(name: string): AztecAsyncSingleton<T> {
|
|
114
114
|
return new LMDBSingleValue(this, name);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
openArray<T>(name: string): AztecAsyncArray<T> {
|
|
117
|
+
openArray<T extends Value>(name: string): AztecAsyncArray<T> {
|
|
118
118
|
return new LMDBArray(this, name);
|
|
119
119
|
}
|
|
120
120
|
|