@helia/interface 4.1.0-9c8a2c0 → 4.1.0-9ea934e
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/blocks.d.ts +15 -26
- package/dist/src/blocks.d.ts.map +1 -1
- package/dist/src/blocks.js +0 -2
- package/dist/src/blocks.js.map +1 -1
- package/package.json +1 -1
- package/src/blocks.ts +21 -28
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
|
|
2
|
+
"use strict";var HeliaInterface=(()=>{var E=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var I=(r,o)=>{for(var t in o)E(r,t,{get:o[t],enumerable:!0})},D=(r,o,t,_)=>{if(o&&typeof o=="object"||typeof o=="function")for(let S of p(o))!x.call(r,S)&&S!==t&&E(r,S,{get:()=>o[S],enumerable:!(_=e(o,S))||_.enumerable});return r};var O=r=>D(E({},"__esModule",{value:!0}),r);var R={};I(R,{DEFAULT_SESSION_MAX_PROVIDERS:()=>A,DEFAULT_SESSION_MIN_PROVIDERS:()=>m});var m=1,A=5;return O(R);})();
|
|
3
3
|
return HeliaInterface}));
|
package/dist/src/blocks.d.ts
CHANGED
|
@@ -23,16 +23,22 @@ export interface GetOfflineOptions {
|
|
|
23
23
|
offline?: boolean;
|
|
24
24
|
}
|
|
25
25
|
export interface Blocks extends Blockstore<ProgressOptions<HasBlockProgressEvents>, ProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>, GetOfflineOptions & ProgressOptions<GetBlockProgressEvents>, GetOfflineOptions & ProgressOptions<GetManyBlocksProgressEvents>, ProgressOptions<GetAllBlocksProgressEvents>, ProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>> {
|
|
26
|
+
createSession(root: CID, options?: CreateSessionOptions<GetBlockProgressEvents>): SessionBlockstore;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A session blockstore is a special blockstore that only pulls content from a
|
|
30
|
+
* subset of network peers which respond as having the block for the initial
|
|
31
|
+
* root CID.
|
|
32
|
+
*
|
|
33
|
+
* Any blocks written to the blockstore as part of the session will propagate
|
|
34
|
+
* to the blockstore the session was created from.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
export interface SessionBlockstore extends Blockstore<ProgressOptions<HasBlockProgressEvents>, ProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>, GetOfflineOptions & ProgressOptions<GetBlockProgressEvents>, GetOfflineOptions & ProgressOptions<GetManyBlocksProgressEvents>, ProgressOptions<GetAllBlocksProgressEvents>, ProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>> {
|
|
26
38
|
/**
|
|
27
|
-
*
|
|
28
|
-
* subset of network peers which respond as having the block for the initial
|
|
29
|
-
* root CID.
|
|
30
|
-
*
|
|
31
|
-
* Any blocks written to the blockstore as part of the session will propagate
|
|
32
|
-
* to the blockstore the session was created from.
|
|
33
|
-
*
|
|
39
|
+
* Any in-progress operations will be aborted.
|
|
34
40
|
*/
|
|
35
|
-
|
|
41
|
+
close(): void;
|
|
36
42
|
}
|
|
37
43
|
export interface BlockRetrievalOptions<ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents> {
|
|
38
44
|
/**
|
|
@@ -62,21 +68,6 @@ export interface CreateSessionOptions<ProgressEvents extends ProgressEvent<any,
|
|
|
62
68
|
* @default 5
|
|
63
69
|
*/
|
|
64
70
|
maxProviders?: number;
|
|
65
|
-
/**
|
|
66
|
-
* When searching for providers of the root CID, implementations can check
|
|
67
|
-
* that providers are still online and have the requested block. This setting
|
|
68
|
-
* controls how many peers to query at the same time.
|
|
69
|
-
*
|
|
70
|
-
* @default 5
|
|
71
|
-
*/
|
|
72
|
-
providerQueryConcurrency?: number;
|
|
73
|
-
/**
|
|
74
|
-
* How long each queried provider has to respond either that they have the
|
|
75
|
-
* root block or to send it to us.
|
|
76
|
-
*
|
|
77
|
-
* @default 5000
|
|
78
|
-
*/
|
|
79
|
-
providerQueryTimeout?: number;
|
|
80
71
|
}
|
|
81
72
|
export interface BlockBroker<RetrieveProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>, AnnounceProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> {
|
|
82
73
|
/**
|
|
@@ -90,10 +81,8 @@ export interface BlockBroker<RetrieveProgressEvents extends ProgressEvent<any, a
|
|
|
90
81
|
/**
|
|
91
82
|
* Create a new session
|
|
92
83
|
*/
|
|
93
|
-
createSession?(
|
|
84
|
+
createSession?(options?: CreateSessionOptions<RetrieveProgressEvents>): BlockBroker<RetrieveProgressEvents, AnnounceProgressEvents>;
|
|
94
85
|
}
|
|
95
86
|
export declare const DEFAULT_SESSION_MIN_PROVIDERS = 1;
|
|
96
87
|
export declare const DEFAULT_SESSION_MAX_PROVIDERS = 5;
|
|
97
|
-
export declare const DEFAULT_SESSION_PROVIDER_QUERY_CONCURRENCY = 5;
|
|
98
|
-
export declare const DEFAULT_SESSION_PROVIDER_QUERY_TIMEOUT = 5000;
|
|
99
88
|
//# 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,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAA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C;IAC7L;;OAEG;IACH,QAAQ,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAEjG;;OAEG;IACH,QAAQ,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,oBAAoB,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE7G;;OAEG;IACH,aAAa,CAAC,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC,sBAAsB,CAAC,GAAG,WAAW,CAAC,sBAAsB,EAAE,sBAAsB,CAAC,CAAA;CACpI;AAED,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAC9C,eAAO,MAAM,6BAA6B,IAAI,CAAA"}
|
package/dist/src/blocks.js
CHANGED
package/dist/src/blocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"AAqIA,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAA"}
|
package/package.json
CHANGED
package/src/blocks.ts
CHANGED
|
@@ -55,17 +55,29 @@ export interface Blocks extends Blockstore<ProgressOptions<HasBlockProgressEvent
|
|
|
55
55
|
ProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>,
|
|
56
56
|
GetOfflineOptions & ProgressOptions<GetBlockProgressEvents>, GetOfflineOptions & ProgressOptions<GetManyBlocksProgressEvents>, ProgressOptions<GetAllBlocksProgressEvents>,
|
|
57
57
|
ProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>
|
|
58
|
+
> {
|
|
59
|
+
|
|
60
|
+
createSession(root: CID, options?: CreateSessionOptions<GetBlockProgressEvents>): SessionBlockstore
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A session blockstore is a special blockstore that only pulls content from a
|
|
65
|
+
* subset of network peers which respond as having the block for the initial
|
|
66
|
+
* root CID.
|
|
67
|
+
*
|
|
68
|
+
* Any blocks written to the blockstore as part of the session will propagate
|
|
69
|
+
* to the blockstore the session was created from.
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
export interface SessionBlockstore extends Blockstore<ProgressOptions<HasBlockProgressEvents>,
|
|
73
|
+
ProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>,
|
|
74
|
+
GetOfflineOptions & ProgressOptions<GetBlockProgressEvents>, GetOfflineOptions & ProgressOptions<GetManyBlocksProgressEvents>, ProgressOptions<GetAllBlocksProgressEvents>,
|
|
75
|
+
ProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>
|
|
58
76
|
> {
|
|
59
77
|
/**
|
|
60
|
-
*
|
|
61
|
-
* subset of network peers which respond as having the block for the initial
|
|
62
|
-
* root CID.
|
|
63
|
-
*
|
|
64
|
-
* Any blocks written to the blockstore as part of the session will propagate
|
|
65
|
-
* to the blockstore the session was created from.
|
|
66
|
-
*
|
|
78
|
+
* Any in-progress operations will be aborted.
|
|
67
79
|
*/
|
|
68
|
-
|
|
80
|
+
close(): void
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
export interface BlockRetrievalOptions <ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents> {
|
|
@@ -100,23 +112,6 @@ export interface CreateSessionOptions <ProgressEvents extends ProgressEvent<any,
|
|
|
100
112
|
* @default 5
|
|
101
113
|
*/
|
|
102
114
|
maxProviders?: number
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* When searching for providers of the root CID, implementations can check
|
|
106
|
-
* that providers are still online and have the requested block. This setting
|
|
107
|
-
* controls how many peers to query at the same time.
|
|
108
|
-
*
|
|
109
|
-
* @default 5
|
|
110
|
-
*/
|
|
111
|
-
providerQueryConcurrency?: number
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* How long each queried provider has to respond either that they have the
|
|
115
|
-
* root block or to send it to us.
|
|
116
|
-
*
|
|
117
|
-
* @default 5000
|
|
118
|
-
*/
|
|
119
|
-
providerQueryTimeout?: number
|
|
120
115
|
}
|
|
121
116
|
|
|
122
117
|
export interface BlockBroker<RetrieveProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>, AnnounceProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> {
|
|
@@ -133,10 +128,8 @@ export interface BlockBroker<RetrieveProgressEvents extends ProgressEvent<any, a
|
|
|
133
128
|
/**
|
|
134
129
|
* Create a new session
|
|
135
130
|
*/
|
|
136
|
-
createSession?(
|
|
131
|
+
createSession?(options?: CreateSessionOptions<RetrieveProgressEvents>): BlockBroker<RetrieveProgressEvents, AnnounceProgressEvents>
|
|
137
132
|
}
|
|
138
133
|
|
|
139
134
|
export const DEFAULT_SESSION_MIN_PROVIDERS = 1
|
|
140
135
|
export const DEFAULT_SESSION_MAX_PROVIDERS = 5
|
|
141
|
-
export const DEFAULT_SESSION_PROVIDER_QUERY_CONCURRENCY = 5
|
|
142
|
-
export const DEFAULT_SESSION_PROVIDER_QUERY_TIMEOUT = 5000
|