@helia/interface 0.0.0-202b966 → 0.0.0-42308c0

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.
@@ -2,7 +2,8 @@ import type { AbortOptions } from '@libp2p/interfaces';
2
2
  import type { ProgressEvent, ProgressOptions } from 'progress-events';
3
3
  import type { CID } from 'multiformats/cid';
4
4
  import type { BitswapNotifyProgressEvents, BitswapWantProgressEvents } from 'ipfs-bitswap';
5
- import type { AwaitIterable } from './index.js';
5
+ import type { AwaitIterable, Await } from './index.js';
6
+ import type { Blockstore } from 'interface-blockstore';
6
7
  export interface Pair {
7
8
  cid: CID;
8
9
  block: Uint8Array;
@@ -14,7 +15,7 @@ export type GetManyBlocksProgressEvents = ProgressEvent<'blocks:get-many:blockst
14
15
  export type GetAllBlocksProgressEvents = ProgressEvent<'blocks:get-all:blockstore:get-many'>;
15
16
  export type DeleteBlockProgressEvents = ProgressEvent<'blocks:delete:blockstore:delete', CID>;
16
17
  export type DeleteManyBlocksProgressEvents = ProgressEvent<'blocks:delete-many:blockstore:delete-many'>;
17
- export interface Blocks {
18
+ export interface Blocks extends Blockstore {
18
19
  /**
19
20
  * Check for the existence of a value for the passed key
20
21
  *
@@ -29,7 +30,7 @@ export interface Blocks {
29
30
  * }
30
31
  *```
31
32
  */
32
- has: (key: CID, options?: AbortOptions) => Promise<boolean>;
33
+ has: (key: CID, options?: AbortOptions) => Await<boolean>;
33
34
  /**
34
35
  * Store the passed block under the passed CID
35
36
  *
@@ -39,7 +40,7 @@ export interface Blocks {
39
40
  * await store.put(CID('bafyfoo'), new Uint8Array([0, 1, 2, 3]))
40
41
  * ```
41
42
  */
42
- put: (key: CID, val: Uint8Array, options?: AbortOptions & ProgressOptions<PutBlockProgressEvents>) => Promise<void>;
43
+ put: (key: CID, val: Uint8Array, options?: AbortOptions & ProgressOptions<PutBlockProgressEvents>) => Await<void>;
43
44
  /**
44
45
  * Store the given key/value pairs
45
46
  *
@@ -52,7 +53,7 @@ export interface Blocks {
52
53
  * }
53
54
  * ```
54
55
  */
55
- putMany: (source: AwaitIterable<Pair>, options?: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents>) => AsyncIterable<Pair>;
56
+ putMany: (source: AwaitIterable<Pair>, options?: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents>) => AwaitIterable<Pair>;
56
57
  /**
57
58
  * Retrieve the value stored under the given key
58
59
  *
@@ -63,7 +64,7 @@ export interface Blocks {
63
64
  * // => got content: datastore
64
65
  * ```
65
66
  */
66
- get: (key: CID, options?: AbortOptions & ProgressOptions<GetBlockProgressEvents>) => Promise<Uint8Array>;
67
+ get: (key: CID, options?: AbortOptions & ProgressOptions<GetBlockProgressEvents>) => Await<Uint8Array>;
67
68
  /**
68
69
  * Retrieve values for the passed keys
69
70
  *
@@ -75,7 +76,7 @@ export interface Blocks {
75
76
  * }
76
77
  * ```
77
78
  */
78
- getMany: (source: AwaitIterable<CID>, options?: AbortOptions & ProgressOptions<GetManyBlocksProgressEvents>) => AsyncIterable<Uint8Array>;
79
+ getMany: (source: AwaitIterable<CID>, options?: AbortOptions & ProgressOptions<GetManyBlocksProgressEvents>) => AwaitIterable<Uint8Array>;
79
80
  /**
80
81
  * Retrieve all blocks in the blockstore
81
82
  *
@@ -87,7 +88,7 @@ export interface Blocks {
87
88
  * }
88
89
  * ```
89
90
  */
90
- getAll: (options?: AbortOptions & ProgressOptions<GetAllBlocksProgressEvents>) => AsyncIterable<Pair>;
91
+ getAll: (options?: AbortOptions & ProgressOptions<GetAllBlocksProgressEvents>) => AwaitIterable<Pair>;
91
92
  /**
92
93
  * Remove the record for the passed key
93
94
  *
@@ -98,7 +99,7 @@ export interface Blocks {
98
99
  * console.log('deleted awesome content :(')
99
100
  * ```
100
101
  */
101
- delete: (key: CID, options?: AbortOptions & ProgressOptions<DeleteBlockProgressEvents>) => Promise<void>;
102
+ delete: (key: CID, options?: AbortOptions & ProgressOptions<DeleteBlockProgressEvents>) => Await<void>;
102
103
  /**
103
104
  * Remove values for the passed keys
104
105
  *
@@ -112,6 +113,6 @@ export interface Blocks {
112
113
  * }
113
114
  * ```
114
115
  */
115
- deleteMany: (source: AwaitIterable<CID>, options?: AbortOptions & ProgressOptions<DeleteManyBlocksProgressEvents>) => AsyncIterable<CID>;
116
+ deleteMany: (source: AwaitIterable<CID>, options?: AbortOptions & ProgressOptions<DeleteManyBlocksProgressEvents>) => AwaitIterable<CID>;
116
117
  }
117
118
  //# sourceMappingURL=blocks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,GAAG,CAAA;IACR,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,MAAM,MAAM,sBAAsB,GAChC,aAAa,CAAC,sBAAsB,EAAE,GAAG,CAAC,GAC1C,aAAa,CAAC,2BAA2B,EAAE,GAAG,CAAC,GAC/C,aAAa,CAAC,2BAA2B,EAAE,GAAG,CAAC,GAC/C,2BAA2B,CAAA;AAE7B,MAAM,MAAM,2BAA2B,GACrC,aAAa,CAAC,2BAA2B,EAAE,GAAG,CAAC,GAC/C,aAAa,CAAC,gCAAgC,EAAE,GAAG,CAAC,GACpD,aAAa,CAAC,qCAAqC,CAAC,GACpD,2BAA2B,CAAA;AAE7B,MAAM,MAAM,sBAAsB,GAChC,aAAa,CAAC,yBAAyB,EAAE,GAAG,CAAC,GAC7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AAE,CACP,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,EAC3B,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC,2BAA2B,CAAC,KAClE,aAAa,CAAC,IAAI,CAAC,CAAA;IAExB;;;;;;;;;OASG;IACH,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC,sBAAsB,CAAC,KAAK,KAAK,CAAC,UAAU,CAAC,CAAA;IAEtG;;;;;;;;;;OAUG;IACH,OAAO,EAAE,CACP,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,EAC1B,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC,2BAA2B,CAAC,KAClE,aAAa,CAAC,UAAU,CAAC,CAAA;IAE9B;;;;;;;;;;OAUG;IACH,MAAM,EAAE,CACN,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC,0BAA0B,CAAC,KACjE,aAAa,CAAC,IAAI,CAAC,CAAA;IAExB;;;;;;;;;OASG;IACH,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC,yBAAyB,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,CAAA;IAEtG;;;;;;;;;;;;OAYG;IACH,UAAU,EAAE,CACV,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,EAC1B,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC,8BAA8B,CAAC,KACrE,aAAa,CAAC,GAAG,CAAC,CAAA;CACxB"}
@@ -21,7 +21,7 @@ import type { Pins } from './pins.js';
21
21
  import type { ProgressEvent, ProgressOptions } from 'progress-events';
22
22
  import type { CID } from 'multiformats/cid';
23
23
  import type { Blocks } from './blocks.js';
24
- export type AwaitIterable<T> = Iterable<T> | AsyncIterable<T>;
24
+ export type { Await, AwaitIterable } from 'interface-store';
25
25
  /**
26
26
  * The API presented by a Helia node.
27
27
  */
@@ -1 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AAED,MAAM,MAAM,QAAQ,GAClB,aAAa,CAAC,kBAAkB,EAAE,GAAG,CAAC,GACtC,aAAa,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;AAExC,MAAM,WAAW,SAAU,SAAQ,YAAY,EAAE,eAAe,CAAC,QAAQ,CAAC;CAEzE;AAED,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helia/interface",
3
- "version": "0.0.0-202b966",
3
+ "version": "0.0.0-42308c0",
4
4
  "description": "The Helia API",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/ipfs/helia/tree/master/packages/interface#readme",
@@ -158,7 +158,9 @@
158
158
  "@libp2p/interface-libp2p": "^1.1.0",
159
159
  "@libp2p/interface-peer-id": "^2.0.1",
160
160
  "@libp2p/interfaces": "^3.3.1",
161
+ "interface-blockstore": "^5.0.0",
161
162
  "interface-datastore": "^8.0.0",
163
+ "interface-store": "^4.0.0",
162
164
  "ipfs-bitswap": "^17.0.0",
163
165
  "multiformats": "^11.0.1",
164
166
  "progress-events": "^1.0.0"
package/src/blocks.ts CHANGED
@@ -2,7 +2,8 @@ import type { AbortOptions } from '@libp2p/interfaces'
2
2
  import type { ProgressEvent, ProgressOptions } from 'progress-events'
3
3
  import type { CID } from 'multiformats/cid'
4
4
  import type { BitswapNotifyProgressEvents, BitswapWantProgressEvents } from 'ipfs-bitswap'
5
- import type { AwaitIterable } from './index.js'
5
+ import type { AwaitIterable, Await } from './index.js'
6
+ import type { Blockstore } from 'interface-blockstore'
6
7
 
7
8
  export interface Pair {
8
9
  cid: CID
@@ -42,7 +43,7 @@ export type DeleteBlockProgressEvents =
42
43
  export type DeleteManyBlocksProgressEvents =
43
44
  ProgressEvent<'blocks:delete-many:blockstore:delete-many'>
44
45
 
45
- export interface Blocks {
46
+ export interface Blocks extends Blockstore {
46
47
  /**
47
48
  * Check for the existence of a value for the passed key
48
49
  *
@@ -57,7 +58,7 @@ export interface Blocks {
57
58
  * }
58
59
  *```
59
60
  */
60
- has: (key: CID, options?: AbortOptions) => Promise<boolean>
61
+ has: (key: CID, options?: AbortOptions) => Await<boolean>
61
62
 
62
63
  /**
63
64
  * Store the passed block under the passed CID
@@ -68,7 +69,7 @@ export interface Blocks {
68
69
  * await store.put(CID('bafyfoo'), new Uint8Array([0, 1, 2, 3]))
69
70
  * ```
70
71
  */
71
- put: (key: CID, val: Uint8Array, options?: AbortOptions & ProgressOptions<PutBlockProgressEvents>) => Promise<void>
72
+ put: (key: CID, val: Uint8Array, options?: AbortOptions & ProgressOptions<PutBlockProgressEvents>) => Await<void>
72
73
 
73
74
  /**
74
75
  * Store the given key/value pairs
@@ -85,7 +86,7 @@ export interface Blocks {
85
86
  putMany: (
86
87
  source: AwaitIterable<Pair>,
87
88
  options?: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents>
88
- ) => AsyncIterable<Pair>
89
+ ) => AwaitIterable<Pair>
89
90
 
90
91
  /**
91
92
  * Retrieve the value stored under the given key
@@ -97,7 +98,7 @@ export interface Blocks {
97
98
  * // => got content: datastore
98
99
  * ```
99
100
  */
100
- get: (key: CID, options?: AbortOptions & ProgressOptions<GetBlockProgressEvents>) => Promise<Uint8Array>
101
+ get: (key: CID, options?: AbortOptions & ProgressOptions<GetBlockProgressEvents>) => Await<Uint8Array>
101
102
 
102
103
  /**
103
104
  * Retrieve values for the passed keys
@@ -113,7 +114,7 @@ export interface Blocks {
113
114
  getMany: (
114
115
  source: AwaitIterable<CID>,
115
116
  options?: AbortOptions & ProgressOptions<GetManyBlocksProgressEvents>
116
- ) => AsyncIterable<Uint8Array>
117
+ ) => AwaitIterable<Uint8Array>
117
118
 
118
119
  /**
119
120
  * Retrieve all blocks in the blockstore
@@ -128,7 +129,7 @@ export interface Blocks {
128
129
  */
129
130
  getAll: (
130
131
  options?: AbortOptions & ProgressOptions<GetAllBlocksProgressEvents>
131
- ) => AsyncIterable<Pair>
132
+ ) => AwaitIterable<Pair>
132
133
 
133
134
  /**
134
135
  * Remove the record for the passed key
@@ -140,7 +141,7 @@ export interface Blocks {
140
141
  * console.log('deleted awesome content :(')
141
142
  * ```
142
143
  */
143
- delete: (key: CID, options?: AbortOptions & ProgressOptions<DeleteBlockProgressEvents>) => Promise<void>
144
+ delete: (key: CID, options?: AbortOptions & ProgressOptions<DeleteBlockProgressEvents>) => Await<void>
144
145
 
145
146
  /**
146
147
  * Remove values for the passed keys
@@ -158,5 +159,5 @@ export interface Blocks {
158
159
  deleteMany: (
159
160
  source: AwaitIterable<CID>,
160
161
  options?: AbortOptions & ProgressOptions<DeleteManyBlocksProgressEvents>
161
- ) => AsyncIterable<CID>
162
+ ) => AwaitIterable<CID>
162
163
  }
package/src/index.ts CHANGED
@@ -23,7 +23,7 @@ import type { ProgressEvent, ProgressOptions } from 'progress-events'
23
23
  import type { CID } from 'multiformats/cid'
24
24
  import type { Blocks } from './blocks.js'
25
25
 
26
- export type AwaitIterable<T> = Iterable<T> | AsyncIterable<T>
26
+ export type { Await, AwaitIterable } from 'interface-store'
27
27
 
28
28
  /**
29
29
  * The API presented by a Helia node.