@aztec/kv-store 0.80.0 → 0.82.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.
Files changed (71) hide show
  1. package/dest/config.d.ts.map +1 -1
  2. package/dest/config.js +3 -1
  3. package/dest/indexeddb/map.d.ts +5 -4
  4. package/dest/indexeddb/map.d.ts.map +1 -1
  5. package/dest/indexeddb/map.js +13 -53
  6. package/dest/indexeddb/multi_map.d.ts +12 -0
  7. package/dest/indexeddb/multi_map.d.ts.map +1 -0
  8. package/dest/indexeddb/multi_map.js +54 -0
  9. package/dest/indexeddb/store.d.ts +2 -1
  10. package/dest/indexeddb/store.d.ts.map +1 -1
  11. package/dest/indexeddb/store.js +2 -1
  12. package/dest/interfaces/index.d.ts +1 -0
  13. package/dest/interfaces/index.d.ts.map +1 -1
  14. package/dest/interfaces/index.js +1 -0
  15. package/dest/interfaces/map.d.ts +0 -46
  16. package/dest/interfaces/map.d.ts.map +1 -1
  17. package/dest/interfaces/map.js +1 -1
  18. package/dest/interfaces/map_test_suite.d.ts.map +1 -1
  19. package/dest/interfaces/map_test_suite.js +6 -20
  20. package/dest/interfaces/multi_map.d.ts +35 -0
  21. package/dest/interfaces/multi_map.d.ts.map +1 -0
  22. package/dest/interfaces/multi_map.js +3 -0
  23. package/dest/interfaces/multi_map_test_suite.d.ts +3 -0
  24. package/dest/interfaces/multi_map_test_suite.d.ts.map +1 -0
  25. package/dest/interfaces/multi_map_test_suite.js +151 -0
  26. package/dest/interfaces/store.d.ts +2 -13
  27. package/dest/interfaces/store.d.ts.map +1 -1
  28. package/dest/lmdb/map.d.ts +2 -18
  29. package/dest/lmdb/map.d.ts.map +1 -1
  30. package/dest/lmdb/map.js +0 -81
  31. package/dest/lmdb/multi_map.d.ts +12 -0
  32. package/dest/lmdb/multi_map.d.ts.map +1 -0
  33. package/dest/lmdb/multi_map.js +29 -0
  34. package/dest/lmdb/store.d.ts +2 -13
  35. package/dest/lmdb/store.d.ts.map +1 -1
  36. package/dest/lmdb/store.js +3 -16
  37. package/dest/lmdb-v2/array.d.ts.map +1 -1
  38. package/dest/lmdb-v2/array.js +1 -0
  39. package/dest/lmdb-v2/map.d.ts +1 -43
  40. package/dest/lmdb-v2/map.d.ts.map +1 -1
  41. package/dest/lmdb-v2/map.js +1 -100
  42. package/dest/lmdb-v2/multi_map.d.ts +46 -0
  43. package/dest/lmdb-v2/multi_map.d.ts.map +1 -0
  44. package/dest/lmdb-v2/multi_map.js +103 -0
  45. package/dest/lmdb-v2/singleton.d.ts.map +1 -1
  46. package/dest/lmdb-v2/singleton.js +1 -0
  47. package/dest/lmdb-v2/store.d.ts +2 -1
  48. package/dest/lmdb-v2/store.d.ts.map +1 -1
  49. package/dest/lmdb-v2/store.js +5 -1
  50. package/dest/stores/l2_tips_store.d.ts.map +1 -1
  51. package/dest/stores/l2_tips_store.js +7 -4
  52. package/package.json +5 -5
  53. package/src/config.ts +3 -1
  54. package/src/indexeddb/map.ts +15 -47
  55. package/src/indexeddb/multi_map.ts +53 -0
  56. package/src/indexeddb/store.ts +9 -3
  57. package/src/interfaces/index.ts +1 -0
  58. package/src/interfaces/map.ts +0 -52
  59. package/src/interfaces/map_test_suite.ts +18 -33
  60. package/src/interfaces/multi_map.ts +38 -0
  61. package/src/interfaces/multi_map_test_suite.ts +143 -0
  62. package/src/interfaces/store.ts +2 -22
  63. package/src/lmdb/map.ts +2 -88
  64. package/src/lmdb/multi_map.ts +35 -0
  65. package/src/lmdb/store.ts +5 -27
  66. package/src/lmdb-v2/array.ts +1 -0
  67. package/src/lmdb-v2/map.ts +2 -120
  68. package/src/lmdb-v2/multi_map.ts +126 -0
  69. package/src/lmdb-v2/singleton.ts +1 -0
  70. package/src/lmdb-v2/store.ts +7 -2
  71. package/src/stores/l2_tips_store.ts +5 -3
@@ -8,12 +8,15 @@ import { rm } from 'fs/promises';
8
8
  import type { AztecAsyncArray } from '../interfaces/array.js';
9
9
  import type { Key, StoreSize } from '../interfaces/common.js';
10
10
  import type { AztecAsyncCounter } from '../interfaces/counter.js';
11
- import type { AztecAsyncMap, AztecAsyncMultiMap } from '../interfaces/map.js';
11
+ import type { AztecAsyncMap } from '../interfaces/map.js';
12
+ import type { AztecAsyncMultiMap } from '../interfaces/multi_map.js';
12
13
  import type { AztecAsyncSet } from '../interfaces/set.js';
13
14
  import type { AztecAsyncSingleton } from '../interfaces/singleton.js';
14
15
  import type { AztecAsyncKVStore } from '../interfaces/store.js';
16
+ // eslint-disable-next-line import/no-cycle
15
17
  import { LMDBArray } from './array.js';
16
- import { LMDBMap, LMDBMultiMap } from './map.js';
18
+ // eslint-disable-next-line import/no-cycle
19
+ import { LMDBMap } from './map.js';
17
20
  import {
18
21
  Database,
19
22
  type LMDBMessageChannel,
@@ -21,7 +24,9 @@ import {
21
24
  type LMDBRequestBody,
22
25
  type LMDBResponseBody,
23
26
  } from './message.js';
27
+ import { LMDBMultiMap } from './multi_map.js';
24
28
  import { ReadTransaction } from './read_transaction.js';
29
+ // eslint-disable-next-line import/no-cycle
25
30
  import { LMDBSingleValue } from './singleton.js';
26
31
  import { WriteTransaction } from './write_transaction.js';
27
32
 
@@ -47,12 +47,14 @@ export class L2TipsStore implements L2BlockStreamEventHandler, L2BlockStreamLoca
47
47
 
48
48
  public async handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
49
49
  switch (event.type) {
50
- case 'blocks-added':
51
- for (const block of event.blocks) {
50
+ case 'blocks-added': {
51
+ const blocks = event.blocks.map(b => b.block);
52
+ for (const block of blocks) {
52
53
  await this.l2BlockHashesStore.set(block.number, (await block.header.hash()).toString());
53
54
  }
54
- await this.l2TipsStore.set('latest', event.blocks.at(-1)!.number);
55
+ await this.l2TipsStore.set('latest', blocks.at(-1)!.number);
55
56
  break;
57
+ }
56
58
  case 'chain-pruned':
57
59
  await this.l2TipsStore.set('latest', event.blockNumber);
58
60
  break;