@helia/verified-fetch 2.3.1 → 2.5.0

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 (119) hide show
  1. package/README.md +200 -0
  2. package/dist/index.min.js +357 -35
  3. package/dist/src/index.d.ts +220 -0
  4. package/dist/src/index.d.ts.map +1 -1
  5. package/dist/src/index.js +200 -0
  6. package/dist/src/index.js.map +1 -1
  7. package/dist/src/plugins/errors.d.ts +25 -0
  8. package/dist/src/plugins/errors.d.ts.map +1 -0
  9. package/dist/src/plugins/errors.js +33 -0
  10. package/dist/src/plugins/errors.js.map +1 -0
  11. package/dist/src/plugins/index.d.ts +8 -0
  12. package/dist/src/plugins/index.d.ts.map +1 -0
  13. package/dist/src/plugins/index.js +7 -0
  14. package/dist/src/plugins/index.js.map +1 -0
  15. package/dist/src/plugins/plugin-base.d.ts +19 -0
  16. package/dist/src/plugins/plugin-base.d.ts.map +1 -0
  17. package/dist/src/plugins/plugin-base.js +26 -0
  18. package/dist/src/plugins/plugin-base.js.map +1 -0
  19. package/dist/src/plugins/plugin-handle-car.d.ts +11 -0
  20. package/dist/src/plugins/plugin-handle-car.d.ts.map +1 -0
  21. package/dist/src/plugins/plugin-handle-car.js +28 -0
  22. package/dist/src/plugins/plugin-handle-car.js.map +1 -0
  23. package/dist/src/plugins/plugin-handle-dag-cbor.d.ts +11 -0
  24. package/dist/src/plugins/plugin-handle-dag-cbor.d.ts.map +1 -0
  25. package/dist/src/plugins/plugin-handle-dag-cbor.js +73 -0
  26. package/dist/src/plugins/plugin-handle-dag-cbor.js.map +1 -0
  27. package/dist/src/plugins/plugin-handle-dag-pb.d.ts +15 -0
  28. package/dist/src/plugins/plugin-handle-dag-pb.d.ts.map +1 -0
  29. package/dist/src/plugins/plugin-handle-dag-pb.js +152 -0
  30. package/dist/src/plugins/plugin-handle-dag-pb.js.map +1 -0
  31. package/dist/src/plugins/plugin-handle-dag-walk.d.ts +16 -0
  32. package/dist/src/plugins/plugin-handle-dag-walk.d.ts.map +1 -0
  33. package/dist/src/plugins/plugin-handle-dag-walk.js +45 -0
  34. package/dist/src/plugins/plugin-handle-dag-walk.js.map +1 -0
  35. package/dist/src/plugins/plugin-handle-dir-index-html.d.ts +9 -0
  36. package/dist/src/plugins/plugin-handle-dir-index-html.d.ts.map +1 -0
  37. package/dist/src/plugins/plugin-handle-dir-index-html.js +37 -0
  38. package/dist/src/plugins/plugin-handle-dir-index-html.js.map +1 -0
  39. package/dist/src/plugins/plugin-handle-ipns-record.d.ts +12 -0
  40. package/dist/src/plugins/plugin-handle-ipns-record.d.ts.map +1 -0
  41. package/dist/src/plugins/plugin-handle-ipns-record.js +62 -0
  42. package/dist/src/plugins/plugin-handle-ipns-record.js.map +1 -0
  43. package/dist/src/plugins/plugin-handle-json.d.ts +11 -0
  44. package/dist/src/plugins/plugin-handle-json.d.ts.map +1 -0
  45. package/dist/src/plugins/plugin-handle-json.js +51 -0
  46. package/dist/src/plugins/plugin-handle-json.js.map +1 -0
  47. package/dist/src/plugins/plugin-handle-raw.d.ts +8 -0
  48. package/dist/src/plugins/plugin-handle-raw.d.ts.map +1 -0
  49. package/dist/src/plugins/plugin-handle-raw.js +80 -0
  50. package/dist/src/plugins/plugin-handle-raw.js.map +1 -0
  51. package/dist/src/plugins/plugin-handle-tar.d.ts +12 -0
  52. package/dist/src/plugins/plugin-handle-tar.d.ts.map +1 -0
  53. package/dist/src/plugins/plugin-handle-tar.js +36 -0
  54. package/dist/src/plugins/plugin-handle-tar.js.map +1 -0
  55. package/dist/src/plugins/plugins.d.ts +5 -0
  56. package/dist/src/plugins/plugins.d.ts.map +1 -0
  57. package/dist/src/plugins/plugins.js +5 -0
  58. package/dist/src/plugins/plugins.js.map +1 -0
  59. package/dist/src/plugins/types.d.ts +68 -0
  60. package/dist/src/plugins/types.d.ts.map +1 -0
  61. package/dist/src/plugins/types.js +2 -0
  62. package/dist/src/plugins/types.js.map +1 -0
  63. package/dist/src/types.d.ts +0 -23
  64. package/dist/src/types.d.ts.map +1 -1
  65. package/dist/src/types.js +1 -2
  66. package/dist/src/types.js.map +1 -1
  67. package/dist/src/utils/dir-index-html.d.ts +16 -0
  68. package/dist/src/utils/dir-index-html.d.ts.map +1 -0
  69. package/dist/src/utils/dir-index-html.js +387 -0
  70. package/dist/src/utils/dir-index-html.js.map +1 -0
  71. package/dist/src/utils/get-e-tag.d.ts +1 -1
  72. package/dist/src/utils/get-e-tag.d.ts.map +1 -1
  73. package/dist/src/utils/get-e-tag.js +18 -3
  74. package/dist/src/utils/get-e-tag.js.map +1 -1
  75. package/dist/src/utils/parse-resource.d.ts +2 -1
  76. package/dist/src/utils/parse-resource.d.ts.map +1 -1
  77. package/dist/src/utils/parse-resource.js +4 -3
  78. package/dist/src/utils/parse-resource.js.map +1 -1
  79. package/dist/src/utils/parse-url-string.d.ts +8 -3
  80. package/dist/src/utils/parse-url-string.d.ts.map +1 -1
  81. package/dist/src/utils/parse-url-string.js +30 -4
  82. package/dist/src/utils/parse-url-string.js.map +1 -1
  83. package/dist/src/utils/server-timing.d.ts +13 -0
  84. package/dist/src/utils/server-timing.d.ts.map +1 -0
  85. package/dist/src/utils/server-timing.js +19 -0
  86. package/dist/src/utils/server-timing.js.map +1 -0
  87. package/dist/src/utils/walk-path.d.ts +3 -2
  88. package/dist/src/utils/walk-path.d.ts.map +1 -1
  89. package/dist/src/utils/walk-path.js +1 -1
  90. package/dist/src/utils/walk-path.js.map +1 -1
  91. package/dist/src/verified-fetch.d.ts +11 -20
  92. package/dist/src/verified-fetch.d.ts.map +1 -1
  93. package/dist/src/verified-fetch.js +174 -367
  94. package/dist/src/verified-fetch.js.map +1 -1
  95. package/dist/typedoc-urls.json +32 -24
  96. package/package.json +6 -2
  97. package/src/index.ts +223 -0
  98. package/src/plugins/errors.ts +37 -0
  99. package/src/plugins/index.ts +8 -0
  100. package/src/plugins/plugin-base.ts +30 -0
  101. package/src/plugins/plugin-handle-car.ts +32 -0
  102. package/src/plugins/plugin-handle-dag-cbor.ts +84 -0
  103. package/src/plugins/plugin-handle-dag-pb.ts +168 -0
  104. package/src/plugins/plugin-handle-dag-walk.ts +53 -0
  105. package/src/plugins/plugin-handle-dir-index-html.ts +44 -0
  106. package/src/plugins/plugin-handle-ipns-record.ts +69 -0
  107. package/src/plugins/plugin-handle-json.ts +57 -0
  108. package/src/plugins/plugin-handle-raw.ts +92 -0
  109. package/src/plugins/plugin-handle-tar.ts +44 -0
  110. package/src/plugins/plugins.ts +4 -0
  111. package/src/plugins/types.ts +73 -0
  112. package/src/types.ts +0 -29
  113. package/src/utils/dir-index-html.ts +445 -0
  114. package/src/utils/get-e-tag.ts +20 -3
  115. package/src/utils/parse-resource.ts +5 -4
  116. package/src/utils/parse-url-string.ts +38 -7
  117. package/src/utils/server-timing.ts +37 -0
  118. package/src/utils/walk-path.ts +3 -3
  119. package/src/verified-fetch.ts +198 -403
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-handle-json.js","sourceRoot":"","sources":["../../../src/plugins/plugin-handle-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAC/B,KAAK,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC7C,SAAS,CAAE,EAAE,GAAG,EAAE,MAAM,EAAiB;QACvC,IAAI,CAAC,GAAG,CAAC,6CAA6C,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;QAEpE,IAAI,MAAM,KAAK,+BAA+B,IAAI,GAAG,CAAC,IAAI,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;gBAC9E,OAAO,qBAAqB,CAAC,QAAQ,CAAC,CAAA;YACxC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,gBAAgB;YAChB,IAAI,GAAG,KAAK,CAAA;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAC3C,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,IAAI,kBAAkB,CAAC,CAAA;QAClE,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { BasePlugin } from './plugin-base.js';
2
+ import type { PluginContext } from './types.js';
3
+ export declare class RawPlugin extends BasePlugin {
4
+ codes: number[];
5
+ canHandle({ cid, accept, query }: PluginContext): boolean;
6
+ handle(context: PluginContext): Promise<Response>;
7
+ }
8
+ //# sourceMappingURL=plugin-handle-raw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-handle-raw.d.ts","sourceRoot":"","sources":["../../../src/plugins/plugin-handle-raw.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAsC/C,qBAAa,SAAU,SAAQ,UAAU;IACvC,KAAK,EAAE,MAAM,EAAE,CAA2B;IAE1C,SAAS,CAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,aAAa,GAAG,OAAO;IAKpD,MAAM,CAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;CAsCzD"}
@@ -0,0 +1,80 @@
1
+ import { code as rawCode } from 'multiformats/codecs/raw';
2
+ import { identity } from 'multiformats/hashes/identity';
3
+ import { ByteRangeContext } from '../utils/byte-range-context.js';
4
+ import { notFoundResponse, okRangeResponse } from '../utils/responses.js';
5
+ import { setContentType } from '../utils/set-content-type.js';
6
+ import { PluginFatalError } from './errors.js';
7
+ import { BasePlugin } from './plugin-base.js';
8
+ /**
9
+ * These are Accept header values that will cause content type sniffing to be
10
+ * skipped and set to these values.
11
+ */
12
+ const RAW_HEADERS = [
13
+ 'application/vnd.ipld.dag-json',
14
+ 'application/vnd.ipld.raw',
15
+ 'application/octet-stream'
16
+ ];
17
+ /**
18
+ * if the user has specified an `Accept` header, and it's in our list of
19
+ * allowable "raw" format headers, use that instead of detecting the content
20
+ * type. This avoids the user from receiving something different when they
21
+ * signal that they want to `Accept` a specific mime type.
22
+ */
23
+ function getOverridenRawContentType({ headers, accept }) {
24
+ // accept has already been resolved by getResolvedAcceptHeader, if we have it, use it.
25
+ const acceptHeader = accept ?? new Headers(headers).get('accept') ?? '';
26
+ // e.g. "Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8"
27
+ const acceptHeaders = acceptHeader.split(',')
28
+ .map(s => s.split(';')[0])
29
+ .map(s => s.trim());
30
+ for (const mimeType of acceptHeaders) {
31
+ if (mimeType === '*/*') {
32
+ return;
33
+ }
34
+ if (RAW_HEADERS.includes(mimeType ?? '')) {
35
+ return mimeType;
36
+ }
37
+ }
38
+ }
39
+ export class RawPlugin extends BasePlugin {
40
+ codes = [rawCode, identity.code];
41
+ canHandle({ cid, accept, query }) {
42
+ this.log('checking if we can handle %c with accept %s', cid, accept);
43
+ return accept === 'application/vnd.ipld.raw' || query.format === 'raw';
44
+ }
45
+ async handle(context) {
46
+ const { path, resource, cid, accept, query, options } = context;
47
+ const { getBlockstore, contentTypeParser } = this.pluginOptions;
48
+ const session = options?.session ?? true;
49
+ const log = this.log;
50
+ if (accept === 'application/vnd.ipld.raw' || query.format === 'raw') {
51
+ context.reqFormat = 'raw';
52
+ context.query.download = true;
53
+ context.query.filename = context.query.filename ?? `${cid.toString()}.bin`;
54
+ log.trace('Set content disposition...');
55
+ }
56
+ else {
57
+ log.trace('Did NOT setting content disposition...');
58
+ }
59
+ if (path !== '' && cid.code === rawCode) {
60
+ log.trace('404-ing raw codec request for %c/%s', cid, path);
61
+ // throw new PluginError('ERR_RAW_PATHS_NOT_SUPPORTED', 'Raw codec does not support paths')
62
+ // return notFoundResponse(resource, 'Raw codec does not support paths')
63
+ throw new PluginFatalError('ERR_RAW_PATHS_NOT_SUPPORTED', 'Raw codec does not support paths', { response: notFoundResponse(resource, 'Raw codec does not support paths') });
64
+ }
65
+ const byteRangeContext = new ByteRangeContext(this.pluginOptions.logger, options?.headers);
66
+ const terminalCid = context.pathDetails?.terminalElement.cid ?? context.cid;
67
+ const blockstore = getBlockstore(terminalCid, resource, session, options);
68
+ const result = await blockstore.get(terminalCid, options);
69
+ byteRangeContext.setBody(result);
70
+ const response = okRangeResponse(resource, byteRangeContext.getBody(), { byteRangeContext, log }, {
71
+ redirected: false
72
+ });
73
+ // if the user has specified an `Accept` header that corresponds to a raw
74
+ // type, honour that header, so for example they don't request
75
+ // `application/vnd.ipld.raw` but get `application/octet-stream`
76
+ await setContentType({ bytes: result, path, response, defaultContentType: getOverridenRawContentType({ headers: options?.headers, accept }), contentTypeParser, log });
77
+ return response;
78
+ }
79
+ }
80
+ //# sourceMappingURL=plugin-handle-raw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-handle-raw.js","sourceRoot":"","sources":["../../../src/plugins/plugin-handle-raw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C;;;GAGG;AACH,M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AC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;QACzE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QACzD,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAChC,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,EAAE;YAChG,UAAU,EAAE,KAAK;SAClB,CAAC,CAAA;QAEF,yEAAyE;QACzE,8DAA8D;QAC9D,gEAAgE;QAChE,MAAM,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,0BAA0B,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,iBAAiB,EAAE,GAAG,EAAE,CAAC,CAAA;QAEtK,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import { BasePlugin } from './plugin-base.js';
2
+ import type { PluginContext } from './types.js';
3
+ /**
4
+ * Accepts a UnixFS `CID` and returns a `.tar` file containing the file or
5
+ * directory structure referenced by the `CID`.
6
+ */
7
+ export declare class TarPlugin extends BasePlugin {
8
+ readonly codes: never[];
9
+ canHandle({ cid, accept, query }: PluginContext): boolean;
10
+ handle(context: PluginContext): Promise<Response>;
11
+ }
12
+ //# sourceMappingURL=plugin-handle-tar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-handle-tar.d.ts","sourceRoot":"","sources":["../../../src/plugins/plugin-handle-tar.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C;;;GAGG;AACH,qBAAa,SAAU,SAAQ,UAAU;IACvC,QAAQ,CAAC,KAAK,UAAK;IACnB,SAAS,CAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,aAAa,GAAG,OAAO;IAKpD,MAAM,CAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;CAuBzD"}
@@ -0,0 +1,36 @@
1
+ import { code as dagPbCode } from '@ipld/dag-pb';
2
+ import toBrowserReadableStream from 'it-to-browser-readablestream';
3
+ import { code as rawCode } from 'multiformats/codecs/raw';
4
+ import { getETag } from '../utils/get-e-tag.js';
5
+ import { tarStream } from '../utils/get-tar-stream.js';
6
+ import { notAcceptableResponse, okResponse } from '../utils/responses.js';
7
+ import { BasePlugin } from './plugin-base.js';
8
+ /**
9
+ * Accepts a UnixFS `CID` and returns a `.tar` file containing the file or
10
+ * directory structure referenced by the `CID`.
11
+ */
12
+ export class TarPlugin extends BasePlugin {
13
+ codes = [];
14
+ canHandle({ cid, accept, query }) {
15
+ this.log('checking if we can handle %c with accept %s', cid, accept);
16
+ return accept === 'application/x-tar' || query.format === 'tar';
17
+ }
18
+ async handle(context) {
19
+ const { cid, path, resource, options, pathDetails } = context;
20
+ const { getBlockstore } = this.pluginOptions;
21
+ const terminusElement = pathDetails?.terminalElement.cid ?? cid;
22
+ if (terminusElement.code !== dagPbCode && terminusElement.code !== rawCode) {
23
+ return notAcceptableResponse('only UnixFS data can be returned in a TAR file');
24
+ }
25
+ context.reqFormat = 'tar';
26
+ context.query.download = true;
27
+ context.query.filename = context.query.filename ?? `${terminusElement.toString()}.tar`;
28
+ const blockstore = getBlockstore(terminusElement, resource, options?.session, options);
29
+ const stream = toBrowserReadableStream(tarStream(`/ipfs/${cid}/${path}`, blockstore, options));
30
+ const response = okResponse(resource, stream);
31
+ response.headers.set('content-type', 'application/x-tar');
32
+ response.headers.set('etag', getETag({ cid: terminusElement, reqFormat: context.reqFormat, weak: true }));
33
+ return response;
34
+ }
35
+ }
36
+ //# sourceMappingURL=plugin-handle-t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AAC,SAAS,GAAG,KAAK,CAAA;QACzB,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAA;QAC7B,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,GAAG,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAA;QAEtF,MAAM,UAAU,GAAG,aAAa,CAAC,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;QACtF,MAAM,MAAM,GAAG,uBAAuB,CAAa,SAAS,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;QAE1G,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC7C,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAA;QAEzD,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAEzG,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Export extension (non-default) plugins here
3
+ */
4
+ export { DirIndexHtmlPlugin, dirIndexHtmlPluginFactory } from './plugin-handle-dir-index-html.js';
5
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/plugins/plugins.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Export extension (non-default) plugins here
3
+ */
4
+ export { DirIndexHtmlPlugin, dirIndexHtmlPluginFactory } from './plugin-handle-dir-index-html.js';
5
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/plugins/plugins.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA"}
@@ -0,0 +1,68 @@
1
+ import type { PluginError } from './errors.js';
2
+ import type { VerifiedFetchInit } from '../index.js';
3
+ import type { ContentTypeParser, RequestFormatShorthand } from '../types.js';
4
+ import type { ParsedUrlStringResults } from '../utils/parse-url-string.js';
5
+ import type { PathWalkerResponse } from '../utils/walk-path.js';
6
+ import type { AbortOptions, ComponentLogger, Logger } from '@libp2p/interface';
7
+ import type { Helia } from 'helia';
8
+ import type { Blockstore } from 'interface-blockstore';
9
+ import type { UnixFSEntry } from 'ipfs-unixfs-exporter';
10
+ import type { CID } from 'multiformats/cid';
11
+ import type { CustomProgressEvent } from 'progress-events';
12
+ /**
13
+ * Contains common components and functions required by plugins to handle a request.
14
+ * - Read-Only: Plugins can read but shouldn’t rewrite them.
15
+ * - Persistent: Relevant even after the request completes (e.g., logging or metrics).
16
+ */
17
+ export interface PluginOptions {
18
+ logger: ComponentLogger;
19
+ getBlockstore(cid: CID, resource: string | CID, useSession?: boolean, options?: AbortOptions): Blockstore;
20
+ handleServerTiming<T>(name: string, description: string, fn: () => Promise<T>, withServerTiming: boolean): Promise<T>;
21
+ contentTypeParser?: ContentTypeParser;
22
+ helia: Helia;
23
+ }
24
+ /**
25
+ * Represents the ephemeral, modifiable state used by the pipeline.
26
+ * - Mutable: Evolves as you walk the plugin chain.
27
+ * - Shared Data: Allows plugins to communicate partial results, discovered data, or interim errors.
28
+ * - Ephemeral: Typically discarded once fetch(...) completes.
29
+ */
30
+ export interface PluginContext {
31
+ readonly cid: CID;
32
+ readonly path: string;
33
+ readonly resource: string;
34
+ readonly accept?: string;
35
+ /**
36
+ * The last time the context is modified, so we know whether a plugin has modified it.
37
+ * A plugin should increment this value if it modifies the context.
38
+ */
39
+ modified: number;
40
+ withServerTiming?: boolean;
41
+ onProgress?(evt: CustomProgressEvent<any>): void;
42
+ options?: Omit<VerifiedFetchInit, 'signal'> & AbortOptions;
43
+ isDirectory?: boolean;
44
+ directoryEntries?: UnixFSEntry[];
45
+ errors?: PluginError[];
46
+ reqFormat?: RequestFormatShorthand;
47
+ pathDetails?: PathWalkerResponse;
48
+ query: ParsedUrlStringResults['query'];
49
+ [key: string]: unknown;
50
+ }
51
+ export interface VerifiedFetchPlugin {
52
+ readonly codes: number[];
53
+ readonly log: Logger;
54
+ canHandle(context: PluginContext): boolean;
55
+ handle(context: PluginContext): Promise<Response | null>;
56
+ }
57
+ export interface VerifiedFetchPluginFactory {
58
+ (options: PluginOptions): VerifiedFetchPlugin;
59
+ }
60
+ export interface PluginErrorOptions {
61
+ fatal?: boolean;
62
+ details?: Record<string, any>;
63
+ response?: Response;
64
+ }
65
+ export interface FatalPluginErrorOptions extends PluginErrorOptions {
66
+ response: Response;
67
+ }
68
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,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WAAW,EAAE,CAAA;IAChC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,SAAS,CAAC,EAAE,sBAAsB,CAAA;IAClC,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAA;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,SAAS,CAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAA;IAC3C,MAAM,CAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;CAC1D;AAED,MAAM,WAAW,0BAA0B;IACzC,CAAC,OAAO,EAAE,aAAa,GAAG,mBAAmB,CAAA;CAC9C;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC7B,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,QAAQ,EAAE,QAAQ,CAAA;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/types.ts"],"names":[],"mappings":""}
@@ -1,28 +1,5 @@
1
- import { type AbortOptions } from '@libp2p/interface';
2
- import { type CID } from 'multiformats/cid';
3
- import type { VerifiedFetchInit } from './index.js';
4
1
  export type RequestFormatShorthand = 'raw' | 'car' | 'tar' | 'ipns-record' | 'dag-json' | 'dag-cbor' | 'json' | 'cbor';
5
2
  export type SupportedBodyTypes = string | ArrayBuffer | Blob | ReadableStream<Uint8Array> | null;
6
- export interface FetchHandlerFunctionArg {
7
- cid: CID;
8
- path: string;
9
- /**
10
- * Whether to use a session during fetch operations
11
- *
12
- * @default true
13
- */
14
- session: boolean;
15
- options?: Omit<VerifiedFetchInit, 'signal'> & AbortOptions;
16
- /**
17
- * If present, the user has sent an accept header with this value - if the
18
- * content cannot be represented in this format a 406 should be returned
19
- */
20
- accept?: string;
21
- /**
22
- * The originally requested resource
23
- */
24
- resource: string;
25
- }
26
3
  /**
27
4
  * A ContentTypeParser attempts to return the mime type of a given file. It
28
5
  * receives the first chunk of the file data and the file name, if it is
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;AAEtH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAA;AAEhG,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAA;IAEhB,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAAG,YAAY,CAAA;IAE1D;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAAA;CACzF"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;AAEtH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAA;AAEhG;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAAA;CACzF"}
package/dist/src/types.js CHANGED
@@ -1,3 +1,2 @@
1
- import {} from '@libp2p/interface';
2
- import {} from 'multiformats/cid';
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAY,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type { Logger } from '@libp2p/interface';
2
+ import type { UnixFSEntry } from 'ipfs-unixfs-exporter';
3
+ export interface DirIndexHtmlOptions {
4
+ gatewayURL: string;
5
+ dnsLink?: boolean;
6
+ log: Logger;
7
+ }
8
+ /**
9
+ * todo: https://github.com/ipfs/boxo/blob/09b0013e1c3e09468009b02dfc9b2b9041199d5d/gateway/handler_unixfs_dir.go#L200-L208
10
+ *
11
+ * @see https://github.com/ipfs/boxo/blob/09b0013e1c3e09468009b02dfc9b2b9041199d5d/gateway/assets/directory.html
12
+ * @see https://github.com/ipfs/boxo/pull/298
13
+ * @see https://github.com/ipfs/kubo/pull/8555
14
+ */
15
+ export declare const dirIndexHtml: (dir: UnixFSEntry, items: UnixFSEntry[], { gatewayURL, dnsLink, log }: DirIndexHtmlOptions) => string;
16
+ //# sourceMappingURL=dir-index-html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dir-index-html.d.ts","sourceRoot":"","sources":["../../../src/utils/dir-index-html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAwCvD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;CACZ;AA0CD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,QAAS,WAAW,SAAS,WAAW,EAAE,gCAAgC,mBAAmB,KAAG,MA2FxH,CAAA"}