@helia/verified-fetch 0.0.0-9b1ddf8 → 0.0.0-a04e041

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.
Files changed (48) hide show
  1. package/README.md +238 -6
  2. package/dist/index.min.js +4 -4
  3. package/dist/src/index.d.ts +222 -4
  4. package/dist/src/index.d.ts.map +1 -1
  5. package/dist/src/index.js +219 -4
  6. package/dist/src/index.js.map +1 -1
  7. package/dist/src/types.d.ts +2 -0
  8. package/dist/src/types.d.ts.map +1 -0
  9. package/dist/src/types.js +2 -0
  10. package/dist/src/types.js.map +1 -0
  11. package/dist/src/utils/dag-cbor-to-safe-json.d.ts +7 -0
  12. package/dist/src/utils/dag-cbor-to-safe-json.d.ts.map +1 -0
  13. package/dist/src/utils/dag-cbor-to-safe-json.js +37 -0
  14. package/dist/src/utils/dag-cbor-to-safe-json.js.map +1 -0
  15. package/dist/src/utils/get-content-disposition-filename.d.ts +6 -0
  16. package/dist/src/utils/get-content-disposition-filename.d.ts.map +1 -0
  17. package/dist/src/utils/get-content-disposition-filename.js +16 -0
  18. package/dist/src/utils/get-content-disposition-filename.js.map +1 -0
  19. package/dist/src/utils/get-e-tag.d.ts +28 -0
  20. package/dist/src/utils/get-e-tag.d.ts.map +1 -0
  21. package/dist/src/utils/get-e-tag.js +18 -0
  22. package/dist/src/utils/get-e-tag.js.map +1 -0
  23. package/dist/src/utils/parse-url-string.d.ts +7 -1
  24. package/dist/src/utils/parse-url-string.d.ts.map +1 -1
  25. package/dist/src/utils/parse-url-string.js +6 -0
  26. package/dist/src/utils/parse-url-string.js.map +1 -1
  27. package/dist/src/utils/responses.d.ts +4 -0
  28. package/dist/src/utils/responses.d.ts.map +1 -0
  29. package/dist/src/utils/responses.js +21 -0
  30. package/dist/src/utils/responses.js.map +1 -0
  31. package/dist/src/utils/select-output-type.d.ts +12 -0
  32. package/dist/src/utils/select-output-type.d.ts.map +1 -0
  33. package/dist/src/utils/select-output-type.js +147 -0
  34. package/dist/src/utils/select-output-type.js.map +1 -0
  35. package/dist/src/verified-fetch.d.ts +17 -25
  36. package/dist/src/verified-fetch.d.ts.map +1 -1
  37. package/dist/src/verified-fetch.js +225 -142
  38. package/dist/src/verified-fetch.js.map +1 -1
  39. package/package.json +27 -15
  40. package/src/index.ts +223 -4
  41. package/src/types.ts +1 -0
  42. package/src/utils/dag-cbor-to-safe-json.ts +44 -0
  43. package/src/utils/get-content-disposition-filename.ts +18 -0
  44. package/src/utils/get-e-tag.ts +36 -0
  45. package/src/utils/parse-url-string.ts +17 -2
  46. package/src/utils/responses.ts +22 -0
  47. package/src/utils/select-output-type.ts +166 -0
  48. package/src/verified-fetch.ts +258 -152
@@ -1,17 +1,22 @@
1
- import { dagCbor as heliaDagCbor } from '@helia/dag-cbor';
2
- import { dagJson as heliaDagJson } from '@helia/dag-json';
1
+ import { car } from '@helia/car';
3
2
  import { ipns as heliaIpns } from '@helia/ipns';
4
3
  import { dnsJsonOverHttps } from '@helia/ipns/dns-resolvers';
5
- import { json as heliaJson } from '@helia/json';
6
4
  import { unixfs as heliaUnixFs } from '@helia/unixfs';
7
- import { code as dagCborCode } from '@ipld/dag-cbor';
8
- import { code as dagJsonCode } from '@ipld/dag-json';
5
+ import * as ipldDagCbor from '@ipld/dag-cbor';
6
+ import * as ipldDagJson from '@ipld/dag-json';
9
7
  import { code as dagPbCode } from '@ipld/dag-pb';
8
+ import toBrowserReadableStream from 'it-to-browser-readablestream';
10
9
  import { code as jsonCode } from 'multiformats/codecs/json';
11
- import { decode, code as rawCode } from 'multiformats/codecs/raw';
10
+ import { code as rawCode } from 'multiformats/codecs/raw';
11
+ import { identity } from 'multiformats/hashes/identity';
12
12
  import { CustomProgressEvent } from 'progress-events';
13
+ import { dagCborToSafeJSON } from './utils/dag-cbor-to-safe-json.js';
14
+ import { getContentDispositionFilename } from './utils/get-content-disposition-filename.js';
15
+ import { getETag } from './utils/get-e-tag.js';
13
16
  import { getStreamFromAsyncIterable } from './utils/get-stream-from-async-iterable.js';
14
17
  import { parseResource } from './utils/parse-resource.js';
18
+ import { notAcceptableResponse, notSupportedResponse, okResponse } from './utils/responses.js';
19
+ import { selectOutputType, queryFormatToAcceptHeader } from './utils/select-output-type.js';
15
20
  import { walkPath } from './utils/walk-path.js';
16
21
  function convertOptions(options) {
17
22
  if (options == null) {
@@ -26,17 +31,42 @@ function convertOptions(options) {
26
31
  signal
27
32
  };
28
33
  }
34
+ /**
35
+ * These are Accept header values that will cause content type sniffing to be
36
+ * skipped and set to these values.
37
+ */
38
+ const RAW_HEADERS = [
39
+ 'application/vnd.ipld.raw',
40
+ 'application/octet-stream'
41
+ ];
42
+ /**
43
+ * if the user has specified an `Accept` header, and it's in our list of
44
+ * allowable "raw" format headers, use that instead of detecting the content
45
+ * type. This avoids the user from receiving something different when they
46
+ * signal that they want to `Accept` a specific mime type.
47
+ */
48
+ function getOverridenRawContentType(headers) {
49
+ const acceptHeader = new Headers(headers).get('accept') ?? '';
50
+ // e.g. "Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8"
51
+ const acceptHeaders = acceptHeader.split(',')
52
+ .map(s => s.split(';')[0])
53
+ .map(s => s.trim());
54
+ for (const mimeType of acceptHeaders) {
55
+ if (mimeType === '*/*') {
56
+ return;
57
+ }
58
+ if (RAW_HEADERS.includes(mimeType ?? '')) {
59
+ return mimeType;
60
+ }
61
+ }
62
+ }
29
63
  export class VerifiedFetch {
30
64
  helia;
31
65
  ipns;
32
66
  unixfs;
33
- dagJson;
34
- dagCbor;
35
- json;
36
- pathWalker;
37
67
  log;
38
68
  contentTypeParser;
39
- constructor({ helia, ipns, unixfs, dagJson, json, dagCbor, pathWalker }, init) {
69
+ constructor({ helia, ipns, unixfs }, init) {
40
70
  this.helia = helia;
41
71
  this.log = helia.logger.forComponent('helia:verified-fetch');
42
72
  this.ipns = ipns ?? heliaIpns(helia, {
@@ -46,63 +76,114 @@ export class VerifiedFetch {
46
76
  ]
47
77
  });
48
78
  this.unixfs = unixfs ?? heliaUnixFs(helia);
49
- this.dagJson = dagJson ?? heliaDagJson(helia);
50
- this.json = json ?? heliaJson(helia);
51
- this.dagCbor = dagCbor ?? heliaDagCbor(helia);
52
- this.pathWalker = pathWalker ?? walkPath;
53
79
  this.contentTypeParser = init?.contentTypeParser;
54
80
  this.log.trace('created VerifiedFetch instance');
55
81
  }
56
- // handle vnd.ipfs.ipns-record
57
- async handleIPNSRecord({ cid, path, options }) {
58
- const response = new Response('vnd.ipfs.ipns-record support is not implemented', { status: 501 });
59
- response.headers.set('X-Content-Type-Options', 'nosniff'); // see https://specs.ipfs.tech/http-gateways/path-gateway/#x-content-type-options-response-header
60
- return response;
82
+ /**
83
+ * Accepts an `ipns://...` URL as a string and returns a `Response` containing
84
+ * a raw IPNS record.
85
+ */
86
+ async handleIPNSRecord(resource, opts) {
87
+ return notSupportedResponse('vnd.ipfs.ipns-record support is not implemented');
61
88
  }
62
- // handle vnd.ipld.car
63
- async handleIPLDCar({ cid, path, options }) {
64
- const response = new Response('vnd.ipld.car support is not implemented', { status: 501 });
65
- response.headers.set('X-Content-Type-Options', 'nosniff'); // see https://specs.ipfs.tech/http-gateways/path-gateway/#x-content-type-options-response-header
89
+ /**
90
+ * Accepts a `CID` and returns a `Response` with a body stream that is a CAR
91
+ * of the `DAG` referenced by the `CID`.
92
+ */
93
+ async handleCar({ cid, options }) {
94
+ const c = car(this.helia);
95
+ const stream = toBrowserReadableStream(c.stream(cid, options));
96
+ const response = okResponse(stream);
97
+ response.headers.set('content-type', 'application/vnd.ipld.car; version=1');
66
98
  return response;
67
99
  }
68
- async handleDagJson({ cid, path, options }) {
69
- this.log.trace('fetching %c/%s', cid, path);
70
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:start', { cid, path }));
71
- const result = await this.dagJson.get(cid, {
72
- signal: options?.signal,
73
- onProgress: options?.onProgress
74
- });
75
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid, path }));
76
- const response = new Response(JSON.stringify(result), { status: 200 });
77
- response.headers.set('content-type', 'application/json');
78
- return response;
100
+ /**
101
+ * Accepts a UnixFS `CID` and returns a `.tar` file containing the file or
102
+ * directory structure referenced by the `CID`.
103
+ */
104
+ async handleTar({ cid, path, options }) {
105
+ if (cid.code !== dagPbCode) {
106
+ return notAcceptableResponse('only dag-pb CIDs can be returned in TAR files');
107
+ }
108
+ return notSupportedResponse('application/tar support is not implemented');
79
109
  }
80
- async handleJson({ cid, path, options }) {
110
+ async handleJson({ cid, path, accept, options }) {
81
111
  this.log.trace('fetching %c/%s', cid, path);
82
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:start', { cid, path }));
83
- const result = await this.json.get(cid, {
84
- signal: options?.signal,
85
- onProgress: options?.onProgress
86
- });
87
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid, path }));
88
- const response = new Response(JSON.stringify(result), { status: 200 });
89
- response.headers.set('content-type', 'application/json');
112
+ const block = await this.helia.blockstore.get(cid, options);
113
+ let body;
114
+ if (accept === 'application/vnd.ipld.dag-cbor' || accept === 'application/cbor') {
115
+ try {
116
+ // if vnd.ipld.dag-cbor has been specified, convert to the format - note
117
+ // that this supports more data types than regular JSON, the content-type
118
+ // response header is set so the user knows to process it differently
119
+ const obj = ipldDagJson.decode(block);
120
+ body = ipldDagCbor.encode(obj);
121
+ }
122
+ catch (err) {
123
+ this.log.error('could not transform %c to application/vnd.ipld.dag-cbor', err);
124
+ return notAcceptableResponse();
125
+ }
126
+ }
127
+ else {
128
+ // skip decoding
129
+ body = block;
130
+ }
131
+ const response = okResponse(body);
132
+ response.headers.set('content-type', accept ?? 'application/json');
90
133
  return response;
91
134
  }
92
- async handleDagCbor({ cid, path, options }) {
135
+ async handleDagCbor({ cid, path, accept, options }) {
93
136
  this.log.trace('fetching %c/%s', cid, path);
94
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:start', { cid, path }));
95
- const result = await this.dagCbor.get(cid, {
96
- signal: options?.signal,
97
- onProgress: options?.onProgress
98
- });
99
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid, path }));
100
- const response = new Response(result, { status: 200 });
101
- await this.setContentType(result, path, response);
137
+ const block = await this.helia.blockstore.get(cid, options);
138
+ let body;
139
+ if (accept === 'application/octet-stream' || accept === 'application/vnd.ipld.dag-cbor' || accept === 'application/cbor') {
140
+ // skip decoding
141
+ body = block;
142
+ }
143
+ else if (accept === 'application/vnd.ipld.dag-json') {
144
+ try {
145
+ // if vnd.ipld.dag-json has been specified, convert to the format - note
146
+ // that this supports more data types than regular JSON, the content-type
147
+ // response header is set so the user knows to process it differently
148
+ const obj = ipldDagCbor.decode(block);
149
+ body = ipldDagJson.encode(obj);
150
+ }
151
+ catch (err) {
152
+ this.log.error('could not transform %c to application/vnd.ipld.dag-json', err);
153
+ return notAcceptableResponse();
154
+ }
155
+ }
156
+ else {
157
+ try {
158
+ body = dagCborToSafeJSON(block);
159
+ }
160
+ catch (err) {
161
+ if (accept === 'application/json') {
162
+ this.log('could not decode DAG-CBOR as JSON-safe, but the client sent "Accept: application/json"', err);
163
+ return notAcceptableResponse();
164
+ }
165
+ this.log('could not decode DAG-CBOR as JSON-safe, falling back to `application/octet-stream`', err);
166
+ body = block;
167
+ }
168
+ }
169
+ const response = okResponse(body);
170
+ if (accept == null) {
171
+ accept = body instanceof Uint8Array ? 'application/octet-stream' : 'application/json';
172
+ }
173
+ response.headers.set('content-type', accept);
102
174
  return response;
103
175
  }
104
- async handleDagPb({ cid, path, options, terminalElement }) {
105
- this.log.trace('fetching %c/%s', cid, path);
176
+ async handleDagPb({ cid, path, options }) {
177
+ let terminalElement;
178
+ let ipfsRoots;
179
+ try {
180
+ const pathDetails = await walkPath(this.helia.blockstore, `${cid.toString()}/${path}`, options);
181
+ ipfsRoots = pathDetails.ipfsRoots;
182
+ terminalElement = pathDetails.terminalElement;
183
+ }
184
+ catch (err) {
185
+ this.log.error('Error walking path %s', path, err);
186
+ }
106
187
  let resolvedCID = terminalElement?.cid ?? cid;
107
188
  let stat;
108
189
  if (terminalElement?.type === 'directory') {
@@ -110,7 +191,6 @@ export class VerifiedFetch {
110
191
  const rootFilePath = 'index.html';
111
192
  try {
112
193
  this.log.trace('found directory at %c/%s, looking for index.html', cid, path);
113
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:start', { cid: dirCid, path: rootFilePath }));
114
194
  stat = await this.unixfs.stat(dirCid, {
115
195
  path: rootFilePath,
116
196
  signal: options?.signal,
@@ -123,33 +203,40 @@ export class VerifiedFetch {
123
203
  }
124
204
  catch (err) {
125
205
  this.log('error loading path %c/%s', dirCid, rootFilePath, err);
126
- return new Response('Unable to find index.html for directory at given path. Support for directories with implicit root is not implemented', { status: 501 });
206
+ return notSupportedResponse('Unable to find index.html for directory at given path. Support for directories with implicit root is not implemented');
127
207
  }
128
208
  finally {
129
209
  options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid: dirCid, path: rootFilePath }));
130
210
  }
131
211
  }
132
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:start', { cid: resolvedCID, path: '' }));
133
212
  const asyncIter = this.unixfs.cat(resolvedCID, {
134
213
  signal: options?.signal,
135
214
  onProgress: options?.onProgress
136
215
  });
137
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid: resolvedCID, path: '' }));
138
216
  this.log('got async iterator for %c/%s', cid, path);
139
217
  const { stream, firstChunk } = await getStreamFromAsyncIterable(asyncIter, path ?? '', this.helia.logger, {
140
218
  onProgress: options?.onProgress
141
219
  });
142
- const response = new Response(stream, { status: 200 });
220
+ const response = okResponse(stream);
143
221
  await this.setContentType(firstChunk, path, response);
222
+ if (ipfsRoots != null) {
223
+ response.headers.set('X-Ipfs-Roots', ipfsRoots.map(cid => cid.toV1().toString()).join(',')); // https://specs.ipfs.tech/http-gateways/path-gateway/#x-ipfs-roots-response-header
224
+ }
144
225
  return response;
145
226
  }
146
227
  async handleRaw({ cid, path, options }) {
147
- this.log.trace('fetching %c/%s', cid, path);
148
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:start', { cid, path }));
149
- const result = await this.helia.blockstore.get(cid);
150
- options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid, path }));
151
- const response = new Response(decode(result), { status: 200 });
152
- await this.setContentType(result, path, response);
228
+ const result = await this.helia.blockstore.get(cid, options);
229
+ const response = okResponse(result);
230
+ // if the user has specified an `Accept` header that corresponds to a raw
231
+ // type, honour that header, so for example they don't request
232
+ // `application/vnd.ipld.raw` but get `application/octet-stream`
233
+ const overriddenContentType = getOverridenRawContentType(options?.headers);
234
+ if (overriddenContentType != null) {
235
+ response.headers.set('content-type', overriddenContentType);
236
+ }
237
+ else {
238
+ await this.setContentType(result, path, response);
239
+ }
153
240
  return response;
154
241
  }
155
242
  async setContentType(bytes, path, response) {
@@ -176,98 +263,94 @@ export class VerifiedFetch {
176
263
  response.headers.set('content-type', contentType);
177
264
  }
178
265
  /**
179
- * Determines the format requested by the client, defaults to `null` if no format is requested.
180
- *
181
- * @see https://specs.ipfs.tech/http-gateways/path-gateway/#format-request-query-parameter
182
- * @default 'raw'
183
- */
184
- getFormat({ headerFormat, queryFormat }) {
185
- const formatMap = {
186
- 'vnd.ipld.raw': 'raw',
187
- 'vnd.ipld.car': 'car',
188
- 'application/x-tar': 'tar',
189
- 'application/vnd.ipld.dag-json': 'dag-json',
190
- 'application/vnd.ipld.dag-cbor': 'dag-cbor',
191
- 'application/json': 'json',
192
- 'application/cbor': 'cbor',
193
- 'vnd.ipfs.ipns-record': 'ipns-record'
194
- };
195
- if (headerFormat != null) {
196
- for (const format in formatMap) {
197
- if (headerFormat.includes(format)) {
198
- return formatMap[format];
199
- }
200
- }
201
- }
202
- else if (queryFormat != null) {
203
- return queryFormat;
204
- }
205
- return null;
206
- }
207
- /**
208
- * Map of format to specific handlers for that format.
209
- * These format handlers should adjust the response headers as specified in https://specs.ipfs.tech/http-gateways/path-gateway/#response-headers
266
+ * If the user has not specified an Accept header or format query string arg,
267
+ * use the CID codec to choose an appropriate handler for the block data.
210
268
  */
211
- formatHandlers = {
212
- raw: async () => new Response('application/vnd.ipld.raw support is not implemented', { status: 501 }),
213
- car: this.handleIPLDCar,
214
- 'ipns-record': this.handleIPNSRecord,
215
- tar: async () => new Response('application/x-tar support is not implemented', { status: 501 }),
216
- 'dag-json': async () => new Response('application/vnd.ipld.dag-json support is not implemented', { status: 501 }),
217
- 'dag-cbor': async () => new Response('application/vnd.ipld.dag-cbor support is not implemented', { status: 501 }),
218
- json: async () => new Response('application/json support is not implemented', { status: 501 }),
219
- cbor: async () => new Response('application/cbor support is not implemented', { status: 501 })
220
- };
221
269
  codecHandlers = {
222
- [dagJsonCode]: this.handleDagJson,
223
270
  [dagPbCode]: this.handleDagPb,
271
+ [ipldDagJson.code]: this.handleJson,
224
272
  [jsonCode]: this.handleJson,
225
- [dagCborCode]: this.handleDagCbor,
226
- [rawCode]: this.handleRaw
273
+ [ipldDagCbor.code]: this.handleDagCbor,
274
+ [rawCode]: this.handleRaw,
275
+ [identity.code]: this.handleRaw
227
276
  };
228
277
  async fetch(resource, opts) {
278
+ this.log('fetch %s', resource);
229
279
  const options = convertOptions(opts);
230
- const { path, query, ...rest } = await parseResource(resource, { ipns: this.ipns, logger: this.helia.logger }, options);
231
- const cid = rest.cid;
280
+ options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:start', { resource }));
281
+ // resolve the CID/path from the requested resource
282
+ const { path, query, cid } = await parseResource(resource, { ipns: this.ipns, logger: this.helia.logger }, options);
283
+ options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:resolve', { cid, path }));
284
+ const requestHeaders = new Headers(options?.headers);
285
+ const incomingAcceptHeader = requestHeaders.get('accept');
286
+ if (incomingAcceptHeader != null) {
287
+ this.log('incoming accept header "%s"', incomingAcceptHeader);
288
+ }
289
+ const queryFormatMapping = queryFormatToAcceptHeader(query.format);
290
+ if (query.format != null) {
291
+ this.log('incoming query format "%s", mapped to %s', query.format, queryFormatMapping);
292
+ }
293
+ const acceptHeader = incomingAcceptHeader ?? queryFormatMapping;
294
+ const accept = selectOutputType(cid, acceptHeader);
295
+ this.log('output type %s', accept);
296
+ if (acceptHeader != null && accept == null) {
297
+ return notAcceptableResponse();
298
+ }
232
299
  let response;
233
- const format = this.getFormat({ headerFormat: new Headers(options?.headers).get('accept'), queryFormat: query.format ?? null });
234
- if (format != null) {
235
- // TODO: These should be handled last when they're returning something other than 501
236
- const formatHandler = this.formatHandlers[format];
237
- if (formatHandler != null) {
238
- response = await formatHandler.call(this, { cid, path, options });
239
- if (response.status === 501) {
240
- return response;
241
- }
242
- }
300
+ let reqFormat;
301
+ if (accept === 'application/vnd.ipfs.ipns-record') {
302
+ // the user requested a raw IPNS record
303
+ reqFormat = 'ipns-record';
304
+ response = await this.handleIPNSRecord(resource.toString(), options);
243
305
  }
244
- let terminalElement;
245
- let ipfsRoots;
246
- try {
247
- const pathDetails = await this.pathWalker(this.helia.blockstore, `${cid.toString()}/${path}`, options);
248
- ipfsRoots = pathDetails.ipfsRoots;
249
- terminalElement = pathDetails.terminalElement;
306
+ else if (accept === 'application/vnd.ipld.car') {
307
+ // the user requested a CAR file
308
+ reqFormat = 'car';
309
+ query.download = true;
310
+ query.filename = query.filename ?? `${cid.toString()}.car`;
311
+ response = await this.handleCar({ cid, path, options });
250
312
  }
251
- catch (err) {
252
- this.log.error('Error walking path %s', path, err);
253
- // return new Response(`Error walking path: ${(err as Error).message}`, { status: 500 })
313
+ else if (accept === 'application/vnd.ipld.raw') {
314
+ // the user requested a raw block
315
+ reqFormat = 'raw';
316
+ query.download = true;
317
+ query.filename = query.filename ?? `${cid.toString()}.bin`;
318
+ response = await this.handleRaw({ cid, path, options });
319
+ }
320
+ else if (accept === 'application/x-tar') {
321
+ // the user requested a TAR file
322
+ reqFormat = 'tar';
323
+ response = await this.handleTar({ cid, path, options });
254
324
  }
255
- if (response == null) {
325
+ else {
326
+ // derive the handler from the CID type
256
327
  const codecHandler = this.codecHandlers[cid.code];
257
- if (codecHandler != null) {
258
- response = await codecHandler.call(this, { cid, path, options, terminalElement });
328
+ if (codecHandler == null) {
329
+ return notSupportedResponse(`Support for codec with code ${cid.code} is not yet implemented. Please open an issue at https://github.com/ipfs/helia/issues/new`);
259
330
  }
260
- else {
261
- return new Response(`Support for codec with code ${cid.code} is not yet implemented. Please open an issue at https://github.com/ipfs/helia/issues/new`, { status: 501 });
331
+ response = await codecHandler.call(this, { cid, path, accept, options });
332
+ }
333
+ response.headers.set('etag', getETag({ cid, reqFormat, weak: false }));
334
+ response.headers.set('cache-control', 'public, max-age=29030400, immutable');
335
+ // https://specs.ipfs.tech/http-gateways/path-gateway/#x-ipfs-path-response-header
336
+ response.headers.set('X-Ipfs-Path', resource.toString());
337
+ // set Content-Disposition header
338
+ let contentDisposition;
339
+ // force download if requested
340
+ if (query.download === true) {
341
+ contentDisposition = 'attachment';
342
+ }
343
+ // override filename if requested
344
+ if (query.filename != null) {
345
+ if (contentDisposition == null) {
346
+ contentDisposition = 'inline';
262
347
  }
348
+ contentDisposition = `${contentDisposition}; ${getContentDispositionFilename(query.filename)}`;
263
349
  }
264
- response.headers.set('etag', cid.toString()); // https://specs.ipfs.tech/http-gateways/path-gateway/#etag-response-header
265
- response.headers.set('cache-cotrol', 'public, max-age=29030400, immutable');
266
- response.headers.set('X-Ipfs-Path', resource.toString()); // https://specs.ipfs.tech/http-gateways/path-gateway/#x-ipfs-path-response-header
267
- if (ipfsRoots != null) {
268
- response.headers.set('X-Ipfs-Roots', ipfsRoots.map(cid => cid.toV1().toString()).join(',')); // https://specs.ipfs.tech/http-gateways/path-gateway/#x-ipfs-roots-response-header
350
+ if (contentDisposition != null) {
351
+ response.headers.set('Content-Disposition', contentDisposition);
269
352
  }
270
- // response.headers.set('Content-Disposition', `TODO`) // https://specs.ipfs.tech/http-gateways/path-gateway/#content-disposition-response-header
353
+ options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid, path }));
271
354
  return response;
272
355
  }
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I,IAAI,EAAE,CAAC;gBAC/B,kBAAkB,GAAG,QAAQ,CAAA;YAC/B,CAAC;YAED,kBAAkB,GAAG,GAAG,kBAAkB,KAAK,6BAA6B,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAA;QAChG,CAAC;QAED,IAAI,kBAAkB,IAAI,IAAI,EAAE,CAAC;YAC/B,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAA;QACjE,CAAC;QAED,OAAO,EAAE,UAAU,EAAE,CAAC,IAAI,mBAAmB,CAAY,4BAA4B,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAEtG,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IACzB,CAAC;CACF;AAED,SAAS,SAAS,CAAM,CAAO;IAC7B,OAAO,CAAC,EAAE,IAAI,IAAI,IAAI,CAAA;AACxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helia/verified-fetch",
3
- "version": "0.0.0-9b1ddf8",
3
+ "version": "0.0.0-a04e041",
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/tree/main/packages/verified-fetch#readme",
@@ -141,33 +141,45 @@
141
141
  "release": "aegir release"
142
142
  },
143
143
  "dependencies": {
144
- "@helia/block-brokers": "2.0.1-9b1ddf8",
145
- "@helia/dag-cbor": "3.0.0-9b1ddf8",
146
- "@helia/dag-json": "3.0.0-9b1ddf8",
147
- "@helia/http": "1.0.1-9b1ddf8",
148
- "@helia/interface": "4.0.0-9b1ddf8",
149
- "@helia/ipns": "6.0.0-9b1ddf8",
150
- "@helia/json": "3.0.0-9b1ddf8",
151
- "@helia/routers": "1.0.0-9b1ddf8",
152
- "@helia/unixfs": "3.0.0-9b1ddf8",
153
- "@ipld/dag-cbor": "^9.1.0",
154
- "@ipld/dag-json": "^10.1.7",
155
- "@ipld/dag-pb": "^4.0.8",
144
+ "@helia/car": "3.0.0-a04e041",
145
+ "@helia/block-brokers": "2.0.1-a04e041",
146
+ "@helia/http": "1.0.1-a04e041",
147
+ "@helia/interface": "4.0.0-a04e041",
148
+ "@helia/ipns": "6.0.0-a04e041",
149
+ "@helia/routers": "1.0.0-a04e041",
150
+ "@helia/unixfs": "3.0.0-a04e041",
151
+ "@ipld/dag-cbor": "^9.2.0",
152
+ "@ipld/dag-json": "^10.2.0",
153
+ "@ipld/dag-pb": "^4.1.0",
156
154
  "@libp2p/interface": "^1.1.2",
157
155
  "@libp2p/peer-id": "^4.0.5",
156
+ "cborg": "^4.0.9",
158
157
  "hashlru": "^2.3.0",
159
158
  "ipfs-unixfs-exporter": "^13.5.0",
160
- "multiformats": "^13.0.1",
159
+ "it-to-browser-readablestream": "^2.0.6",
160
+ "multiformats": "^13.1.0",
161
161
  "progress-events": "^1.0.0"
162
162
  },
163
163
  "devDependencies": {
164
+ "@helia/car": "3.0.0-a04e041",
165
+ "@helia/dag-cbor": "3.0.0-a04e041",
166
+ "@helia/dag-json": "3.0.0-a04e041",
167
+ "@helia/json": "3.0.0-a04e041",
168
+ "@helia/utils": "0.0.1-a04e041",
169
+ "@ipld/car": "^5.2.6",
164
170
  "@libp2p/logger": "^4.0.5",
165
171
  "@libp2p/peer-id-factory": "^4.0.5",
166
172
  "@sgtpooki/file-type": "^1.0.1",
167
173
  "@types/sinon": "^17.0.3",
168
174
  "aegir": "^42.2.2",
169
- "helia": "4.0.1-9b1ddf8",
175
+ "blockstore-core": "^4.4.0",
176
+ "datastore-core": "^9.2.8",
177
+ "helia": "4.0.1-a04e041",
178
+ "ipns": "^9.0.0",
179
+ "it-last": "^3.0.4",
180
+ "it-to-buffer": "^4.0.5",
170
181
  "magic-bytes.js": "^1.8.0",
182
+ "p-defer": "^4.0.0",
171
183
  "sinon": "^17.0.1",
172
184
  "sinon-ts": "^2.0.0",
173
185
  "uint8arrays": "^5.0.1"