@helia/http 4.0.2 → 4.0.3-c0c34ad1
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 +3 -3
- package/dist/index.min.js.map +3 -3
- package/dist/src/index.d.ts +14 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -6
- package/dist/src/index.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +26 -10
- package/dist/typedoc-urls.json +0 -8
package/dist/src/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
import type { Helia } from '@helia/interface';
|
|
62
62
|
import type { TrustlessGatewayBlockBrokerInit } from '@helia/trustless-gateway-client';
|
|
63
63
|
export declare const DEFAULT_TRUSTLESS_GATEWAYS: string[];
|
|
64
|
-
export interface HTTPOptions {
|
|
64
|
+
export interface HTTPOptions extends TrustlessGatewayBlockBrokerInit {
|
|
65
65
|
/**
|
|
66
66
|
* Delegated routers are servers that make routing requests on behalf of peers
|
|
67
67
|
* with less capable network connectivity.
|
|
@@ -82,11 +82,21 @@ export interface HTTPOptions {
|
|
|
82
82
|
*/
|
|
83
83
|
recursiveGateways?: string[];
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* List of protocols to filter in the PeerRecords as defined in IPIP-484
|
|
86
|
+
* If undefined, PeerRecords are not filtered by protocol
|
|
86
87
|
*
|
|
87
|
-
* @see https://
|
|
88
|
+
* @see https://github.com/ipfs/specs/pull/484
|
|
89
|
+
* @default undefined
|
|
88
90
|
*/
|
|
89
|
-
|
|
91
|
+
filterProtocols?: string[];
|
|
92
|
+
/**
|
|
93
|
+
* Array of address filters to filter PeerRecords's addresses as defined in IPIP-484
|
|
94
|
+
* If undefined, PeerRecords are not filtered by address
|
|
95
|
+
*
|
|
96
|
+
* @see https://github.com/ipfs/specs/pull/484
|
|
97
|
+
* @default undefined
|
|
98
|
+
*/
|
|
99
|
+
filterAddrs?: string[];
|
|
90
100
|
}
|
|
91
101
|
/**
|
|
92
102
|
* Augment a Helia node with HTTP routers and block brokers
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAA;AAEtF,eAAO,MAAM,0BAA0B,UAMtC,CAAA;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAA;AAEtF,eAAO,MAAM,0BAA0B,UAMtC,CAAA;AAED,MAAM,WAAW,WAAY,SAAQ,+BAA+B;IAClE;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE3B;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE5B;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAE1B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CACvB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAE,CAAC,SAAS,KAAK,EAAG,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,CAAC,CAwB3E"}
|
package/dist/src/index.js
CHANGED
|
@@ -71,19 +71,24 @@ export const DEFAULT_TRUSTLESS_GATEWAYS = [
|
|
|
71
71
|
* Augment a Helia node with HTTP routers and block brokers
|
|
72
72
|
*/
|
|
73
73
|
export function withHTTP(helia, init) {
|
|
74
|
-
init?.delegatedRouters ?? [
|
|
74
|
+
(init?.delegatedRouters ?? [
|
|
75
75
|
'https://delegated-ipfs.dev'
|
|
76
|
-
].forEach(url => {
|
|
76
|
+
]).forEach(url => {
|
|
77
77
|
helia.addRouter(delegatedHTTPRouter({
|
|
78
|
+
...init,
|
|
78
79
|
url
|
|
79
80
|
}));
|
|
80
81
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
// add recursive gateways as fallback if configured
|
|
83
|
+
const recursiveGateways = init?.recursiveGateways ?? DEFAULT_TRUSTLESS_GATEWAYS;
|
|
84
|
+
if (recursiveGateways.length > 0) {
|
|
85
|
+
helia.addRouter(fallbackRouter({
|
|
86
|
+
gateways: recursiveGateways
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
84
89
|
// add trustless gateway block broker
|
|
85
90
|
if (!helia.hasBlockBroker('trustless-gateway')) {
|
|
86
|
-
helia.addBlockBroker(trustlessGatewayBlockBroker(init
|
|
91
|
+
helia.addBlockBroker(trustlessGatewayBlockBroker(init));
|
|
87
92
|
}
|
|
88
93
|
return helia;
|
|
89
94
|
}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAA;AAI7E,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,sGAAsG;IACtG,g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 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/http",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3-c0c34ad1",
|
|
4
4
|
"description": "A lightweight implementation of IPFS over HTTP in JavaScript",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/ipfs/helia/tree/main/packages/http#readme",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"test:electron-main": "aegir test -t electron-main"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@helia/delegated-routing-client": "
|
|
52
|
-
"@helia/fallback-router": "
|
|
53
|
-
"@helia/interface": "
|
|
54
|
-
"@helia/trustless-gateway-client": "
|
|
51
|
+
"@helia/delegated-routing-client": "1.0.3-c0c34ad1",
|
|
52
|
+
"@helia/fallback-router": "1.0.2-c0c34ad1",
|
|
53
|
+
"@helia/interface": "7.0.2-c0c34ad1",
|
|
54
|
+
"@helia/trustless-gateway-client": "1.0.2-c0c34ad1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"aegir": "^48.0.11",
|
package/src/index.ts
CHANGED
|
@@ -73,7 +73,7 @@ export const DEFAULT_TRUSTLESS_GATEWAYS = [
|
|
|
73
73
|
'https://4everland.io'
|
|
74
74
|
]
|
|
75
75
|
|
|
76
|
-
export interface HTTPOptions {
|
|
76
|
+
export interface HTTPOptions extends TrustlessGatewayBlockBrokerInit {
|
|
77
77
|
/**
|
|
78
78
|
* Delegated routers are servers that make routing requests on behalf of peers
|
|
79
79
|
* with less capable network connectivity.
|
|
@@ -96,32 +96,48 @@ export interface HTTPOptions {
|
|
|
96
96
|
recursiveGateways?: string[]
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
99
|
+
* List of protocols to filter in the PeerRecords as defined in IPIP-484
|
|
100
|
+
* If undefined, PeerRecords are not filtered by protocol
|
|
100
101
|
*
|
|
101
|
-
* @see https://
|
|
102
|
+
* @see https://github.com/ipfs/specs/pull/484
|
|
103
|
+
* @default undefined
|
|
102
104
|
*/
|
|
103
|
-
|
|
105
|
+
filterProtocols?: string[]
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Array of address filters to filter PeerRecords's addresses as defined in IPIP-484
|
|
109
|
+
* If undefined, PeerRecords are not filtered by address
|
|
110
|
+
*
|
|
111
|
+
* @see https://github.com/ipfs/specs/pull/484
|
|
112
|
+
* @default undefined
|
|
113
|
+
*/
|
|
114
|
+
filterAddrs?: string[]
|
|
104
115
|
}
|
|
105
116
|
|
|
106
117
|
/**
|
|
107
118
|
* Augment a Helia node with HTTP routers and block brokers
|
|
108
119
|
*/
|
|
109
120
|
export function withHTTP <H extends Helia> (helia: H, init?: HTTPOptions): H {
|
|
110
|
-
init?.delegatedRouters ?? [
|
|
121
|
+
(init?.delegatedRouters ?? [
|
|
111
122
|
'https://delegated-ipfs.dev'
|
|
112
|
-
].forEach(url => {
|
|
123
|
+
]).forEach(url => {
|
|
113
124
|
helia.addRouter(delegatedHTTPRouter({
|
|
125
|
+
...init,
|
|
114
126
|
url
|
|
115
127
|
}))
|
|
116
128
|
})
|
|
117
129
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
130
|
+
// add recursive gateways as fallback if configured
|
|
131
|
+
const recursiveGateways = init?.recursiveGateways ?? DEFAULT_TRUSTLESS_GATEWAYS
|
|
132
|
+
if (recursiveGateways.length > 0) {
|
|
133
|
+
helia.addRouter(fallbackRouter({
|
|
134
|
+
gateways: recursiveGateways
|
|
135
|
+
}))
|
|
136
|
+
}
|
|
121
137
|
|
|
122
138
|
// add trustless gateway block broker
|
|
123
139
|
if (!helia.hasBlockBroker('trustless-gateway')) {
|
|
124
|
-
helia.addBlockBroker(trustlessGatewayBlockBroker(init
|
|
140
|
+
helia.addBlockBroker(trustlessGatewayBlockBroker(init))
|
|
125
141
|
}
|
|
126
142
|
|
|
127
143
|
return helia
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"HTTPOptions": "https://ipfs.github.io/helia/interfaces/_helia_http.HTTPOptions.html",
|
|
3
|
-
".:HTTPOptions": "https://ipfs.github.io/helia/interfaces/_helia_http.HTTPOptions.html",
|
|
4
|
-
"DEFAULT_TRUSTLESS_GATEWAYS": "https://ipfs.github.io/helia/variables/_helia_http.DEFAULT_TRUSTLESS_GATEWAYS.html",
|
|
5
|
-
".:DEFAULT_TRUSTLESS_GATEWAYS": "https://ipfs.github.io/helia/variables/_helia_http.DEFAULT_TRUSTLESS_GATEWAYS.html",
|
|
6
|
-
"withHTTP": "https://ipfs.github.io/helia/functions/_helia_http.withHTTP.html",
|
|
7
|
-
".:withHTTP": "https://ipfs.github.io/helia/functions/_helia_http.withHTTP.html"
|
|
8
|
-
}
|