@aztec/kv-store 0.86.0-nightly.20250513 → 0.86.0-nightly.20250514
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/interfaces/common.d.ts +8 -8
- package/dest/interfaces/common.d.ts.map +1 -1
- package/dest/interfaces/common.js +8 -3
- package/dest/interfaces/index.d.ts +2 -1
- package/dest/interfaces/index.d.ts.map +1 -1
- package/dest/interfaces/index.js +1 -0
- package/package.json +5 -5
- package/src/interfaces/common.ts +17 -8
- package/src/interfaces/index.ts +2 -1
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export type Key = string | number | Array<string | number>;
|
|
1
|
+
/** The key type for use with the kv-store */
|
|
2
|
+
export type Key = string | number | Uint8Array | Array<string | number>;
|
|
5
3
|
export type Value = NonNullable<any>;
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export type Range<K extends Key = Key> = {
|
|
4
|
+
/** A range of keys of arbitrary type. */
|
|
5
|
+
export type CustomRange<K> = {
|
|
10
6
|
/** The key of the first item to include */
|
|
11
7
|
start?: K;
|
|
12
8
|
/** The key of the last item to include */
|
|
@@ -16,6 +12,10 @@ export type Range<K extends Key = Key> = {
|
|
|
16
12
|
/** The maximum number of items to iterate over */
|
|
17
13
|
limit?: number;
|
|
18
14
|
};
|
|
15
|
+
/** Maps a custom range into a range of valid key types to iterate over. */
|
|
16
|
+
export declare function mapRange<CK, K extends Key = Key>(range: CustomRange<CK>, mapFn: (key: CK) => K): Range<K>;
|
|
17
|
+
/** A range of keys to iterate over. */
|
|
18
|
+
export type Range<K extends Key = Key> = CustomRange<K>;
|
|
19
19
|
export type StoreSize = {
|
|
20
20
|
mappingSize: number;
|
|
21
21
|
physicalFileSize: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/interfaces/common.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/interfaces/common.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAExE,MAAM,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;AAErC,yCAAyC;AACzC,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,0CAA0C;IAC1C,GAAG,CAAC,EAAE,CAAC,CAAC;IACR,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,EAAE,EAAE,CAAC,SAAS,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAOzG;AAED,uCAAuC;AACvC,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;AAExD,MAAM,MAAM,SAAS,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/** The key type for use with the kv-store */ /** Maps a custom range into a range of valid key types to iterate over. */ export function mapRange(range, mapFn) {
|
|
2
|
+
return {
|
|
3
|
+
start: range.start ? mapFn(range.start) : undefined,
|
|
4
|
+
end: range.end ? mapFn(range.end) : undefined,
|
|
5
|
+
reverse: range.reverse,
|
|
6
|
+
limit: range.limit
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -5,5 +5,6 @@ export * from './singleton.js';
|
|
|
5
5
|
export * from './store.js';
|
|
6
6
|
export * from './set.js';
|
|
7
7
|
export * from './multi_map.js';
|
|
8
|
-
export
|
|
8
|
+
export { mapRange } from './common.js';
|
|
9
|
+
export type { CustomRange, Range, StoreSize } from './common.js';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dest/interfaces/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/kv-store",
|
|
3
|
-
"version": "0.86.0-nightly.
|
|
3
|
+
"version": "0.86.0-nightly.20250514",
|
|
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.
|
|
27
|
-
"@aztec/foundation": "0.86.0-nightly.
|
|
28
|
-
"@aztec/native": "0.86.0-nightly.
|
|
29
|
-
"@aztec/stdlib": "0.86.0-nightly.
|
|
26
|
+
"@aztec/ethereum": "0.86.0-nightly.20250514",
|
|
27
|
+
"@aztec/foundation": "0.86.0-nightly.20250514",
|
|
28
|
+
"@aztec/native": "0.86.0-nightly.20250514",
|
|
29
|
+
"@aztec/stdlib": "0.86.0-nightly.20250514",
|
|
30
30
|
"idb": "^8.0.0",
|
|
31
31
|
"lmdb": "^3.2.0",
|
|
32
32
|
"msgpackr": "^1.11.2",
|
package/src/interfaces/common.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export type Key = string | number | Array<string | number>;
|
|
1
|
+
/** The key type for use with the kv-store */
|
|
2
|
+
export type Key = string | number | Uint8Array | Array<string | number>;
|
|
5
3
|
|
|
6
4
|
export type Value = NonNullable<any>;
|
|
7
5
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
export type Range<K extends Key = Key> = {
|
|
6
|
+
/** A range of keys of arbitrary type. */
|
|
7
|
+
export type CustomRange<K> = {
|
|
12
8
|
/** The key of the first item to include */
|
|
13
9
|
start?: K;
|
|
14
10
|
/** The key of the last item to include */
|
|
@@ -19,4 +15,17 @@ export type Range<K extends Key = Key> = {
|
|
|
19
15
|
limit?: number;
|
|
20
16
|
};
|
|
21
17
|
|
|
18
|
+
/** Maps a custom range into a range of valid key types to iterate over. */
|
|
19
|
+
export function mapRange<CK, K extends Key = Key>(range: CustomRange<CK>, mapFn: (key: CK) => K): Range<K> {
|
|
20
|
+
return {
|
|
21
|
+
start: range.start ? mapFn(range.start) : undefined,
|
|
22
|
+
end: range.end ? mapFn(range.end) : undefined,
|
|
23
|
+
reverse: range.reverse,
|
|
24
|
+
limit: range.limit,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A range of keys to iterate over. */
|
|
29
|
+
export type Range<K extends Key = Key> = CustomRange<K>;
|
|
30
|
+
|
|
22
31
|
export type StoreSize = { mappingSize: number; physicalFileSize: number; actualSize: number; numItems: number };
|
package/src/interfaces/index.ts
CHANGED
|
@@ -5,4 +5,5 @@ export * from './singleton.js';
|
|
|
5
5
|
export * from './store.js';
|
|
6
6
|
export * from './set.js';
|
|
7
7
|
export * from './multi_map.js';
|
|
8
|
-
export
|
|
8
|
+
export { mapRange } from './common.js';
|
|
9
|
+
export type { CustomRange, Range, StoreSize } from './common.js';
|