@helia/interface 4.3.1-5ff6998 → 4.3.1-9de08ef
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/index.min.js +1 -1
- package/dist/src/errors.d.ts +0 -8
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +0 -14
- package/dist/src/errors.js.map +1 -1
- package/dist/src/index.d.ts +18 -19
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
- package/src/errors.ts +0 -18
- package/src/index.ts +21 -23
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.HeliaInterface = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var HeliaInterface=(()=>{var s=Object.defineProperty;var
|
|
2
|
+
"use strict";var HeliaInterface=(()=>{var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var E=(o,r)=>{for(var t in r)s(o,t,{get:r[t],enumerable:!0})},f=(o,r,t,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of p(r))!x.call(o,e)&&e!==t&&s(o,e,{get:()=>r[e],enumerable:!(c=i(r,e))||c.enumerable});return o};var u=o=>f(s({},"__esModule",{value:!0}),o);var m={};E(m,{DEFAULT_SESSION_MAX_PROVIDERS:()=>l,DEFAULT_SESSION_MIN_PROVIDERS:()=>I,InsufficientProvidersError:()=>n,NoRoutersAvailableError:()=>a});var I=1,l=5;var n=class extends Error{static name="InsufficientProvidersError";constructor(r="Insufficient providers found"){super(r),this.name="InsufficientProvidersError"}},a=class extends Error{static name="NoRoutersAvailableError";constructor(r="No routers available"){super(r),this.name="NoRoutersAvailableError"}};return u(m);})();
|
|
3
3
|
return HeliaInterface}));
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -6,12 +6,4 @@ export declare class NoRoutersAvailableError extends Error {
|
|
|
6
6
|
static name: string;
|
|
7
7
|
constructor(message?: string);
|
|
8
8
|
}
|
|
9
|
-
export declare class UnknownHashAlgorithmError extends Error {
|
|
10
|
-
static name: string;
|
|
11
|
-
constructor(message?: string);
|
|
12
|
-
}
|
|
13
|
-
export declare class UnknownCodecError extends Error {
|
|
14
|
-
static name: string;
|
|
15
|
-
constructor(message?: string);
|
|
16
|
-
}
|
|
17
9
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/src/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,IAAI,SAA+B;gBAE7B,OAAO,SAAiC;CAItD;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,MAAM,CAAC,IAAI,SAA4B;gBAE1B,OAAO,SAAyB;CAI9C
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,IAAI,SAA+B;gBAE7B,OAAO,SAAiC;CAItD;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,MAAM,CAAC,IAAI,SAA4B;gBAE1B,OAAO,SAAyB;CAI9C"}
|
package/dist/src/errors.js
CHANGED
|
@@ -12,18 +12,4 @@ export class NoRoutersAvailableError extends Error {
|
|
|
12
12
|
this.name = 'NoRoutersAvailableError';
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
export class UnknownHashAlgorithmError extends Error {
|
|
16
|
-
static name = 'UnknownHashAlgorithmError';
|
|
17
|
-
constructor(message = 'Unknown hash algorithm') {
|
|
18
|
-
super(message);
|
|
19
|
-
this.name = 'UnknownHashAlgorithmError';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export class UnknownCodecError extends Error {
|
|
23
|
-
static name = 'UnknownCodecError';
|
|
24
|
-
constructor(message = 'Unknown codec') {
|
|
25
|
-
super(message);
|
|
26
|
-
this.name = 'UnknownCodecError';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
15
|
//# sourceMappingURL=errors.js.map
|
package/dist/src/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,IAAI,GAAG,4BAA4B,CAAA;IAE1C,YAAa,OAAO,GAAG,8BAA8B;QACnD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAA;IAC1C,CAAC;;AAGH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,MAAM,CAAC,IAAI,GAAG,yBAAyB,CAAA;IAEvC,YAAa,OAAO,GAAG,sBAAsB;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAA;IACvC,CAAC
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,IAAI,GAAG,4BAA4B,CAAA;IAE1C,YAAa,OAAO,GAAG,8BAA8B;QACnD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAA;IAC1C,CAAC;;AAGH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,MAAM,CAAC,IAAI,GAAG,yBAAyB,CAAA;IAEvC,YAAa,OAAO,GAAG,sBAAsB;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAA;IACvC,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -19,17 +19,10 @@ import type { Routing } from './routing.js';
|
|
|
19
19
|
import type { AbortOptions, ComponentLogger, Metrics } from '@libp2p/interface';
|
|
20
20
|
import type { DNS } from '@multiformats/dns';
|
|
21
21
|
import type { Datastore } from 'interface-datastore';
|
|
22
|
-
import type {
|
|
23
|
-
import type { BlockCodec, MultihashHasher } from 'multiformats';
|
|
22
|
+
import type { MultihashHasher } from 'multiformats';
|
|
24
23
|
import type { CID } from 'multiformats/cid';
|
|
25
24
|
import type { ProgressEvent, ProgressOptions } from 'progress-events';
|
|
26
25
|
export type { Await, AwaitIterable } from 'interface-store';
|
|
27
|
-
export interface CodecLoader {
|
|
28
|
-
<T = any, Code extends number = any>(code: Code): Await<BlockCodec<Code, T>>;
|
|
29
|
-
}
|
|
30
|
-
export interface HasherLoader {
|
|
31
|
-
(code: number): Await<MultihashHasher>;
|
|
32
|
-
}
|
|
33
26
|
/**
|
|
34
27
|
* The API presented by a Helia node
|
|
35
28
|
*/
|
|
@@ -55,6 +48,16 @@ export interface Helia {
|
|
|
55
48
|
* content providers, information about peers, etc.
|
|
56
49
|
*/
|
|
57
50
|
routing: Routing;
|
|
51
|
+
/**
|
|
52
|
+
* DAGWalkers are codec-specific implementations that know how to yield all
|
|
53
|
+
* CIDs contained within a block that corresponds to that codec.
|
|
54
|
+
*/
|
|
55
|
+
dagWalkers: Record<number, DAGWalker>;
|
|
56
|
+
/**
|
|
57
|
+
* Hashers can be used to hash a piece of data with the specified hashing
|
|
58
|
+
* algorithm.
|
|
59
|
+
*/
|
|
60
|
+
hashers: Record<number, MultihashHasher>;
|
|
58
61
|
/**
|
|
59
62
|
* The DNS property can be used to perform lookups of various record types and
|
|
60
63
|
* will use a resolver appropriate to the current platform.
|
|
@@ -77,21 +80,17 @@ export interface Helia {
|
|
|
77
80
|
* Remove any unpinned blocks from the blockstore
|
|
78
81
|
*/
|
|
79
82
|
gc(options?: GCOptions): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* Load an IPLD codec. Implementations may return a promise if, for example,
|
|
82
|
-
* the codec is being fetched from the network.
|
|
83
|
-
*/
|
|
84
|
-
getCodec: CodecLoader;
|
|
85
|
-
/**
|
|
86
|
-
* Hashers can be used to hash a piece of data with the specified hashing
|
|
87
|
-
* algorithm. Implementations may return a promise if, for example,
|
|
88
|
-
* the hasher is being fetched from the network.
|
|
89
|
-
*/
|
|
90
|
-
getHasher: HasherLoader;
|
|
91
83
|
}
|
|
92
84
|
export type GcEvents = ProgressEvent<'helia:gc:deleted', CID> | ProgressEvent<'helia:gc:error', Error>;
|
|
93
85
|
export interface GCOptions extends AbortOptions, ProgressOptions<GcEvents> {
|
|
94
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* DAGWalkers take a block and yield CIDs encoded in that block
|
|
89
|
+
*/
|
|
90
|
+
export interface DAGWalker {
|
|
91
|
+
codec: number;
|
|
92
|
+
walk(block: Uint8Array): Generator<CID, void, undefined>;
|
|
93
|
+
}
|
|
95
94
|
export * from './blocks.js';
|
|
96
95
|
export * from './errors.js';
|
|
97
96
|
export * from './pins.js';
|
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,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC/E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,E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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;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;CACzD;AAED,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAoGH,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
|
package/package.json
CHANGED
package/src/errors.ts
CHANGED
|
@@ -15,21 +15,3 @@ export class NoRoutersAvailableError extends Error {
|
|
|
15
15
|
this.name = 'NoRoutersAvailableError'
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
export class UnknownHashAlgorithmError extends Error {
|
|
20
|
-
static name = 'UnknownHashAlgorithmError'
|
|
21
|
-
|
|
22
|
-
constructor (message = 'Unknown hash algorithm') {
|
|
23
|
-
super(message)
|
|
24
|
-
this.name = 'UnknownHashAlgorithmError'
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export class UnknownCodecError extends Error {
|
|
29
|
-
static name = 'UnknownCodecError'
|
|
30
|
-
|
|
31
|
-
constructor (message = 'Unknown codec') {
|
|
32
|
-
super(message)
|
|
33
|
-
this.name = 'UnknownCodecError'
|
|
34
|
-
}
|
|
35
|
-
}
|
package/src/index.ts
CHANGED
|
@@ -20,21 +20,12 @@ import type { Routing } from './routing.js'
|
|
|
20
20
|
import type { AbortOptions, ComponentLogger, Metrics } from '@libp2p/interface'
|
|
21
21
|
import type { DNS } from '@multiformats/dns'
|
|
22
22
|
import type { Datastore } from 'interface-datastore'
|
|
23
|
-
import type {
|
|
24
|
-
import type { BlockCodec, MultihashHasher } from 'multiformats'
|
|
23
|
+
import type { MultihashHasher } from 'multiformats'
|
|
25
24
|
import type { CID } from 'multiformats/cid'
|
|
26
25
|
import type { ProgressEvent, ProgressOptions } from 'progress-events'
|
|
27
26
|
|
|
28
27
|
export type { Await, AwaitIterable } from 'interface-store'
|
|
29
28
|
|
|
30
|
-
export interface CodecLoader {
|
|
31
|
-
<T = any, Code extends number = any>(code: Code): Await<BlockCodec<Code, T>>
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface HasherLoader {
|
|
35
|
-
(code: number): Await<MultihashHasher>
|
|
36
|
-
}
|
|
37
|
-
|
|
38
29
|
/**
|
|
39
30
|
* The API presented by a Helia node
|
|
40
31
|
*/
|
|
@@ -65,6 +56,18 @@ export interface Helia {
|
|
|
65
56
|
*/
|
|
66
57
|
routing: Routing
|
|
67
58
|
|
|
59
|
+
/**
|
|
60
|
+
* DAGWalkers are codec-specific implementations that know how to yield all
|
|
61
|
+
* CIDs contained within a block that corresponds to that codec.
|
|
62
|
+
*/
|
|
63
|
+
dagWalkers: Record<number, DAGWalker>
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Hashers can be used to hash a piece of data with the specified hashing
|
|
67
|
+
* algorithm.
|
|
68
|
+
*/
|
|
69
|
+
hashers: Record<number, MultihashHasher>
|
|
70
|
+
|
|
68
71
|
/**
|
|
69
72
|
* The DNS property can be used to perform lookups of various record types and
|
|
70
73
|
* will use a resolver appropriate to the current platform.
|
|
@@ -91,19 +94,6 @@ export interface Helia {
|
|
|
91
94
|
* Remove any unpinned blocks from the blockstore
|
|
92
95
|
*/
|
|
93
96
|
gc(options?: GCOptions): Promise<void>
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Load an IPLD codec. Implementations may return a promise if, for example,
|
|
97
|
-
* the codec is being fetched from the network.
|
|
98
|
-
*/
|
|
99
|
-
getCodec: CodecLoader
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Hashers can be used to hash a piece of data with the specified hashing
|
|
103
|
-
* algorithm. Implementations may return a promise if, for example,
|
|
104
|
-
* the hasher is being fetched from the network.
|
|
105
|
-
*/
|
|
106
|
-
getHasher: HasherLoader
|
|
107
97
|
}
|
|
108
98
|
|
|
109
99
|
export type GcEvents =
|
|
@@ -114,6 +104,14 @@ export interface GCOptions extends AbortOptions, ProgressOptions<GcEvents> {
|
|
|
114
104
|
|
|
115
105
|
}
|
|
116
106
|
|
|
107
|
+
/**
|
|
108
|
+
* DAGWalkers take a block and yield CIDs encoded in that block
|
|
109
|
+
*/
|
|
110
|
+
export interface DAGWalker {
|
|
111
|
+
codec: number
|
|
112
|
+
walk(block: Uint8Array): Generator<CID, void, undefined>
|
|
113
|
+
}
|
|
114
|
+
|
|
117
115
|
export * from './blocks.js'
|
|
118
116
|
export * from './errors.js'
|
|
119
117
|
export * from './pins.js'
|