@helia/interface 0.0.0-031ca73 → 0.0.0-0d89887
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 -0
- package/dist/src/blocks.d.ts.map +1 -0
- package/dist/src/blocks.js +2 -0
- package/dist/src/blocks.js.map +1 -0
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +10 -91
- package/src/blocks.ts +56 -0
- package/src/index.ts +6 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ProgressEvent, ProgressOptions } from 'progress-events';
|
|
2
|
+
import type { CID } from 'multiformats/cid';
|
|
3
|
+
import type { BitswapNotifyProgressEvents, BitswapWantProgressEvents } from 'ipfs-bitswap';
|
|
4
|
+
import type { Blockstore } from 'interface-blockstore';
|
|
5
|
+
export interface Pair {
|
|
6
|
+
cid: CID;
|
|
7
|
+
block: Uint8Array;
|
|
8
|
+
}
|
|
9
|
+
export type HasBlockProgressEvents = ProgressEvent<'blocks:put:duplicate', CID> | ProgressEvent<'blocks:put:bitswap:notify', CID> | ProgressEvent<'blocks:put:blockstore:put', CID> | BitswapNotifyProgressEvents;
|
|
10
|
+
export type PutBlockProgressEvents = ProgressEvent<'blocks:put:duplicate', CID> | ProgressEvent<'blocks:put:bitswap:notify', CID> | ProgressEvent<'blocks:put:blockstore:put', CID> | BitswapNotifyProgressEvents;
|
|
11
|
+
export type PutManyBlocksProgressEvents = ProgressEvent<'blocks:put-many:duplicate', CID> | ProgressEvent<'blocks:put-many:bitswap:notify', CID> | ProgressEvent<'blocks:put-many:blockstore:put-many'> | BitswapNotifyProgressEvents;
|
|
12
|
+
export type GetBlockProgressEvents = ProgressEvent<'blocks:get:bitswap:want', CID> | ProgressEvent<'blocks:get:blockstore:get', CID> | ProgressEvent<'blocks:get:blockstore:put', CID> | BitswapWantProgressEvents;
|
|
13
|
+
export type GetManyBlocksProgressEvents = ProgressEvent<'blocks:get-many:blockstore:get-many'> | ProgressEvent<'blocks:get-many:bitswap:want', CID> | ProgressEvent<'blocks:get-many:blockstore:put', CID> | BitswapWantProgressEvents;
|
|
14
|
+
export type GetAllBlocksProgressEvents = ProgressEvent<'blocks:get-all:blockstore:get-many'>;
|
|
15
|
+
export type DeleteBlockProgressEvents = ProgressEvent<'blocks:delete:blockstore:delete', CID>;
|
|
16
|
+
export type DeleteManyBlocksProgressEvents = ProgressEvent<'blocks:delete-many:blockstore:delete-many'>;
|
|
17
|
+
export interface Blocks extends Blockstore<ProgressOptions<HasBlockProgressEvents>, ProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>, ProgressOptions<GetBlockProgressEvents>, ProgressOptions<GetManyBlocksProgressEvents>, ProgressOptions<GetAllBlocksProgressEvents>, ProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>> {
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"AAAA,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,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,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/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AC,CAC1F;CAEA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":""}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
import type { Libp2p } from '@libp2p/interface-libp2p';
|
|
17
|
-
import type { Blockstore } from 'interface-blockstore';
|
|
18
17
|
import type { AbortOptions } from '@libp2p/interfaces';
|
|
19
18
|
import type { PeerId } from '@libp2p/interface-peer-id';
|
|
20
19
|
import type { Datastore } from 'interface-datastore';
|
|
21
20
|
import type { Pins } from './pins.js';
|
|
22
21
|
import type { ProgressEvent, ProgressOptions } from 'progress-events';
|
|
23
22
|
import type { CID } from 'multiformats/cid';
|
|
23
|
+
import type { Blocks } from './blocks.js';
|
|
24
|
+
export type { Await, AwaitIterable } from 'interface-store';
|
|
24
25
|
/**
|
|
25
26
|
* The API presented by a Helia node.
|
|
26
27
|
*/
|
|
@@ -32,7 +33,7 @@ export interface Helia {
|
|
|
32
33
|
/**
|
|
33
34
|
* Where the blocks are stored
|
|
34
35
|
*/
|
|
35
|
-
blockstore:
|
|
36
|
+
blockstore: Blocks;
|
|
36
37
|
/**
|
|
37
38
|
* A key/value store
|
|
38
39
|
*/
|
|
@@ -54,7 +55,7 @@ export interface Helia {
|
|
|
54
55
|
*/
|
|
55
56
|
gc: (options?: GCOptions) => Promise<void>;
|
|
56
57
|
}
|
|
57
|
-
export type GcEvents = ProgressEvent<'helia:gc:deleted', CID>;
|
|
58
|
+
export type GcEvents = ProgressEvent<'helia:gc:deleted', CID> | ProgressEvent<'helia:gc:error', Error>;
|
|
58
59
|
export interface GCOptions extends AbortOptions, ProgressOptions<GcEvents> {
|
|
59
60
|
}
|
|
60
61
|
export interface InfoOptions extends AbortOptions {
|
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,0BAA0B,CAAA;AACtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAA;IAEpB;;OAEG;IACH,IAAI,EAAE,IAAI,CAAA;IAEV;;OAEG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAE1B;;OAEG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzB;;OAEG;IACH,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3C;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-
|
|
3
|
+
"version": "0.0.0-0d89887",
|
|
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",
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"types": "./dist/src/index.d.ts",
|
|
48
48
|
"import": "./dist/src/index.js"
|
|
49
49
|
},
|
|
50
|
+
"./blocks": {
|
|
51
|
+
"types": "./dist/src/blocks.d.ts",
|
|
52
|
+
"import": "./dist/src/blocks.js"
|
|
53
|
+
},
|
|
50
54
|
"./pins": {
|
|
51
55
|
"types": "./dist/src/pins.d.ts",
|
|
52
56
|
"import": "./dist/src/pins.js"
|
|
@@ -58,105 +62,20 @@
|
|
|
58
62
|
"sourceType": "module"
|
|
59
63
|
}
|
|
60
64
|
},
|
|
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
65
|
"scripts": {
|
|
147
66
|
"clean": "aegir clean",
|
|
148
67
|
"lint": "aegir lint",
|
|
149
68
|
"dep-check": "aegir dep-check",
|
|
150
|
-
"build": "aegir build"
|
|
151
|
-
"release": "aegir release"
|
|
69
|
+
"build": "aegir build"
|
|
152
70
|
},
|
|
153
71
|
"dependencies": {
|
|
154
72
|
"@libp2p/interface-libp2p": "^1.1.0",
|
|
155
73
|
"@libp2p/interface-peer-id": "^2.0.1",
|
|
156
74
|
"@libp2p/interfaces": "^3.3.1",
|
|
157
|
-
"
|
|
158
|
-
"interface-
|
|
159
|
-
"interface-
|
|
75
|
+
"interface-blockstore": "^5.0.0",
|
|
76
|
+
"interface-datastore": "^8.0.0",
|
|
77
|
+
"interface-store": "^4.0.0",
|
|
78
|
+
"ipfs-bitswap": "^17.0.0",
|
|
160
79
|
"multiformats": "^11.0.1",
|
|
161
80
|
"progress-events": "^1.0.0"
|
|
162
81
|
},
|
package/src/blocks.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ProgressEvent, ProgressOptions } from 'progress-events'
|
|
2
|
+
import type { CID } from 'multiformats/cid'
|
|
3
|
+
import type { BitswapNotifyProgressEvents, BitswapWantProgressEvents } from 'ipfs-bitswap'
|
|
4
|
+
import type { Blockstore } from 'interface-blockstore'
|
|
5
|
+
|
|
6
|
+
export interface Pair {
|
|
7
|
+
cid: CID
|
|
8
|
+
block: Uint8Array
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type HasBlockProgressEvents =
|
|
12
|
+
ProgressEvent<'blocks:put:duplicate', CID> |
|
|
13
|
+
ProgressEvent<'blocks:put:bitswap:notify', CID> |
|
|
14
|
+
ProgressEvent<'blocks:put:blockstore:put', CID> |
|
|
15
|
+
BitswapNotifyProgressEvents
|
|
16
|
+
|
|
17
|
+
export type PutBlockProgressEvents =
|
|
18
|
+
ProgressEvent<'blocks:put:duplicate', CID> |
|
|
19
|
+
ProgressEvent<'blocks:put:bitswap:notify', CID> |
|
|
20
|
+
ProgressEvent<'blocks:put:blockstore:put', CID> |
|
|
21
|
+
BitswapNotifyProgressEvents
|
|
22
|
+
|
|
23
|
+
export type PutManyBlocksProgressEvents =
|
|
24
|
+
ProgressEvent<'blocks:put-many:duplicate', CID> |
|
|
25
|
+
ProgressEvent<'blocks:put-many:bitswap:notify', CID> |
|
|
26
|
+
ProgressEvent<'blocks:put-many:blockstore:put-many'> |
|
|
27
|
+
BitswapNotifyProgressEvents
|
|
28
|
+
|
|
29
|
+
export type GetBlockProgressEvents =
|
|
30
|
+
ProgressEvent<'blocks:get:bitswap:want', CID> |
|
|
31
|
+
ProgressEvent<'blocks:get:blockstore:get', CID> |
|
|
32
|
+
ProgressEvent<'blocks:get:blockstore:put', CID> |
|
|
33
|
+
BitswapWantProgressEvents
|
|
34
|
+
|
|
35
|
+
export type GetManyBlocksProgressEvents =
|
|
36
|
+
ProgressEvent<'blocks:get-many:blockstore:get-many'> |
|
|
37
|
+
ProgressEvent<'blocks:get-many:bitswap:want', CID> |
|
|
38
|
+
ProgressEvent<'blocks:get-many:blockstore:put', CID> |
|
|
39
|
+
BitswapWantProgressEvents
|
|
40
|
+
|
|
41
|
+
export type GetAllBlocksProgressEvents =
|
|
42
|
+
ProgressEvent<'blocks:get-all:blockstore:get-many'>
|
|
43
|
+
|
|
44
|
+
export type DeleteBlockProgressEvents =
|
|
45
|
+
ProgressEvent<'blocks:delete:blockstore:delete', CID>
|
|
46
|
+
|
|
47
|
+
export type DeleteManyBlocksProgressEvents =
|
|
48
|
+
ProgressEvent<'blocks:delete-many:blockstore:delete-many'>
|
|
49
|
+
|
|
50
|
+
export interface Blocks extends Blockstore<ProgressOptions<HasBlockProgressEvents>,
|
|
51
|
+
ProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>,
|
|
52
|
+
ProgressOptions<GetBlockProgressEvents>, ProgressOptions<GetManyBlocksProgressEvents>, ProgressOptions<GetAllBlocksProgressEvents>,
|
|
53
|
+
ProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>
|
|
54
|
+
> {
|
|
55
|
+
|
|
56
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -15,13 +15,15 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { Libp2p } from '@libp2p/interface-libp2p'
|
|
18
|
-
import type { Blockstore } from 'interface-blockstore'
|
|
19
18
|
import type { AbortOptions } from '@libp2p/interfaces'
|
|
20
19
|
import type { PeerId } from '@libp2p/interface-peer-id'
|
|
21
20
|
import type { Datastore } from 'interface-datastore'
|
|
22
21
|
import type { Pins } from './pins.js'
|
|
23
22
|
import type { ProgressEvent, ProgressOptions } from 'progress-events'
|
|
24
23
|
import type { CID } from 'multiformats/cid'
|
|
24
|
+
import type { Blocks } from './blocks.js'
|
|
25
|
+
|
|
26
|
+
export type { Await, AwaitIterable } from 'interface-store'
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* The API presented by a Helia node.
|
|
@@ -35,7 +37,7 @@ export interface Helia {
|
|
|
35
37
|
/**
|
|
36
38
|
* Where the blocks are stored
|
|
37
39
|
*/
|
|
38
|
-
blockstore:
|
|
40
|
+
blockstore: Blocks
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* A key/value store
|
|
@@ -64,7 +66,8 @@ export interface Helia {
|
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
export type GcEvents =
|
|
67
|
-
ProgressEvent<'helia:gc:deleted', CID>
|
|
69
|
+
ProgressEvent<'helia:gc:deleted', CID> |
|
|
70
|
+
ProgressEvent<'helia:gc:error', Error>
|
|
68
71
|
|
|
69
72
|
export interface GCOptions extends AbortOptions, ProgressOptions<GcEvents> {
|
|
70
73
|
|