@helia/interface 1.2.2 → 2.0.0-0749cbf
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/dist/src/blocks.d.ts +19 -5
- package/dist/src/blocks.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/pins.d.ts +5 -5
- package/dist/src/pins.d.ts.map +1 -1
- package/package.json +7 -96
- package/src/blocks.ts +22 -5
- package/src/index.ts +4 -5
- package/src/pins.ts +5 -5
package/dist/src/blocks.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Blockstore } from 'interface-blockstore';
|
|
2
|
+
import type { AbortOptions } from 'interface-store';
|
|
2
3
|
import type { BitswapNotifyProgressEvents, BitswapWantProgressEvents } from 'ipfs-bitswap';
|
|
3
4
|
import type { CID } from 'multiformats/cid';
|
|
4
5
|
import type { ProgressEvent, ProgressOptions } from 'progress-events';
|
|
@@ -6,11 +7,11 @@ export interface Pair {
|
|
|
6
7
|
cid: CID;
|
|
7
8
|
block: Uint8Array;
|
|
8
9
|
}
|
|
9
|
-
export type HasBlockProgressEvents = ProgressEvent<'blocks:put:duplicate', CID> | ProgressEvent<'blocks:put:
|
|
10
|
-
export type PutBlockProgressEvents = ProgressEvent<'blocks:put:duplicate', CID> | ProgressEvent<'blocks:put:
|
|
11
|
-
export type PutManyBlocksProgressEvents = ProgressEvent<'blocks:put-many:duplicate', CID> | ProgressEvent<'blocks:put-many:
|
|
12
|
-
export type GetBlockProgressEvents = ProgressEvent<'blocks:get:
|
|
13
|
-
export type GetManyBlocksProgressEvents = ProgressEvent<'blocks:get-many:blockstore:get-many'> | ProgressEvent<'blocks:get-many:
|
|
10
|
+
export type HasBlockProgressEvents = ProgressEvent<'blocks:put:duplicate', CID> | ProgressEvent<'blocks:put:providers:notify', CID> | ProgressEvent<'blocks:put:blockstore:put', CID> | BitswapNotifyProgressEvents;
|
|
11
|
+
export type PutBlockProgressEvents = ProgressEvent<'blocks:put:duplicate', CID> | ProgressEvent<'blocks:put:providers:notify', CID> | ProgressEvent<'blocks:put:blockstore:put', CID> | BitswapNotifyProgressEvents;
|
|
12
|
+
export type PutManyBlocksProgressEvents = ProgressEvent<'blocks:put-many:duplicate', CID> | ProgressEvent<'blocks:put-many:providers:notify', CID> | ProgressEvent<'blocks:put-many:blockstore:put-many'> | BitswapNotifyProgressEvents;
|
|
13
|
+
export type GetBlockProgressEvents = ProgressEvent<'blocks:get:providers:want', CID> | ProgressEvent<'blocks:get:blockstore:get', CID> | ProgressEvent<'blocks:get:blockstore:put', CID> | BitswapWantProgressEvents;
|
|
14
|
+
export type GetManyBlocksProgressEvents = ProgressEvent<'blocks:get-many:blockstore:get-many'> | ProgressEvent<'blocks:get-many:providers:want', CID> | ProgressEvent<'blocks:get-many:blockstore:put', CID> | BitswapWantProgressEvents;
|
|
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'>;
|
|
@@ -22,4 +23,17 @@ export interface GetOfflineOptions {
|
|
|
22
23
|
}
|
|
23
24
|
export interface Blocks extends Blockstore<ProgressOptions<HasBlockProgressEvents>, ProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>, GetOfflineOptions & ProgressOptions<GetBlockProgressEvents>, GetOfflineOptions & ProgressOptions<GetManyBlocksProgressEvents>, ProgressOptions<GetAllBlocksProgressEvents>, ProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>> {
|
|
24
25
|
}
|
|
26
|
+
export interface BlockRetriever<GetProgressOptions extends ProgressOptions = ProgressOptions> {
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve a block from a source
|
|
29
|
+
*/
|
|
30
|
+
retrieve(cid: CID, options?: AbortOptions & GetProgressOptions): Promise<Uint8Array>;
|
|
31
|
+
}
|
|
32
|
+
export interface BlockAnnouncer<NotifyProgressOptions extends ProgressOptions = ProgressOptions> {
|
|
33
|
+
/**
|
|
34
|
+
* Make a new block available to peers
|
|
35
|
+
*/
|
|
36
|
+
announce(cid: CID, block: Uint8Array, options?: NotifyProgressOptions): void;
|
|
37
|
+
}
|
|
38
|
+
export type BlockBroker = BlockRetriever | BlockAnnouncer;
|
|
25
39
|
//# sourceMappingURL=blocks.d.ts.map
|
package/dist/src/blocks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAC1F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAErE,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,
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAC1F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAErE,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,6BAA6B,EAAE,GAAG,CAAC,GACjD,aAAa,CAAC,2BAA2B,EAAE,GAAG,CAAC,GAC/C,2BAA2B,CAAA;AAE7B,MAAM,MAAM,sBAAsB,GAChC,aAAa,CAAC,sBAAsB,EAAE,GAAG,CAAC,GAC1C,aAAa,CAAC,6BAA6B,EAAE,GAAG,CAAC,GACjD,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,kCAAkC,EAAE,GAAG,CAAC,GACtD,aAAa,CAAC,qCAAqC,CAAC,GACpD,2BAA2B,CAAA;AAE7B,MAAM,MAAM,sBAAsB,GAChC,aAAa,CAAC,2BAA2B,EAAE,GAAG,CAAC,GAC/C,aAAa,CAAC,2BAA2B,EAAE,GAAG,CAAC,GAC/C,aAAa,CAAC,2BAA2B,EAAE,GAAG,CAAC,GAC/C,yBAAyB,CAAA;AAE3B,MAAM,MAAM,2BAA2B,GACrC,aAAa,CAAC,qCAAqC,CAAC,GACpD,aAAa,CAAC,gCAAgC,EAAE,GAAG,CAAC,GACpD,aAAa,CAAC,gCAAgC,EAAE,GAAG,CAAC,GACpD,yBAAyB,CAAA;AAE3B,MAAM,MAAM,0BAA0B,GACpC,aAAa,CAAC,oCAAoC,CAAC,CAAA;AAErD,MAAM,MAAM,yBAAyB,GACnC,aAAa,CAAC,iCAAiC,EAAE,GAAG,CAAC,CAAA;AAEvD,MAAM,MAAM,8BAA8B,GACxC,aAAa,CAAC,2CAA2C,CAAC,CAAA;AAE5D,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,MAAO,SAAQ,UAAU,CAAC,eAAe,CAAC,sBAAsB,CAAC,EAClF,eAAe,CAAC,sBAAsB,CAAC,EAAE,eAAe,CAAC,2BAA2B,CAAC,EACrF,iBAAiB,GAAG,eAAe,CAAC,sBAAsB,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAAC,2BAA2B,CAAC,EAAE,eAAe,CAAC,0BAA0B,CAAC,EAC1K,eAAe,CAAC,yBAAyB,CAAC,EAAE,eAAe,CAAC,8BAA8B,CAAC,CAC1F;CAEA;AAED,MAAM,WAAW,cAAc,CAAC,kBAAkB,SAAS,eAAe,GAAG,eAAe;IAC1F;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CACrF;AAED,MAAM,WAAW,cAAc,CAAC,qBAAqB,SAAS,eAAe,GAAG,eAAe;IAC7F;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAA;CAC7E;AAED,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,cAAc,CAAA"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { Blocks } from './blocks.js';
|
|
17
17
|
import type { Pins } from './pins.js';
|
|
18
|
-
import type { Libp2p } from '@libp2p/interface
|
|
19
|
-
import type { AbortOptions } from '@libp2p/interfaces';
|
|
18
|
+
import type { Libp2p, AbortOptions } from '@libp2p/interface';
|
|
20
19
|
import type { Datastore } from 'interface-datastore';
|
|
21
20
|
import type { CID } from 'multiformats/cid';
|
|
22
21
|
import type { ProgressEvent, ProgressOptions } from 'progress-events';
|
|
@@ -44,15 +43,15 @@ export interface Helia<T = Libp2p> {
|
|
|
44
43
|
/**
|
|
45
44
|
* Starts the Helia node
|
|
46
45
|
*/
|
|
47
|
-
start
|
|
46
|
+
start(): Promise<void>;
|
|
48
47
|
/**
|
|
49
48
|
* Stops the Helia node
|
|
50
49
|
*/
|
|
51
|
-
stop
|
|
50
|
+
stop(): Promise<void>;
|
|
52
51
|
/**
|
|
53
52
|
* Remove any unpinned blocks from the blockstore
|
|
54
53
|
*/
|
|
55
|
-
gc
|
|
54
|
+
gc(options?: GCOptions): Promise<void>;
|
|
56
55
|
}
|
|
57
56
|
export type GcEvents = ProgressEvent<'helia:gc:deleted', CID> | ProgressEvent<'helia:gc:error', Error>;
|
|
58
57
|
export interface GCOptions extends AbortOptions, ProgressOptions<GcEvents> {
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -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,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,
|
|
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,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC7D,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,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"}
|
package/dist/src/pins.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GetBlockProgressEvents } from './blocks';
|
|
2
|
-
import type { AbortOptions } from '@libp2p/
|
|
2
|
+
import type { AbortOptions } from '@libp2p/interface';
|
|
3
3
|
import type { CID } from 'multiformats/cid';
|
|
4
4
|
import type { ProgressEvent, ProgressOptions } from 'progress-events';
|
|
5
5
|
export type PinType = 'recursive' | 'direct' | 'indirect';
|
|
@@ -31,19 +31,19 @@ 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
|
|
34
|
+
add(cid: CID, options?: AddOptions): Promise<Pin>;
|
|
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
|
|
39
|
+
rm(cid: CID, options?: RmOptions): Promise<Pin>;
|
|
40
40
|
/**
|
|
41
41
|
* List all blocks that have been pinned.
|
|
42
42
|
*/
|
|
43
|
-
ls
|
|
43
|
+
ls(options?: LsOptions): AsyncGenerator<Pin, void, undefined>;
|
|
44
44
|
/**
|
|
45
45
|
* Return true if the passed CID is pinned
|
|
46
46
|
*/
|
|
47
|
-
isPinned
|
|
47
|
+
isPinned(cid: CID, options?: IsPinnedOptions): Promise<boolean>;
|
|
48
48
|
}
|
|
49
49
|
//# sourceMappingURL=pins.d.ts.map
|
package/dist/src/pins.d.ts.map
CHANGED
|
@@ -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,
|
|
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,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IAEjD;;;OAGG;IACH,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IAE/C;;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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/interface",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-0749cbf",
|
|
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",
|
|
@@ -55,115 +55,26 @@
|
|
|
55
55
|
"eslintConfig": {
|
|
56
56
|
"extends": "ipfs",
|
|
57
57
|
"parserOptions": {
|
|
58
|
+
"project": true,
|
|
58
59
|
"sourceType": "module"
|
|
59
60
|
}
|
|
60
61
|
},
|
|
61
|
-
"release": {
|
|
62
|
-
"branches": [
|
|
63
|
-
"main"
|
|
64
|
-
],
|
|
65
|
-
"plugins": [
|
|
66
|
-
[
|
|
67
|
-
"@semantic-release/commit-analyzer",
|
|
68
|
-
{
|
|
69
|
-
"preset": "conventionalcommits",
|
|
70
|
-
"releaseRules": [
|
|
71
|
-
{
|
|
72
|
-
"breaking": true,
|
|
73
|
-
"release": "major"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"revert": true,
|
|
77
|
-
"release": "patch"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"type": "feat",
|
|
81
|
-
"release": "minor"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"type": "fix",
|
|
85
|
-
"release": "patch"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"type": "docs",
|
|
89
|
-
"release": "patch"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"type": "test",
|
|
93
|
-
"release": "patch"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"type": "deps",
|
|
97
|
-
"release": "patch"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"scope": "no-release",
|
|
101
|
-
"release": false
|
|
102
|
-
}
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
],
|
|
106
|
-
[
|
|
107
|
-
"@semantic-release/release-notes-generator",
|
|
108
|
-
{
|
|
109
|
-
"preset": "conventionalcommits",
|
|
110
|
-
"presetConfig": {
|
|
111
|
-
"types": [
|
|
112
|
-
{
|
|
113
|
-
"type": "feat",
|
|
114
|
-
"section": "Features"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"type": "fix",
|
|
118
|
-
"section": "Bug Fixes"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"type": "chore",
|
|
122
|
-
"section": "Trivial Changes"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"type": "docs",
|
|
126
|
-
"section": "Documentation"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"type": "deps",
|
|
130
|
-
"section": "Dependencies"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
"type": "test",
|
|
134
|
-
"section": "Tests"
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
],
|
|
140
|
-
"@semantic-release/changelog",
|
|
141
|
-
"@semantic-release/npm",
|
|
142
|
-
"@semantic-release/github",
|
|
143
|
-
"@semantic-release/git"
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
62
|
"scripts": {
|
|
147
63
|
"clean": "aegir clean",
|
|
148
64
|
"lint": "aegir lint",
|
|
149
65
|
"dep-check": "aegir dep-check",
|
|
150
|
-
"build": "aegir build"
|
|
151
|
-
"release": "aegir release"
|
|
66
|
+
"build": "aegir build"
|
|
152
67
|
},
|
|
153
68
|
"dependencies": {
|
|
154
|
-
"@libp2p/interface
|
|
155
|
-
"@libp2p/interfaces": "^3.3.2",
|
|
69
|
+
"@libp2p/interface": "^0.1.1",
|
|
156
70
|
"interface-blockstore": "^5.0.0",
|
|
157
71
|
"interface-datastore": "^8.0.0",
|
|
158
72
|
"interface-store": "^5.0.1",
|
|
159
|
-
"ipfs-bitswap": "^
|
|
160
|
-
"multiformats": "^
|
|
73
|
+
"ipfs-bitswap": "^19.0.0",
|
|
74
|
+
"multiformats": "^12.0.1",
|
|
161
75
|
"progress-events": "^1.0.0"
|
|
162
76
|
},
|
|
163
77
|
"devDependencies": {
|
|
164
|
-
"aegir": "^
|
|
165
|
-
},
|
|
166
|
-
"typedoc": {
|
|
167
|
-
"entryPoint": "./src/index.ts"
|
|
78
|
+
"aegir": "^41.0.0"
|
|
168
79
|
}
|
|
169
80
|
}
|
package/src/blocks.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Blockstore } from 'interface-blockstore'
|
|
2
|
+
import type { AbortOptions } from 'interface-store'
|
|
2
3
|
import type { BitswapNotifyProgressEvents, BitswapWantProgressEvents } from 'ipfs-bitswap'
|
|
3
4
|
import type { CID } from 'multiformats/cid'
|
|
4
5
|
import type { ProgressEvent, ProgressOptions } from 'progress-events'
|
|
@@ -10,31 +11,31 @@ export interface Pair {
|
|
|
10
11
|
|
|
11
12
|
export type HasBlockProgressEvents =
|
|
12
13
|
ProgressEvent<'blocks:put:duplicate', CID> |
|
|
13
|
-
ProgressEvent<'blocks:put:
|
|
14
|
+
ProgressEvent<'blocks:put:providers:notify', CID> |
|
|
14
15
|
ProgressEvent<'blocks:put:blockstore:put', CID> |
|
|
15
16
|
BitswapNotifyProgressEvents
|
|
16
17
|
|
|
17
18
|
export type PutBlockProgressEvents =
|
|
18
19
|
ProgressEvent<'blocks:put:duplicate', CID> |
|
|
19
|
-
ProgressEvent<'blocks:put:
|
|
20
|
+
ProgressEvent<'blocks:put:providers:notify', CID> |
|
|
20
21
|
ProgressEvent<'blocks:put:blockstore:put', CID> |
|
|
21
22
|
BitswapNotifyProgressEvents
|
|
22
23
|
|
|
23
24
|
export type PutManyBlocksProgressEvents =
|
|
24
25
|
ProgressEvent<'blocks:put-many:duplicate', CID> |
|
|
25
|
-
ProgressEvent<'blocks:put-many:
|
|
26
|
+
ProgressEvent<'blocks:put-many:providers:notify', CID> |
|
|
26
27
|
ProgressEvent<'blocks:put-many:blockstore:put-many'> |
|
|
27
28
|
BitswapNotifyProgressEvents
|
|
28
29
|
|
|
29
30
|
export type GetBlockProgressEvents =
|
|
30
|
-
ProgressEvent<'blocks:get:
|
|
31
|
+
ProgressEvent<'blocks:get:providers:want', CID> |
|
|
31
32
|
ProgressEvent<'blocks:get:blockstore:get', CID> |
|
|
32
33
|
ProgressEvent<'blocks:get:blockstore:put', CID> |
|
|
33
34
|
BitswapWantProgressEvents
|
|
34
35
|
|
|
35
36
|
export type GetManyBlocksProgressEvents =
|
|
36
37
|
ProgressEvent<'blocks:get-many:blockstore:get-many'> |
|
|
37
|
-
ProgressEvent<'blocks:get-many:
|
|
38
|
+
ProgressEvent<'blocks:get-many:providers:want', CID> |
|
|
38
39
|
ProgressEvent<'blocks:get-many:blockstore:put', CID> |
|
|
39
40
|
BitswapWantProgressEvents
|
|
40
41
|
|
|
@@ -61,3 +62,19 @@ ProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProg
|
|
|
61
62
|
> {
|
|
62
63
|
|
|
63
64
|
}
|
|
65
|
+
|
|
66
|
+
export interface BlockRetriever<GetProgressOptions extends ProgressOptions = ProgressOptions> {
|
|
67
|
+
/**
|
|
68
|
+
* Retrieve a block from a source
|
|
69
|
+
*/
|
|
70
|
+
retrieve(cid: CID, options?: AbortOptions & GetProgressOptions): Promise<Uint8Array>
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface BlockAnnouncer<NotifyProgressOptions extends ProgressOptions = ProgressOptions> {
|
|
74
|
+
/**
|
|
75
|
+
* Make a new block available to peers
|
|
76
|
+
*/
|
|
77
|
+
announce(cid: CID, block: Uint8Array, options?: NotifyProgressOptions): void
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type BlockBroker = BlockRetriever | BlockAnnouncer
|
package/src/index.ts
CHANGED
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import type { Blocks } from './blocks.js'
|
|
18
18
|
import type { Pins } from './pins.js'
|
|
19
|
-
import type { Libp2p } from '@libp2p/interface
|
|
20
|
-
import type { AbortOptions } from '@libp2p/interfaces'
|
|
19
|
+
import type { Libp2p, AbortOptions } from '@libp2p/interface'
|
|
21
20
|
import type { Datastore } from 'interface-datastore'
|
|
22
21
|
import type { CID } from 'multiformats/cid'
|
|
23
22
|
import type { ProgressEvent, ProgressOptions } from 'progress-events'
|
|
@@ -51,17 +50,17 @@ export interface Helia<T = Libp2p> {
|
|
|
51
50
|
/**
|
|
52
51
|
* Starts the Helia node
|
|
53
52
|
*/
|
|
54
|
-
start
|
|
53
|
+
start(): Promise<void>
|
|
55
54
|
|
|
56
55
|
/**
|
|
57
56
|
* Stops the Helia node
|
|
58
57
|
*/
|
|
59
|
-
stop
|
|
58
|
+
stop(): Promise<void>
|
|
60
59
|
|
|
61
60
|
/**
|
|
62
61
|
* Remove any unpinned blocks from the blockstore
|
|
63
62
|
*/
|
|
64
|
-
gc
|
|
63
|
+
gc(options?: GCOptions): Promise<void>
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
export type GcEvents =
|
package/src/pins.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GetBlockProgressEvents } from './blocks'
|
|
2
|
-
import type { AbortOptions } from '@libp2p/
|
|
2
|
+
import type { AbortOptions } from '@libp2p/interface'
|
|
3
3
|
import type { CID } from 'multiformats/cid'
|
|
4
4
|
import type { ProgressEvent, ProgressOptions } from 'progress-events'
|
|
5
5
|
|
|
@@ -43,21 +43,21 @@ 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
|
|
46
|
+
add(cid: CID, options?: AddOptions): Promise<Pin>
|
|
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
|
|
52
|
+
rm(cid: CID, options?: RmOptions): Promise<Pin>
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* List all blocks that have been pinned.
|
|
56
56
|
*/
|
|
57
|
-
ls
|
|
57
|
+
ls(options?: LsOptions): AsyncGenerator<Pin, void, undefined>
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Return true if the passed CID is pinned
|
|
61
61
|
*/
|
|
62
|
-
isPinned
|
|
62
|
+
isPinned(cid: CID, options?: IsPinnedOptions): Promise<boolean>
|
|
63
63
|
}
|