@helia/verified-fetch 2.6.13 → 2.6.15
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 +4 -4
- package/dist/index.min.js +56 -56
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/plugins/plugin-handle-car.d.ts.map +1 -1
- package/dist/src/plugins/plugin-handle-car.js +5 -1
- package/dist/src/plugins/plugin-handle-car.js.map +1 -1
- package/dist/src/plugins/plugin-handle-dag-pb.js +2 -2
- package/dist/src/plugins/plugin-handle-dag-pb.js.map +1 -1
- package/dist/src/plugins/plugin-handle-raw.js +1 -1
- package/dist/src/plugins/plugin-handle-raw.js.map +1 -1
- package/dist/src/utils/get-stream-from-async-iterable.d.ts +1 -1
- package/dist/src/utils/get-stream-from-async-iterable.d.ts.map +1 -1
- package/dist/src/utils/get-stream-from-async-iterable.js.map +1 -1
- package/dist/src/utils/get-tar-stream.d.ts.map +1 -1
- package/dist/src/utils/get-tar-stream.js.map +1 -1
- package/dist/src/utils/handle-redirects.d.ts +2 -2
- package/dist/src/utils/handle-redirects.d.ts.map +1 -1
- package/dist/src/utils/handle-redirects.js +0 -2
- package/dist/src/utils/handle-redirects.js.map +1 -1
- package/dist/src/utils/libp2p-defaults.browser.d.ts.map +1 -1
- package/dist/src/utils/libp2p-defaults.browser.js.map +1 -1
- package/dist/src/utils/libp2p-defaults.d.ts.map +1 -1
- package/dist/src/utils/libp2p-defaults.js.map +1 -1
- package/dist/src/utils/parse-url-string.d.ts +1 -1
- package/dist/src/utils/parse-url-string.d.ts.map +1 -1
- package/dist/src/utils/parse-url-string.js.map +1 -1
- package/dist/src/utils/set-content-type.d.ts +9 -3
- package/dist/src/utils/set-content-type.d.ts.map +1 -1
- package/dist/src/utils/set-content-type.js +9 -5
- package/dist/src/utils/set-content-type.js.map +1 -1
- package/dist/src/utils/walk-path.d.ts +3 -3
- package/dist/src/utils/walk-path.d.ts.map +1 -1
- package/dist/src/utils/walk-path.js +0 -2
- package/dist/src/utils/walk-path.js.map +1 -1
- package/dist/src/verified-fetch.d.ts +1 -1
- package/dist/src/verified-fetch.d.ts.map +1 -1
- package/dist/src/verified-fetch.js +0 -3
- package/dist/src/verified-fetch.js.map +1 -1
- package/package.json +54 -30
- package/src/index.ts +7 -5
- package/src/plugins/plugin-handle-car.ts +5 -1
- package/src/plugins/plugin-handle-dag-pb.ts +2 -2
- package/src/plugins/plugin-handle-raw.ts +1 -1
- package/src/utils/get-stream-from-async-iterable.ts +2 -1
- package/src/utils/get-tar-stream.ts +4 -2
- package/src/utils/handle-redirects.ts +2 -2
- package/src/utils/libp2p-defaults.browser.ts +2 -1
- package/src/utils/libp2p-defaults.ts +2 -1
- package/src/utils/parse-url-string.ts +2 -1
- package/src/utils/set-content-type.ts +17 -5
- package/src/utils/walk-path.ts +4 -3
- package/src/verified-fetch.ts +5 -4
- package/LICENSE +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/verified-fetch",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.15",
|
|
4
4
|
"description": "A fetch-like API for obtaining verified & trustless IPFS content on the web",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/ipfs/helia-verified-fetch/tree/main/packages/verified-fetch#readme",
|
|
@@ -22,6 +22,22 @@
|
|
|
22
22
|
],
|
|
23
23
|
"type": "module",
|
|
24
24
|
"types": "./dist/src/index.d.ts",
|
|
25
|
+
"typesVersions": {
|
|
26
|
+
"*": {
|
|
27
|
+
"*": [
|
|
28
|
+
"*",
|
|
29
|
+
"dist/*",
|
|
30
|
+
"dist/src/*",
|
|
31
|
+
"dist/src/*/index"
|
|
32
|
+
],
|
|
33
|
+
"src/*": [
|
|
34
|
+
"*",
|
|
35
|
+
"dist/*",
|
|
36
|
+
"dist/src/*",
|
|
37
|
+
"dist/src/*/index"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
25
41
|
"files": [
|
|
26
42
|
"src",
|
|
27
43
|
"dist",
|
|
@@ -127,7 +143,15 @@
|
|
|
127
143
|
"@semantic-release/changelog",
|
|
128
144
|
"@semantic-release/npm",
|
|
129
145
|
"@semantic-release/github",
|
|
130
|
-
|
|
146
|
+
[
|
|
147
|
+
"@semantic-release/git",
|
|
148
|
+
{
|
|
149
|
+
"assets": [
|
|
150
|
+
"CHANGELOG.md",
|
|
151
|
+
"package.json"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
]
|
|
131
155
|
]
|
|
132
156
|
},
|
|
133
157
|
"scripts": {
|
|
@@ -147,16 +171,16 @@
|
|
|
147
171
|
"release": "aegir release"
|
|
148
172
|
},
|
|
149
173
|
"dependencies": {
|
|
150
|
-
"@helia/block-brokers": "^4.1
|
|
151
|
-
"@helia/car": "^4.
|
|
152
|
-
"@helia/delegated-routing-v1-http-api-client": "^4.2.
|
|
153
|
-
"@helia/interface": "^5.
|
|
154
|
-
"@helia/ipns": "^8.2.
|
|
155
|
-
"@helia/routers": "^3.
|
|
156
|
-
"@helia/unixfs": "^5.0.
|
|
157
|
-
"@ipld/dag-cbor": "^9.2.
|
|
158
|
-
"@ipld/dag-json": "^10.2.
|
|
159
|
-
"@ipld/dag-pb": "^4.1.
|
|
174
|
+
"@helia/block-brokers": "^4.2.1",
|
|
175
|
+
"@helia/car": "^4.1.1",
|
|
176
|
+
"@helia/delegated-routing-v1-http-api-client": "^4.2.5",
|
|
177
|
+
"@helia/interface": "^5.3.1",
|
|
178
|
+
"@helia/ipns": "^8.2.2",
|
|
179
|
+
"@helia/routers": "^3.1.1",
|
|
180
|
+
"@helia/unixfs": "^5.0.2",
|
|
181
|
+
"@ipld/dag-cbor": "^9.2.3",
|
|
182
|
+
"@ipld/dag-json": "^10.2.4",
|
|
183
|
+
"@ipld/dag-pb": "^4.1.4",
|
|
160
184
|
"@libp2p/interface": "^2.9.0",
|
|
161
185
|
"@libp2p/kad-dht": "^15.0.2",
|
|
162
186
|
"@libp2p/logger": "^5.1.15",
|
|
@@ -165,42 +189,42 @@
|
|
|
165
189
|
"@libp2p/websockets": "^9.2.10",
|
|
166
190
|
"@multiformats/dns": "^1.0.6",
|
|
167
191
|
"cborg": "^4.2.10",
|
|
168
|
-
"file-type": "^20.
|
|
192
|
+
"file-type": "^20.5.0",
|
|
169
193
|
"hashlru": "^2.3.0",
|
|
170
|
-
"helia": "^5.
|
|
194
|
+
"helia": "^5.4.1",
|
|
171
195
|
"interface-blockstore": "^5.3.1",
|
|
172
196
|
"interface-datastore": "^8.3.1",
|
|
173
197
|
"ipfs-unixfs-exporter": "^13.6.2",
|
|
174
198
|
"ipns": "^10.0.2",
|
|
175
|
-
"it-map": "^3.1.
|
|
199
|
+
"it-map": "^3.1.3",
|
|
176
200
|
"it-pipe": "^3.0.1",
|
|
177
201
|
"it-tar": "^6.0.5",
|
|
178
|
-
"it-to-browser-readablestream": "^2.0.
|
|
202
|
+
"it-to-browser-readablestream": "^2.0.11",
|
|
179
203
|
"libp2p": "^2.8.5",
|
|
180
204
|
"lru-cache": "^11.1.0",
|
|
181
|
-
"multiformats": "^13.3.
|
|
205
|
+
"multiformats": "^13.3.3",
|
|
182
206
|
"progress-events": "^1.0.1",
|
|
183
207
|
"uint8arrays": "^5.1.0"
|
|
184
208
|
},
|
|
185
209
|
"devDependencies": {
|
|
186
|
-
"@helia/dag-cbor": "^4.0.
|
|
187
|
-
"@helia/dag-json": "^4.0.
|
|
188
|
-
"@helia/http": "^2.
|
|
189
|
-
"@helia/json": "^4.0.
|
|
190
|
-
"@ipld/car": "^5.4.
|
|
210
|
+
"@helia/dag-cbor": "^4.0.5",
|
|
211
|
+
"@helia/dag-json": "^4.0.5",
|
|
212
|
+
"@helia/http": "^2.1.1",
|
|
213
|
+
"@helia/json": "^4.0.5",
|
|
214
|
+
"@ipld/car": "^5.4.1",
|
|
191
215
|
"@libp2p/crypto": "^5.1.1",
|
|
192
216
|
"@types/sinon": "^17.0.4",
|
|
193
|
-
"aegir": "^
|
|
217
|
+
"aegir": "^46.0.1",
|
|
194
218
|
"blockstore-core": "^5.0.2",
|
|
195
|
-
"browser-readablestream-to-it": "^2.0.
|
|
219
|
+
"browser-readablestream-to-it": "^2.0.9",
|
|
196
220
|
"datastore-core": "^10.0.2",
|
|
197
|
-
"helia": "^5.
|
|
221
|
+
"helia": "^5.4.1",
|
|
198
222
|
"ipfs-unixfs-importer": "^15.3.2",
|
|
199
|
-
"it-all": "^3.0.
|
|
200
|
-
"it-drain": "^3.0.
|
|
201
|
-
"it-last": "^3.0.
|
|
202
|
-
"it-to-buffer": "^4.0.
|
|
203
|
-
"magic-bytes.js": "^1.
|
|
223
|
+
"it-all": "^3.0.8",
|
|
224
|
+
"it-drain": "^3.0.9",
|
|
225
|
+
"it-last": "^3.0.8",
|
|
226
|
+
"it-to-buffer": "^4.0.9",
|
|
227
|
+
"magic-bytes.js": "^1.12.1",
|
|
204
228
|
"p-defer": "^4.0.1",
|
|
205
229
|
"sinon": "^20.0.0",
|
|
206
230
|
"sinon-ts": "^2.0.0"
|
package/src/index.ts
CHANGED
|
@@ -821,20 +821,22 @@
|
|
|
821
821
|
|
|
822
822
|
import { bitswap, trustlessGateway } from '@helia/block-brokers'
|
|
823
823
|
import { createDelegatedRoutingV1HttpApiClient } from '@helia/delegated-routing-v1-http-api-client'
|
|
824
|
-
import { type ResolveDNSLinkProgressEvents } from '@helia/ipns'
|
|
825
824
|
import { httpGatewayRouting, libp2pRouting } from '@helia/routers'
|
|
826
|
-
import { type Libp2p, type ServiceMap } from '@libp2p/interface'
|
|
827
825
|
import { dns } from '@multiformats/dns'
|
|
828
|
-
import { createHelia
|
|
829
|
-
import { createLibp2p
|
|
830
|
-
import { type ContentTypeParser } from './types.js'
|
|
826
|
+
import { createHelia } from 'helia'
|
|
827
|
+
import { createLibp2p } from 'libp2p'
|
|
831
828
|
import { getLibp2pConfig } from './utils/libp2p-defaults.js'
|
|
832
829
|
import { VerifiedFetch as VerifiedFetchClass } from './verified-fetch.js'
|
|
833
830
|
import type { VerifiedFetchPluginFactory } from './plugins/types.js'
|
|
831
|
+
import type { ContentTypeParser } from './types.js'
|
|
834
832
|
import type { GetBlockProgressEvents, Helia, Routing } from '@helia/interface'
|
|
833
|
+
import type { ResolveDNSLinkProgressEvents } from '@helia/ipns'
|
|
834
|
+
import type { Libp2p, ServiceMap } from '@libp2p/interface'
|
|
835
835
|
import type { DNSResolvers, DNS } from '@multiformats/dns'
|
|
836
836
|
import type { DNSResolver } from '@multiformats/dns/resolvers'
|
|
837
|
+
import type { HeliaInit } from 'helia'
|
|
837
838
|
import type { ExporterProgressEvents } from 'ipfs-unixfs-exporter'
|
|
839
|
+
import type { Libp2pOptions } from 'libp2p'
|
|
838
840
|
import type { CID } from 'multiformats/cid'
|
|
839
841
|
import type { ProgressEvent, ProgressOptions } from 'progress-events'
|
|
840
842
|
/**
|
|
@@ -37,7 +37,11 @@ export class CarPlugin extends BasePlugin {
|
|
|
37
37
|
context.query.download = true
|
|
38
38
|
context.query.filename = getFilename(context)
|
|
39
39
|
const blockstore = getBlockstore(cid, context.resource, options?.session ?? true, options)
|
|
40
|
-
const c = car({
|
|
40
|
+
const c = car({
|
|
41
|
+
blockstore,
|
|
42
|
+
getCodec: helia.getCodec,
|
|
43
|
+
logger: helia.logger
|
|
44
|
+
})
|
|
41
45
|
const stream = toBrowserReadableStream(c.stream(pathDetails?.terminalElement.cid ?? cid, options))
|
|
42
46
|
context.byteRangeContext.setBody(stream)
|
|
43
47
|
|
|
@@ -52,7 +52,7 @@ export class DagPbPlugin extends BasePlugin {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
async handle (context: PluginContext & Required<Pick<PluginContext, 'byteRangeContext' | 'pathDetails'>>): Promise<Response | null> {
|
|
55
|
-
const { cid, options, withServerTiming = false, pathDetails } = context
|
|
55
|
+
const { cid, options, withServerTiming = false, pathDetails, query } = context
|
|
56
56
|
const { handleServerTiming, contentTypeParser, helia, getBlockstore } = this.pluginOptions
|
|
57
57
|
const log = this.log
|
|
58
58
|
let resource = context.resource
|
|
@@ -155,7 +155,7 @@ export class DagPbPlugin extends BasePlugin {
|
|
|
155
155
|
redirected
|
|
156
156
|
})
|
|
157
157
|
|
|
158
|
-
await handleServerTiming('set-content-type', '', async () => setContentType({ bytes: firstChunk, path, response, contentTypeParser, log }), withServerTiming)
|
|
158
|
+
await handleServerTiming('set-content-type', '', async () => setContentType({ filename: query.filename, bytes: firstChunk, path, response, contentTypeParser, log }), withServerTiming)
|
|
159
159
|
|
|
160
160
|
setIpfsRoots(response, ipfsRoots)
|
|
161
161
|
|
|
@@ -86,7 +86,7 @@ export class RawPlugin extends BasePlugin {
|
|
|
86
86
|
// if the user has specified an `Accept` header that corresponds to a raw
|
|
87
87
|
// type, honour that header, so for example they don't request
|
|
88
88
|
// `application/vnd.ipld.raw` but get `application/octet-stream`
|
|
89
|
-
await setContentType({ bytes: result, path, response, defaultContentType: getOverridenRawContentType({ headers: options?.headers, accept }), contentTypeParser, log })
|
|
89
|
+
await setContentType({ filename: query.filename, bytes: result, path, response, defaultContentType: getOverridenRawContentType({ headers: options?.headers, accept }), contentTypeParser, log })
|
|
90
90
|
|
|
91
91
|
return response
|
|
92
92
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { AbortError
|
|
1
|
+
import { AbortError } from '@libp2p/interface'
|
|
2
2
|
import { CustomProgressEvent } from 'progress-events'
|
|
3
3
|
import { NoContentError } from '../errors.js'
|
|
4
4
|
import type { VerifiedFetchInit } from '../index.js'
|
|
5
|
+
import type { ComponentLogger } from '@libp2p/interface'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Converts an async iterator of Uint8Array bytes to a stream and returns the first chunk of bytes
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { NotUnixFSError } from '@helia/unixfs/errors'
|
|
2
|
-
import { exporter, recursive
|
|
2
|
+
import { exporter, recursive } from 'ipfs-unixfs-exporter'
|
|
3
3
|
import map from 'it-map'
|
|
4
4
|
import { pipe } from 'it-pipe'
|
|
5
|
-
import { pack
|
|
5
|
+
import { pack } from 'it-tar'
|
|
6
6
|
import type { AbortOptions } from '@libp2p/interface'
|
|
7
7
|
import type { Blockstore } from 'interface-blockstore'
|
|
8
|
+
import type { UnixFSEntry } from 'ipfs-unixfs-exporter'
|
|
9
|
+
import type { TarEntryHeader, TarImportCandidate } from 'it-tar'
|
|
8
10
|
|
|
9
11
|
const EXPORTABLE = ['file', 'raw', 'directory']
|
|
10
12
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type AbortOptions, type ComponentLogger } from '@libp2p/interface'
|
|
2
1
|
import { SubdomainNotSupportedError } from '../errors.js'
|
|
3
|
-
import { type VerifiedFetchInit, type Resource } from '../index.js'
|
|
4
2
|
import { matchURLString } from './parse-url-string.js'
|
|
5
3
|
import { movedPermanentlyResponse } from './responses.js'
|
|
4
|
+
import type { VerifiedFetchInit, Resource } from '../index.js'
|
|
5
|
+
import type { AbortOptions, ComponentLogger } from '@libp2p/interface'
|
|
6
6
|
import type { CID } from 'multiformats/cid'
|
|
7
7
|
|
|
8
8
|
interface GetRedirectResponse {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { webRTCDirect } from '@libp2p/webrtc'
|
|
2
2
|
import { webSockets } from '@libp2p/websockets'
|
|
3
|
-
import { libp2pDefaults
|
|
3
|
+
import { libp2pDefaults } from 'helia'
|
|
4
4
|
import type { ServiceFactoryMap } from './libp2p-types'
|
|
5
|
+
import type { DefaultLibp2pServices } from 'helia'
|
|
5
6
|
import type { Libp2pOptions } from 'libp2p'
|
|
6
7
|
|
|
7
8
|
type ServiceMap = Pick<DefaultLibp2pServices, 'dcutr' | 'identify' | 'keychain' | 'ping'>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { kadDHT } from '@libp2p/kad-dht'
|
|
2
|
-
import { libp2pDefaults
|
|
2
|
+
import { libp2pDefaults } from 'helia'
|
|
3
3
|
import { ipnsSelector } from 'ipns/selector'
|
|
4
4
|
import { ipnsValidator } from 'ipns/validator'
|
|
5
5
|
import type { ServiceFactoryMap } from './libp2p-types'
|
|
6
|
+
import type { DefaultLibp2pServices } from 'helia'
|
|
6
7
|
import type { Libp2pOptions } from 'libp2p'
|
|
7
8
|
|
|
8
9
|
type ServiceMap = Pick<DefaultLibp2pServices, 'autoNAT' | 'dcutr' | 'dht' | 'identify' | 'keychain' | 'ping' | 'upnp'>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CID } from 'multiformats/cid'
|
|
2
2
|
import { getPeerIdFromString } from './get-peer-id-from-string.js'
|
|
3
|
-
import { serverTiming
|
|
3
|
+
import { serverTiming } from './server-timing.js'
|
|
4
4
|
import { TLRU } from './tlru.js'
|
|
5
|
+
import type { ServerTimingResult } from './server-timing.js'
|
|
5
6
|
import type { RequestFormatShorthand } from '../types.js'
|
|
6
7
|
import type { DNSLinkResolveResult, IPNS, IPNSResolveResult, IPNSRoutingEvents, ResolveDNSLinkProgressEvents, ResolveProgressEvents, ResolveResult } from '@helia/ipns'
|
|
7
8
|
import type { AbortOptions, ComponentLogger, PeerId } from '@libp2p/interface'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type Logger } from '@libp2p/interface'
|
|
2
|
-
import { type ContentTypeParser } from '../types.js'
|
|
3
1
|
import { defaultMimeType } from './content-type-parser.js'
|
|
4
2
|
import { isPromise } from './type-guards.js'
|
|
3
|
+
import type { ContentTypeParser } from '../types.js'
|
|
4
|
+
import type { Logger } from '@libp2p/interface'
|
|
5
5
|
|
|
6
6
|
export interface SetContentTypeOptions {
|
|
7
7
|
bytes: Uint8Array
|
|
@@ -10,15 +10,27 @@ export interface SetContentTypeOptions {
|
|
|
10
10
|
defaultContentType?: string
|
|
11
11
|
contentTypeParser: ContentTypeParser | undefined
|
|
12
12
|
log: Logger
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This should be set to the `filename` query parameter for the given request.
|
|
16
|
+
*
|
|
17
|
+
* @see https://specs.ipfs.tech/http-gateways/path-gateway/#filename-request-query-parameter
|
|
18
|
+
*/
|
|
19
|
+
filename?: string
|
|
13
20
|
}
|
|
14
21
|
|
|
15
|
-
export async function setContentType ({ bytes, path, response, contentTypeParser, log, defaultContentType = 'application/octet-stream' }: SetContentTypeOptions): Promise<void> {
|
|
22
|
+
export async function setContentType ({ bytes, path, response, contentTypeParser, log, defaultContentType = 'application/octet-stream', filename: filenameParam }: SetContentTypeOptions): Promise<void> {
|
|
16
23
|
let contentType: string | undefined
|
|
17
24
|
|
|
18
25
|
if (contentTypeParser != null) {
|
|
19
26
|
try {
|
|
20
|
-
let fileName
|
|
21
|
-
|
|
27
|
+
let fileName
|
|
28
|
+
if (filenameParam == null) {
|
|
29
|
+
fileName = path.split('/').pop()?.trim()
|
|
30
|
+
fileName = (fileName === '' || fileName?.split('.').length === 1) ? undefined : fileName
|
|
31
|
+
} else {
|
|
32
|
+
fileName = filenameParam
|
|
33
|
+
}
|
|
22
34
|
const parsed = contentTypeParser(bytes, fileName)
|
|
23
35
|
|
|
24
36
|
if (isPromise(parsed)) {
|
package/src/utils/walk-path.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { DoesNotExistError } from '@helia/unixfs/errors'
|
|
2
|
-
import {
|
|
3
|
-
import { type Blockstore } from 'interface-blockstore'
|
|
4
|
-
import { walkPath as exporterWalk, type ExporterOptions, type ReadableStorage, type ObjectNode, type UnixFSEntry } from 'ipfs-unixfs-exporter'
|
|
2
|
+
import { walkPath as exporterWalk } from 'ipfs-unixfs-exporter'
|
|
5
3
|
import { badGatewayResponse, notFoundResponse } from './responses.js'
|
|
6
4
|
import type { PluginContext } from '../plugins/types.js'
|
|
5
|
+
import type { Logger } from '@libp2p/interface'
|
|
6
|
+
import type { Blockstore } from 'interface-blockstore'
|
|
7
|
+
import type { ExporterOptions, ReadableStorage, ObjectNode, UnixFSEntry } from 'ipfs-unixfs-exporter'
|
|
7
8
|
import type { CID } from 'multiformats/cid'
|
|
8
9
|
|
|
9
10
|
export interface PathWalkerOptions extends ExporterOptions {
|
package/src/verified-fetch.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ipns as heliaIpns
|
|
2
|
-
import { type AbortOptions, type Logger } from '@libp2p/interface'
|
|
1
|
+
import { ipns as heliaIpns } from '@helia/ipns'
|
|
3
2
|
import { prefixLogger } from '@libp2p/logger'
|
|
4
3
|
import { LRUCache } from 'lru-cache'
|
|
5
|
-
import { type CID } from 'multiformats/cid'
|
|
6
4
|
import { CustomProgressEvent } from 'progress-events'
|
|
7
5
|
import { ByteRangeContextPlugin } from './plugins/plugin-handle-byte-range-context.js'
|
|
8
6
|
import { CarPlugin } from './plugins/plugin-handle-car.js'
|
|
@@ -19,7 +17,6 @@ import { getETag } from './utils/get-e-tag.js'
|
|
|
19
17
|
import { getResolvedAcceptHeader } from './utils/get-resolved-accept-header.js'
|
|
20
18
|
import { getRedirectResponse } from './utils/handle-redirects.js'
|
|
21
19
|
import { parseResource } from './utils/parse-resource.js'
|
|
22
|
-
import { type ParsedUrlStringResults } from './utils/parse-url-string.js'
|
|
23
20
|
import { resourceToSessionCacheKey } from './utils/resource-to-cache-key.js'
|
|
24
21
|
import { setCacheControlHeader } from './utils/response-headers.js'
|
|
25
22
|
import { badRequestResponse, notAcceptableResponse, notSupportedResponse, badGatewayResponse } from './utils/responses.js'
|
|
@@ -27,8 +24,12 @@ import { selectOutputType } from './utils/select-output-type.js'
|
|
|
27
24
|
import { serverTiming } from './utils/server-timing.js'
|
|
28
25
|
import type { CIDDetail, ContentTypeParser, CreateVerifiedFetchOptions, Resource, ResourceDetail, VerifiedFetchInit as VerifiedFetchOptions } from './index.js'
|
|
29
26
|
import type { VerifiedFetchPlugin, PluginContext, PluginOptions } from './plugins/types.js'
|
|
27
|
+
import type { ParsedUrlStringResults } from './utils/parse-url-string.js'
|
|
30
28
|
import type { Helia, SessionBlockstore } from '@helia/interface'
|
|
29
|
+
import type { IPNS } from '@helia/ipns'
|
|
30
|
+
import type { AbortOptions, Logger } from '@libp2p/interface'
|
|
31
31
|
import type { Blockstore } from 'interface-blockstore'
|
|
32
|
+
import type { CID } from 'multiformats/cid'
|
|
32
33
|
|
|
33
34
|
const SESSION_CACHE_MAX_SIZE = 100
|
|
34
35
|
const SESSION_CACHE_TTL_MS = 60 * 1000
|
package/LICENSE
DELETED