@helia/dag-cbor 4.0.7 → 4.1.0-34d3ecd7
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 +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +9 -15
- package/src/index.ts +4 -3
- package/dist/typedoc-urls.json +0 -12
package/dist/src/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
import { CID } from 'multiformats/cid';
|
|
28
|
-
import type { GetBlockProgressEvents, PutBlockProgressEvents } from '@helia/interface/blocks';
|
|
28
|
+
import type { GetBlockProgressEvents, ProviderOptions, PutBlockProgressEvents } from '@helia/interface/blocks';
|
|
29
29
|
import type { AbortOptions } from '@libp2p/interface';
|
|
30
30
|
import type { Blockstore } from 'interface-blockstore';
|
|
31
31
|
import type { BlockCodec } from 'multiformats/codecs/interface';
|
|
@@ -37,7 +37,7 @@ export interface DAGCBORComponents {
|
|
|
37
37
|
export interface AddOptions extends AbortOptions, ProgressOptions<PutBlockProgressEvents> {
|
|
38
38
|
hasher: MultihashHasher;
|
|
39
39
|
}
|
|
40
|
-
export interface GetOptions extends AbortOptions, ProgressOptions<GetBlockProgressEvents
|
|
40
|
+
export interface GetOptions extends AbortOptions, ProgressOptions<GetBlockProgressEvents>, ProviderOptions {
|
|
41
41
|
codec: BlockCodec<any, unknown>;
|
|
42
42
|
}
|
|
43
43
|
/**
|
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;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceR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,UAAU,EAAE,UAAU,CAAA;CAAE,GAAG,OAAO,CAEnE"}
|
package/dist/src/index.js
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
import * as codec from '@ipld/dag-cbor';
|
|
28
|
+
import toBuffer from 'it-to-buffer';
|
|
28
29
|
import { CID } from 'multiformats/cid';
|
|
29
30
|
import { sha256 } from 'multiformats/hashes/sha2';
|
|
30
31
|
class DefaultDAGCBOR {
|
|
@@ -40,7 +41,7 @@ class DefaultDAGCBOR {
|
|
|
40
41
|
return cid;
|
|
41
42
|
}
|
|
42
43
|
async get(cid, options = {}) {
|
|
43
|
-
const buf = await this.components.blockstore.get(cid, options);
|
|
44
|
+
const buf = await toBuffer(this.components.blockstore.get(cid, options));
|
|
44
45
|
return codec.decode(buf);
|
|
45
46
|
}
|
|
46
47
|
}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAmEjD,MAAM,cAAc;IACD,UAAU,CAAmB;IAE9C,YAAa,UAA6B;QACxC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,GAAQ,EAAE,UAA+B,EAAE;QACpD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACzD,MAAM,GAAG,GAAG,GAAG,CAAC,QA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AED,KAAK,CAAC,GAAG,CAAM,GAAQ,EAAE,UAA+B,EAAE;QACxD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAA;QAExE,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAE,KAAiC;IACxD,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,CAAA;AAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/dag-cbor",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0-34d3ecd7",
|
|
4
4
|
"description": "Add/get IPLD blocks containing dag-cbor with your Helia node",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/ipfs/helia/tree/main/packages/dag-cbor#readme",
|
|
@@ -32,13 +32,6 @@
|
|
|
32
32
|
"import": "./dist/src/index.js"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
"eslintConfig": {
|
|
36
|
-
"extends": "ipfs",
|
|
37
|
-
"parserOptions": {
|
|
38
|
-
"project": true,
|
|
39
|
-
"sourceType": "module"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
35
|
"scripts": {
|
|
43
36
|
"clean": "aegir clean",
|
|
44
37
|
"lint": "aegir lint",
|
|
@@ -55,16 +48,17 @@
|
|
|
55
48
|
"test:electron-main": "aegir test -t electron-main"
|
|
56
49
|
},
|
|
57
50
|
"dependencies": {
|
|
58
|
-
"@helia/interface": "
|
|
59
|
-
"@ipld/dag-cbor": "^9.2.
|
|
60
|
-
"@libp2p/interface": "^
|
|
61
|
-
"interface-blockstore": "^
|
|
62
|
-
"
|
|
51
|
+
"@helia/interface": "5.4.0-34d3ecd7",
|
|
52
|
+
"@ipld/dag-cbor": "^9.2.5",
|
|
53
|
+
"@libp2p/interface": "^3.0.2",
|
|
54
|
+
"interface-blockstore": "^6.0.1",
|
|
55
|
+
"it-to-buffer": "^4.0.10",
|
|
56
|
+
"multiformats": "^13.4.1",
|
|
63
57
|
"progress-events": "^1.0.1"
|
|
64
58
|
},
|
|
65
59
|
"devDependencies": {
|
|
66
|
-
"aegir": "^47.0.
|
|
67
|
-
"blockstore-core": "^
|
|
60
|
+
"aegir": "^47.0.22",
|
|
61
|
+
"blockstore-core": "^6.0.2"
|
|
68
62
|
},
|
|
69
63
|
"sideEffects": false
|
|
70
64
|
}
|
package/src/index.ts
CHANGED
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import * as codec from '@ipld/dag-cbor'
|
|
29
|
+
import toBuffer from 'it-to-buffer'
|
|
29
30
|
import { CID } from 'multiformats/cid'
|
|
30
31
|
import { sha256 } from 'multiformats/hashes/sha2'
|
|
31
|
-
import type { GetBlockProgressEvents, PutBlockProgressEvents } from '@helia/interface/blocks'
|
|
32
|
+
import type { GetBlockProgressEvents, ProviderOptions, PutBlockProgressEvents } from '@helia/interface/blocks'
|
|
32
33
|
import type { AbortOptions } from '@libp2p/interface'
|
|
33
34
|
import type { Blockstore } from 'interface-blockstore'
|
|
34
35
|
import type { BlockCodec } from 'multiformats/codecs/interface'
|
|
@@ -43,7 +44,7 @@ export interface AddOptions extends AbortOptions, ProgressOptions<PutBlockProgre
|
|
|
43
44
|
hasher: MultihashHasher
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
export interface GetOptions extends AbortOptions, ProgressOptions<GetBlockProgressEvents
|
|
47
|
+
export interface GetOptions extends AbortOptions, ProgressOptions<GetBlockProgressEvents>, ProviderOptions {
|
|
47
48
|
codec: BlockCodec<any, unknown>
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -112,7 +113,7 @@ class DefaultDAGCBOR implements DAGCBOR {
|
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
async get <T> (cid: CID, options: Partial<GetOptions> = {}): Promise<T> {
|
|
115
|
-
const buf = await this.components.blockstore.get(cid, options)
|
|
116
|
+
const buf = await toBuffer(this.components.blockstore.get(cid, options))
|
|
116
117
|
|
|
117
118
|
return codec.decode(buf)
|
|
118
119
|
}
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"AddOptions": "https://ipfs.github.io/helia/interfaces/_helia_dag-cbor.AddOptions.html",
|
|
3
|
-
".:AddOptions": "https://ipfs.github.io/helia/interfaces/_helia_dag-cbor.AddOptions.html",
|
|
4
|
-
"DAGCBOR": "https://ipfs.github.io/helia/interfaces/_helia_dag-cbor.DAGCBOR.html",
|
|
5
|
-
".:DAGCBOR": "https://ipfs.github.io/helia/interfaces/_helia_dag-cbor.DAGCBOR.html",
|
|
6
|
-
"DAGCBORComponents": "https://ipfs.github.io/helia/interfaces/_helia_dag-cbor.DAGCBORComponents.html",
|
|
7
|
-
".:DAGCBORComponents": "https://ipfs.github.io/helia/interfaces/_helia_dag-cbor.DAGCBORComponents.html",
|
|
8
|
-
"GetOptions": "https://ipfs.github.io/helia/interfaces/_helia_dag-cbor.GetOptions.html",
|
|
9
|
-
".:GetOptions": "https://ipfs.github.io/helia/interfaces/_helia_dag-cbor.GetOptions.html",
|
|
10
|
-
"dagCbor": "https://ipfs.github.io/helia/functions/_helia_dag-cbor.dagCbor.html",
|
|
11
|
-
".:dagCbor": "https://ipfs.github.io/helia/functions/_helia_dag-cbor.dagCbor.html"
|
|
12
|
-
}
|