@helia/http 4.0.2-4f472034 → 4.0.2-f4eb7d27
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 +2 -2
- package/dist/index.min.js.map +2 -2
- package/dist/src/index.d.ts +1 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -4
- package/dist/src/index.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +7 -12
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.
|
|
@@ -81,12 +81,6 @@ export interface HTTPOptions {
|
|
|
81
81
|
* @see https://docs.ipfs.tech/concepts/ipfs-gateway/#recursive-vs-non-recursive-gateways
|
|
82
82
|
*/
|
|
83
83
|
recursiveGateways?: string[];
|
|
84
|
-
/**
|
|
85
|
-
* Init arg passed to the trustless gateway block broker
|
|
86
|
-
*
|
|
87
|
-
* @see https://docs.ipfs.tech/reference/http/gateway/#trusted-vs-trustless
|
|
88
|
-
*/
|
|
89
|
-
trustlessGatewayBlockBrokerInit?: TrustlessGatewayBlockBrokerInit;
|
|
90
84
|
}
|
|
91
85
|
/**
|
|
92
86
|
* 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;CAC7B;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAE,CAAC,SAAS,KAAK,EAAG,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,CAAC,CAqB3E"}
|
package/dist/src/index.js
CHANGED
|
@@ -71,11 +71,13 @@ 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
|
-
url
|
|
78
|
+
url,
|
|
79
|
+
filterProtocols: ['unknown', 'transport-ipfs-gateway-http'],
|
|
80
|
+
filterAddrs: ['https', ...(init?.allowInsecure === true ? ['http'] : [])]
|
|
79
81
|
}));
|
|
80
82
|
});
|
|
81
83
|
helia.addRouter(fallbackRouter({
|
|
@@ -83,7 +85,7 @@ export function withHTTP(helia, init) {
|
|
|
83
85
|
}));
|
|
84
86
|
// add trustless gateway block broker
|
|
85
87
|
if (!helia.hasBlockBroker('trustless-gateway')) {
|
|
86
|
-
helia.addBlockBroker(trustlessGatewayBlockBroker(init
|
|
88
|
+
helia.addBlockBroker(trustlessGatewayBlockBroker(init));
|
|
87
89
|
}
|
|
88
90
|
return helia;
|
|
89
91
|
}
|
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,gCAAgC;IAEhC,sGAAsG;IACtG,sBAAsB;CACvB,CAAA;
|
|
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,gCAAgC;IAEhC,sGAAsG;IACtG,sBAAsB;CACvB,CAAA;AAyBD;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAoB,KAAQ,EAAE,IAAkB;IACtE,CAAC,IAAI,EAAE,gBAAgB,IAAI;QACzB,4BAA4B;KAC7B,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACf,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC;YAClC,GAAG;YACH,eAAe,EAAE,CAAC,SAAS,EAAE,6BAA6B,CAAC;YAC3D,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAC1E,CAAC,CAAC,CAAA;IACL,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;QAC7B,QAAQ,EAAE,IAAI,EAAE,iBAAiB,IAAI,0BAA0B;KAChE,CAAC,CAAC,CAAA;IAEH,qCAAqC;IACrC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC/C,KAAK,CAAC,cAAc,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAA;IACzD,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/http",
|
|
3
|
-
"version": "4.0.2-
|
|
3
|
+
"version": "4.0.2-f4eb7d27",
|
|
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": "1.0.2-
|
|
52
|
-
"@helia/fallback-router": "1.0.2-
|
|
53
|
-
"@helia/interface": "7.0.2-
|
|
54
|
-
"@helia/trustless-gateway-client": "1.0.2-
|
|
51
|
+
"@helia/delegated-routing-client": "1.0.2-f4eb7d27",
|
|
52
|
+
"@helia/fallback-router": "1.0.2-f4eb7d27",
|
|
53
|
+
"@helia/interface": "7.0.2-f4eb7d27",
|
|
54
|
+
"@helia/trustless-gateway-client": "1.0.2-f4eb7d27"
|
|
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.
|
|
@@ -94,24 +94,19 @@ export interface HTTPOptions {
|
|
|
94
94
|
* @see https://docs.ipfs.tech/concepts/ipfs-gateway/#recursive-vs-non-recursive-gateways
|
|
95
95
|
*/
|
|
96
96
|
recursiveGateways?: string[]
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Init arg passed to the trustless gateway block broker
|
|
100
|
-
*
|
|
101
|
-
* @see https://docs.ipfs.tech/reference/http/gateway/#trusted-vs-trustless
|
|
102
|
-
*/
|
|
103
|
-
trustlessGatewayBlockBrokerInit?: TrustlessGatewayBlockBrokerInit
|
|
104
97
|
}
|
|
105
98
|
|
|
106
99
|
/**
|
|
107
100
|
* Augment a Helia node with HTTP routers and block brokers
|
|
108
101
|
*/
|
|
109
102
|
export function withHTTP <H extends Helia> (helia: H, init?: HTTPOptions): H {
|
|
110
|
-
init?.delegatedRouters ?? [
|
|
103
|
+
(init?.delegatedRouters ?? [
|
|
111
104
|
'https://delegated-ipfs.dev'
|
|
112
|
-
].forEach(url => {
|
|
105
|
+
]).forEach(url => {
|
|
113
106
|
helia.addRouter(delegatedHTTPRouter({
|
|
114
|
-
url
|
|
107
|
+
url,
|
|
108
|
+
filterProtocols: ['unknown', 'transport-ipfs-gateway-http'],
|
|
109
|
+
filterAddrs: ['https', ...(init?.allowInsecure === true ? ['http'] : [])]
|
|
115
110
|
}))
|
|
116
111
|
})
|
|
117
112
|
|
|
@@ -121,7 +116,7 @@ export function withHTTP <H extends Helia> (helia: H, init?: HTTPOptions): H {
|
|
|
121
116
|
|
|
122
117
|
// add trustless gateway block broker
|
|
123
118
|
if (!helia.hasBlockBroker('trustless-gateway')) {
|
|
124
|
-
helia.addBlockBroker(trustlessGatewayBlockBroker(init
|
|
119
|
+
helia.addBlockBroker(trustlessGatewayBlockBroker(init))
|
|
125
120
|
}
|
|
126
121
|
|
|
127
122
|
return helia
|