@helia/interface 2.1.0 → 3.0.0-3f4c6bf

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/README.md CHANGED
@@ -11,24 +11,24 @@
11
11
 
12
12
  > The Helia API
13
13
 
14
- ## Install
14
+ # Install
15
15
 
16
16
  ```console
17
17
  $ npm i @helia/interface
18
18
  ```
19
19
 
20
- ## API Docs
20
+ # API Docs
21
21
 
22
22
  - <https://ipfs.github.io/helia/modules/_helia_interface.html>
23
23
 
24
- ## License
24
+ # License
25
25
 
26
26
  Licensed under either of
27
27
 
28
28
  - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
29
29
  - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
30
30
 
31
- ## Contribute
31
+ # Contribute
32
32
 
33
33
  Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia/issues).
34
34
 
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { Blocks } from './blocks.js';
17
17
  import type { Pins } from './pins.js';
18
- import type { Libp2p, AbortOptions } from '@libp2p/interface';
18
+ import type { Libp2p, AbortOptions, ComponentLogger } from '@libp2p/interface';
19
19
  import type { Datastore } from 'interface-datastore';
20
20
  import type { CID } from 'multiformats/cid';
21
21
  import type { ProgressEvent, ProgressOptions } from 'progress-events';
@@ -40,6 +40,10 @@ export interface Helia<T = Libp2p> {
40
40
  * Pinning operations for blocks in the blockstore
41
41
  */
42
42
  pins: Pins;
43
+ /**
44
+ * A logging component that can be reused by consumers
45
+ */
46
+ logger: ComponentLogger;
43
47
  /**
44
48
  * Starts the Helia node
45
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,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AM,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAErE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC,GAAG,MAAM;IAC/B;;OAEG;IACH,MAAM,EAAE,CAAC,CAAA;IAET;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAA;IAEpB;;OAEG;IACH,IAAI,EAAE,IAAI,CAAA;IAEV;;OAEG;IACH,MAAM,EAAE,eAAe,CAAA;IAEvB;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAEtB;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAErB;;OAEG;IACH,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvC;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"}
@@ -31,12 +31,12 @@ export interface Pins {
31
31
  * Pin a block in the blockstore. It will not be deleted
32
32
  * when garbage collection is run.
33
33
  */
34
- add(cid: CID, options?: AddOptions): Promise<Pin>;
34
+ add(cid: CID, options?: AddOptions): AsyncGenerator<CID, void, undefined>;
35
35
  /**
36
36
  * Unpin the block that corresponds to the passed CID. The block will
37
37
  * be deleted when garbage collection is run.
38
38
  */
39
- rm(cid: CID, options?: RmOptions): Promise<Pin>;
39
+ rm(cid: CID, options?: RmOptions): AsyncGenerator<CID, void, undefined>;
40
40
  /**
41
41
  * List all blocks that have been pinned.
42
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"pins.d.ts","sourceRoot":"","sources":["../../src/pins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAErE,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAA;AAEzD,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,GAAG,CAAA;IACR,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC9B;AAED,MAAM,MAAM,YAAY,GACtB,aAAa,CAAC,eAAe,EAAE,GAAG,CAAC,CAAA;AAErC,MAAM,WAAW,UAAW,SAAQ,YAAY,EAAE,eAAe,CAAC,YAAY,GAAG,sBAAsB,CAAC;IACtG;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAA;CACrD;AAED,MAAM,WAAW,SAAU,SAAQ,YAAY;CAE9C;AAED,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAA;CACV;AAED,MAAM,WAAW,eAAgB,SAAQ,YAAY;CAEpD;AAED,MAAM,WAAW,IAAI;IACnB;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,O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AO,CAAC,CAAA;CACrD;AAED,MAAM,WAAW,SAAU,SAAQ,YAAY;CAE9C;AAED,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAA;CACV;AAED,MAAM,WAAW,eAAgB,SAAQ,YAAY;CAEpD;AAED,MAAM,WAAW,IAAI;IACnB;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IAEzE;;;OAGG;IACH,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IAEvE;;OAEG;IACH,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IAE7D;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAChE"}
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@helia/interface",
3
- "version": "2.1.0",
3
+ "version": "3.0.0-3f4c6bf",
4
4
  "description": "The Helia API",
5
5
  "license": "Apache-2.0 OR MIT",
6
- "homepage": "https://github.com/ipfs/helia/tree/master/packages/interface#readme",
6
+ "homepage": "https://github.com/ipfs/helia/tree/main/packages/interface#readme",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/ipfs/helia.git"
@@ -11,6 +11,10 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/ipfs/helia/issues"
13
13
  },
14
+ "publishConfig": {
15
+ "access": "public",
16
+ "provenance": true
17
+ },
14
18
  "keywords": [
15
19
  "IPFS"
16
20
  ],
@@ -66,15 +70,15 @@
66
70
  "build": "aegir build"
67
71
  },
68
72
  "dependencies": {
69
- "@libp2p/interface": "^0.1.1",
70
- "interface-blockstore": "^5.0.0",
71
- "interface-datastore": "^8.0.0",
72
- "interface-store": "^5.0.1",
73
- "ipfs-bitswap": "^19.0.0",
74
- "multiformats": "^12.0.1",
73
+ "@libp2p/interface": "^1.1.1",
74
+ "interface-blockstore": "^5.2.7",
75
+ "interface-datastore": "^8.2.2",
76
+ "interface-store": "^5.1.5",
77
+ "ipfs-bitswap": "^20.0.0",
78
+ "multiformats": "^13.0.0",
75
79
  "progress-events": "^1.0.0"
76
80
  },
77
81
  "devDependencies": {
78
- "aegir": "^41.0.0"
82
+ "aegir": "^42.1.0"
79
83
  }
80
84
  }
package/src/index.ts CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  import type { Blocks } from './blocks.js'
18
18
  import type { Pins } from './pins.js'
19
- import type { Libp2p, AbortOptions } from '@libp2p/interface'
19
+ import type { Libp2p, AbortOptions, ComponentLogger } from '@libp2p/interface'
20
20
  import type { Datastore } from 'interface-datastore'
21
21
  import type { CID } from 'multiformats/cid'
22
22
  import type { ProgressEvent, ProgressOptions } from 'progress-events'
@@ -47,6 +47,11 @@ export interface Helia<T = Libp2p> {
47
47
  */
48
48
  pins: Pins
49
49
 
50
+ /**
51
+ * A logging component that can be reused by consumers
52
+ */
53
+ logger: ComponentLogger
54
+
50
55
  /**
51
56
  * Starts the Helia node
52
57
  */
package/src/pins.ts CHANGED
@@ -43,13 +43,13 @@ export interface Pins {
43
43
  * Pin a block in the blockstore. It will not be deleted
44
44
  * when garbage collection is run.
45
45
  */
46
- add(cid: CID, options?: AddOptions): Promise<Pin>
46
+ add(cid: CID, options?: AddOptions): AsyncGenerator<CID, void, undefined>
47
47
 
48
48
  /**
49
49
  * Unpin the block that corresponds to the passed CID. The block will
50
50
  * be deleted when garbage collection is run.
51
51
  */
52
- rm(cid: CID, options?: RmOptions): Promise<Pin>
52
+ rm(cid: CID, options?: RmOptions): AsyncGenerator<CID, void, undefined>
53
53
 
54
54
  /**
55
55
  * List all blocks that have been pinned.
@@ -1,54 +0,0 @@
1
- {
2
- "AddOptions": "https://ipfs.github.io/helia/interfaces/helia.index.AddOptions.html",
3
- "./pins:AddOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.AddOptions.html",
4
- "BlockAnnouncer": "https://ipfs.github.io/helia/interfaces/helia.index.BlockAnnouncer.html",
5
- "./blocks:BlockAnnouncer": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.BlockAnnouncer.html",
6
- "BlockRetriever": "https://ipfs.github.io/helia/interfaces/helia.index.BlockRetriever.html",
7
- "./blocks:BlockRetriever": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.BlockRetriever.html",
8
- "Blocks": "https://ipfs.github.io/helia/interfaces/helia.index.Blocks.html",
9
- "./blocks:Blocks": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.Blocks.html",
10
- "GCOptions": "https://ipfs.github.io/helia/interfaces/helia.index.GCOptions.html",
11
- ".:GCOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.GCOptions.html",
12
- "GetOfflineOptions": "https://ipfs.github.io/helia/interfaces/helia.index.GetOfflineOptions.html",
13
- "./blocks:GetOfflineOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.GetOfflineOptions.html",
14
- "Helia": "https://ipfs.github.io/helia/interfaces/helia.index.Helia.html",
15
- ".:Helia": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.Helia.html",
16
- "IsPinnedOptions": "https://ipfs.github.io/helia/interfaces/helia.index.IsPinnedOptions.html",
17
- "./pins:IsPinnedOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.IsPinnedOptions.html",
18
- "LsOptions": "https://ipfs.github.io/helia/interfaces/helia.index.LsOptions.html",
19
- "./pins:LsOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.LsOptions.html",
20
- "Pair": "https://ipfs.github.io/helia/interfaces/helia.index.Pair.html",
21
- "./blocks:Pair": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.Pair.html",
22
- "Pin": "https://ipfs.github.io/helia/interfaces/helia.index.Pin.html",
23
- "./pins:Pin": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.Pin.html",
24
- "Pins": "https://ipfs.github.io/helia/interfaces/helia.index.Pins.html",
25
- "./pins:Pins": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.Pins.html",
26
- "RmOptions": "https://ipfs.github.io/helia/interfaces/helia.index.RmOptions.html",
27
- "./pins:RmOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.RmOptions.html",
28
- "AddPinEvents": "https://ipfs.github.io/helia/types/helia.index.AddPinEvents.html",
29
- "./pins:AddPinEvents": "https://ipfs.github.io/helia/types/_helia_interface.pins.AddPinEvents.html",
30
- "BlockBroker": "https://ipfs.github.io/helia/types/helia.index.BlockBroker.html",
31
- "./blocks:BlockBroker": "https://ipfs.github.io/helia/types/_helia_interface.blocks.BlockBroker.html",
32
- "BlockRetrievalOptions": "https://ipfs.github.io/helia/types/helia.index.BlockRetrievalOptions.html",
33
- "./blocks:BlockRetrievalOptions": "https://ipfs.github.io/helia/types/_helia_interface.blocks.BlockRetrievalOptions.html",
34
- "DeleteBlockProgressEvents": "https://ipfs.github.io/helia/types/helia.index.DeleteBlockProgressEvents.html",
35
- "./blocks:DeleteBlockProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.DeleteBlockProgressEvents.html",
36
- "DeleteManyBlocksProgressEvents": "https://ipfs.github.io/helia/types/helia.index.DeleteManyBlocksProgressEvents.html",
37
- "./blocks:DeleteManyBlocksProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.DeleteManyBlocksProgressEvents.html",
38
- "GcEvents": "https://ipfs.github.io/helia/types/helia.index.GcEvents.html",
39
- ".:GcEvents": "https://ipfs.github.io/helia/types/_helia_interface.index.GcEvents.html",
40
- "GetAllBlocksProgressEvents": "https://ipfs.github.io/helia/types/helia.index.GetAllBlocksProgressEvents.html",
41
- "./blocks:GetAllBlocksProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.GetAllBlocksProgressEvents.html",
42
- "GetBlockProgressEvents": "https://ipfs.github.io/helia/types/helia.index.GetBlockProgressEvents.html",
43
- "./blocks:GetBlockProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.GetBlockProgressEvents.html",
44
- "GetManyBlocksProgressEvents": "https://ipfs.github.io/helia/types/helia.index.GetManyBlocksProgressEvents.html",
45
- "./blocks:GetManyBlocksProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.GetManyBlocksProgressEvents.html",
46
- "HasBlockProgressEvents": "https://ipfs.github.io/helia/types/helia.index.HasBlockProgressEvents.html",
47
- "./blocks:HasBlockProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.HasBlockProgressEvents.html",
48
- "PinType": "https://ipfs.github.io/helia/types/helia.index.PinType.html",
49
- "./pins:PinType": "https://ipfs.github.io/helia/types/_helia_interface.pins.PinType.html",
50
- "PutBlockProgressEvents": "https://ipfs.github.io/helia/types/helia.index.PutBlockProgressEvents.html",
51
- "./blocks:PutBlockProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.PutBlockProgressEvents.html",
52
- "PutManyBlocksProgressEvents": "https://ipfs.github.io/helia/types/helia.index.PutManyBlocksProgressEvents.html",
53
- "./blocks:PutManyBlocksProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.PutManyBlocksProgressEvents.html"
54
- }