@aztec/kv-store 0.86.0-nightly.20250508 → 0.86.0-nightly.20250510

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.
@@ -1 +1 @@
1
- {"version":3,"file":"map_test_suite.d.ts","sourceRoot":"","sources":["../../src/interfaces/map_test_suite.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGlE,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,EACzD,UAAU,GAAE,OAAe,QAmH5B"}
1
+ {"version":3,"file":"map_test_suite.d.ts","sourceRoot":"","sources":["../../src/interfaces/map_test_suite.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGlE,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,EACzD,UAAU,GAAE,OAAe,QA8H5B"}
@@ -81,57 +81,112 @@ export function describeAztecMap(testName, getStore, forceAsync = false) {
81
81
  'foo'
82
82
  ]);
83
83
  });
84
- it('supports range queries', async ()=>{
85
- await map.set('a', 'a');
86
- await map.set('b', 'b');
87
- await map.set('c', 'c');
88
- await map.set('d', 'd');
89
- expect(await keys({
90
- start: 'b',
91
- end: 'c'
92
- })).to.deep.equal([
93
- 'b'
94
- ]);
95
- expect(await keys({
96
- start: 'b'
97
- })).to.deep.equal([
98
- 'b',
99
- 'c',
100
- 'd'
101
- ]);
102
- expect(await keys({
103
- end: 'c'
104
- })).to.deep.equal([
105
- 'a',
106
- 'b'
107
- ]);
108
- expect(await keys({
109
- start: 'b',
110
- end: 'c',
111
- reverse: true
112
- })).to.deep.equal([
113
- 'c'
114
- ]);
115
- expect(await keys({
116
- start: 'b',
117
- limit: 1
118
- })).to.deep.equal([
119
- 'b'
120
- ]);
121
- expect(await keys({
122
- start: 'b',
123
- reverse: true
124
- })).to.deep.equal([
125
- 'd',
126
- 'c'
127
- ]);
128
- expect(await keys({
129
- end: 'b',
130
- reverse: true
131
- })).to.deep.equal([
132
- 'b',
133
- 'a'
134
- ]);
135
- });
84
+ for (const [name, data] of [
85
+ [
86
+ 'chars',
87
+ [
88
+ 'a',
89
+ 'b',
90
+ 'c',
91
+ 'd'
92
+ ]
93
+ ],
94
+ [
95
+ 'numbers',
96
+ [
97
+ 1,
98
+ 2,
99
+ 3,
100
+ 4
101
+ ]
102
+ ],
103
+ [
104
+ 'negative numbers',
105
+ [
106
+ -4,
107
+ -3,
108
+ -2,
109
+ -1
110
+ ]
111
+ ],
112
+ [
113
+ 'strings',
114
+ [
115
+ 'aaa',
116
+ 'bbb',
117
+ 'ccc',
118
+ 'ddd'
119
+ ]
120
+ ],
121
+ [
122
+ 'zero-based numbers',
123
+ [
124
+ 0,
125
+ 1,
126
+ 2,
127
+ 3
128
+ ]
129
+ ]
130
+ ]){
131
+ it(`supports range queries over ${name} keys`, async ()=>{
132
+ const [a, b, c, d] = data;
133
+ await map.set(a, 'a');
134
+ await map.set(b, 'b');
135
+ await map.set(c, 'c');
136
+ await map.set(d, 'd');
137
+ expect(await keys()).to.deep.equal([
138
+ a,
139
+ b,
140
+ c,
141
+ d
142
+ ]);
143
+ expect(await keys({
144
+ start: b,
145
+ end: c
146
+ })).to.deep.equal([
147
+ b
148
+ ]);
149
+ expect(await keys({
150
+ start: b
151
+ })).to.deep.equal([
152
+ b,
153
+ c,
154
+ d
155
+ ]);
156
+ expect(await keys({
157
+ end: c
158
+ })).to.deep.equal([
159
+ a,
160
+ b
161
+ ]);
162
+ expect(await keys({
163
+ start: b,
164
+ end: c,
165
+ reverse: true
166
+ })).to.deep.equal([
167
+ c
168
+ ]);
169
+ expect(await keys({
170
+ start: b,
171
+ limit: 1
172
+ })).to.deep.equal([
173
+ b
174
+ ]);
175
+ expect(await keys({
176
+ start: b,
177
+ reverse: true
178
+ })).to.deep.equal([
179
+ d,
180
+ c
181
+ ]);
182
+ expect(await keys({
183
+ end: b,
184
+ reverse: true
185
+ })).to.deep.equal([
186
+ b,
187
+ a
188
+ ]);
189
+ });
190
+ }
136
191
  });
137
192
  }
@@ -1 +1 @@
1
- {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/lmdb-v2/map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,KAAK,gBAAgB,EAA+B,MAAM,YAAY,CAAC;AAGhF,qBAAa,OAAO,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,KAAK,CAAE,YAAW,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC;IAIrE,OAAO,CAAC,KAAK;IAHzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAiB;gBAEZ,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM;IAGzD;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAYhD;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7B,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAOxC,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAIlC;;;OAGG;IACI,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CAAC;IAOxC,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAIlC;;;OAGG;IACI,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAgCpE;;;OAGG;IACI,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC;IAM9D;;;OAGG;IACI,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC;CAK7D"}
@@ -53,15 +53,15 @@ export class LMDBMap {
53
53
  * @param range - The range of keys to iterate over
54
54
  */ async *entriesAsync(range) {
55
55
  const reverse = range?.reverse ?? false;
56
- const startKey = range?.start ? serializeKey(this.prefix, range.start) : minKey(this.prefix);
57
- const endKey = range?.end ? serializeKey(this.prefix, range.end) : reverse ? maxKey(this.prefix) : undefined;
56
+ const startKey = range?.start !== undefined ? serializeKey(this.prefix, range.start) : minKey(this.prefix);
57
+ const endKey = range?.end !== undefined ? serializeKey(this.prefix, range.end) : reverse ? maxKey(this.prefix) : undefined;
58
58
  let tx = this.store.getCurrentWriteTx();
59
59
  const shouldClose = !tx;
60
60
  tx ??= this.store.getReadTx();
61
61
  try {
62
62
  for await (const [key, val] of tx.iterate(reverse ? endKey : startKey, reverse ? startKey : endKey, reverse, range?.limit)){
63
63
  const deserializedKey = deserializeKey(this.prefix, key);
64
- if (!deserializedKey) {
64
+ if (deserializedKey === false) {
65
65
  break;
66
66
  }
67
67
  yield [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/kv-store",
3
- "version": "0.86.0-nightly.20250508",
3
+ "version": "0.86.0-nightly.20250510",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/interfaces/index.js",
@@ -23,10 +23,10 @@
23
23
  "./package.local.json"
24
24
  ],
25
25
  "dependencies": {
26
- "@aztec/ethereum": "0.86.0-nightly.20250508",
27
- "@aztec/foundation": "0.86.0-nightly.20250508",
28
- "@aztec/native": "0.86.0-nightly.20250508",
29
- "@aztec/stdlib": "0.86.0-nightly.20250508",
26
+ "@aztec/ethereum": "0.86.0-nightly.20250510",
27
+ "@aztec/foundation": "0.86.0-nightly.20250510",
28
+ "@aztec/native": "0.86.0-nightly.20250510",
29
+ "@aztec/stdlib": "0.86.0-nightly.20250510",
30
30
  "idb": "^8.0.0",
31
31
  "lmdb": "^3.2.0",
32
32
  "msgpackr": "^1.11.2",
@@ -110,19 +110,30 @@ export function describeAztecMap(
110
110
  expect(await keys()).to.deep.equal(['baz', 'foo']);
111
111
  });
112
112
 
113
- it('supports range queries', async () => {
114
- await map.set('a', 'a');
115
- await map.set('b', 'b');
116
- await map.set('c', 'c');
117
- await map.set('d', 'd');
118
-
119
- expect(await keys({ start: 'b', end: 'c' })).to.deep.equal(['b']);
120
- expect(await keys({ start: 'b' })).to.deep.equal(['b', 'c', 'd']);
121
- expect(await keys({ end: 'c' })).to.deep.equal(['a', 'b']);
122
- expect(await keys({ start: 'b', end: 'c', reverse: true })).to.deep.equal(['c']);
123
- expect(await keys({ start: 'b', limit: 1 })).to.deep.equal(['b']);
124
- expect(await keys({ start: 'b', reverse: true })).to.deep.equal(['d', 'c']);
125
- expect(await keys({ end: 'b', reverse: true })).to.deep.equal(['b', 'a']);
126
- });
113
+ for (const [name, data] of [
114
+ ['chars', ['a', 'b', 'c', 'd']],
115
+ ['numbers', [1, 2, 3, 4]],
116
+ ['negative numbers', [-4, -3, -2, -1]],
117
+ ['strings', ['aaa', 'bbb', 'ccc', 'ddd']],
118
+ ['zero-based numbers', [0, 1, 2, 3]],
119
+ ]) {
120
+ it(`supports range queries over ${name} keys`, async () => {
121
+ const [a, b, c, d] = data;
122
+
123
+ await map.set(a, 'a');
124
+ await map.set(b, 'b');
125
+ await map.set(c, 'c');
126
+ await map.set(d, 'd');
127
+
128
+ expect(await keys()).to.deep.equal([a, b, c, d]);
129
+ expect(await keys({ start: b, end: c })).to.deep.equal([b]);
130
+ expect(await keys({ start: b })).to.deep.equal([b, c, d]);
131
+ expect(await keys({ end: c })).to.deep.equal([a, b]);
132
+ expect(await keys({ start: b, end: c, reverse: true })).to.deep.equal([c]);
133
+ expect(await keys({ start: b, limit: 1 })).to.deep.equal([b]);
134
+ expect(await keys({ start: b, reverse: true })).to.deep.equal([d, c]);
135
+ expect(await keys({ end: b, reverse: true })).to.deep.equal([b, a]);
136
+ });
137
+ }
127
138
  });
128
139
  }
@@ -65,9 +65,11 @@ export class LMDBMap<K extends Key, V extends Value> implements AztecAsyncMap<K,
65
65
  */
66
66
  async *entriesAsync(range?: Range<K>): AsyncIterableIterator<[K, V]> {
67
67
  const reverse = range?.reverse ?? false;
68
- const startKey = range?.start ? serializeKey(this.prefix, range.start) : minKey(this.prefix);
69
68
 
70
- const endKey = range?.end ? serializeKey(this.prefix, range.end) : reverse ? maxKey(this.prefix) : undefined;
69
+ const startKey = range?.start !== undefined ? serializeKey(this.prefix, range.start) : minKey(this.prefix);
70
+
71
+ const endKey =
72
+ range?.end !== undefined ? serializeKey(this.prefix, range.end) : reverse ? maxKey(this.prefix) : undefined;
71
73
 
72
74
  let tx: ReadTransaction | undefined = this.store.getCurrentWriteTx();
73
75
  const shouldClose = !tx;
@@ -81,7 +83,7 @@ export class LMDBMap<K extends Key, V extends Value> implements AztecAsyncMap<K,
81
83
  range?.limit,
82
84
  )) {
83
85
  const deserializedKey = deserializeKey<K>(this.prefix, key);
84
- if (!deserializedKey) {
86
+ if (deserializedKey === false) {
85
87
  break;
86
88
  }
87
89
  yield [deserializedKey, this.encoder.unpack(val)];