@helia/verified-fetch 4.0.3 → 4.0.4
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 +69 -63
- package/dist/index.min.js.map +4 -4
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +1 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/plugins/plugin-handle-cbor.d.ts +17 -0
- package/dist/src/plugins/plugin-handle-cbor.d.ts.map +1 -0
- package/dist/src/plugins/plugin-handle-cbor.js +94 -0
- package/dist/src/plugins/plugin-handle-cbor.js.map +1 -0
- package/dist/src/plugins/plugin-handle-dag-cbor.d.ts.map +1 -1
- package/dist/src/plugins/plugin-handle-dag-cbor.js +16 -27
- package/dist/src/plugins/plugin-handle-dag-cbor.js.map +1 -1
- package/dist/src/plugins/plugin-handle-dag-walk.d.ts.map +1 -1
- package/dist/src/plugins/plugin-handle-dag-walk.js +52 -7
- package/dist/src/plugins/plugin-handle-dag-walk.js.map +1 -1
- package/dist/src/plugins/plugin-handle-json.d.ts.map +1 -1
- package/dist/src/plugins/plugin-handle-json.js +5 -3
- package/dist/src/plugins/plugin-handle-json.js.map +1 -1
- package/dist/src/utils/byte-range-context.js +1 -1
- package/dist/src/utils/byte-range-context.js.map +1 -1
- package/dist/src/utils/dag-cbor-to-safe-json.d.ts +8 -0
- package/dist/src/utils/dag-cbor-to-safe-json.d.ts.map +1 -1
- package/dist/src/utils/dag-cbor-to-safe-json.js +46 -17
- package/dist/src/utils/dag-cbor-to-safe-json.js.map +1 -1
- package/dist/src/utils/get-content-type.js +1 -1
- package/dist/src/utils/get-content-type.js.map +1 -1
- package/dist/src/utils/select-output-type.d.ts.map +1 -1
- package/dist/src/utils/select-output-type.js +13 -1
- package/dist/src/utils/select-output-type.js.map +1 -1
- package/dist/src/verified-fetch.d.ts.map +1 -1
- package/dist/src/verified-fetch.js +4 -2
- package/dist/src/verified-fetch.js.map +1 -1
- package/package.json +4 -4
- package/src/constants.ts +1 -0
- package/src/plugins/plugin-handle-cbor.ts +107 -0
- package/src/plugins/plugin-handle-dag-cbor.ts +17 -27
- package/src/plugins/plugin-handle-dag-walk.ts +56 -7
- package/src/plugins/plugin-handle-json.ts +5 -3
- package/src/utils/byte-range-context.ts +1 -1
- package/src/utils/dag-cbor-to-safe-json.ts +55 -19
- package/src/utils/get-content-type.ts +1 -1
- package/src/utils/select-output-type.ts +13 -1
- package/src/verified-fetch.ts +4 -2
package/src/verified-fetch.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { CustomProgressEvent } from 'progress-events'
|
|
|
5
5
|
import QuickLRU from 'quick-lru'
|
|
6
6
|
import { ByteRangeContextPlugin } from './plugins/plugin-handle-byte-range-context.js'
|
|
7
7
|
import { CarPlugin } from './plugins/plugin-handle-car.js'
|
|
8
|
+
import { CborPlugin } from './plugins/plugin-handle-cbor.js'
|
|
8
9
|
import { DagCborPlugin } from './plugins/plugin-handle-dag-cbor.js'
|
|
9
10
|
import { DagPbPlugin } from './plugins/plugin-handle-dag-pb.js'
|
|
10
11
|
import { DagWalkPlugin } from './plugins/plugin-handle-dag-walk.js'
|
|
@@ -99,7 +100,8 @@ export class VerifiedFetch {
|
|
|
99
100
|
new TarPlugin(pluginOptions),
|
|
100
101
|
new JsonPlugin(pluginOptions),
|
|
101
102
|
new DagCborPlugin(pluginOptions),
|
|
102
|
-
new DagPbPlugin(pluginOptions)
|
|
103
|
+
new DagPbPlugin(pluginOptions),
|
|
104
|
+
new CborPlugin(pluginOptions)
|
|
103
105
|
]
|
|
104
106
|
|
|
105
107
|
const customPlugins = init.plugins?.map((pluginFactory) => pluginFactory(pluginOptions)) ?? []
|
|
@@ -245,7 +247,7 @@ export class VerifiedFetch {
|
|
|
245
247
|
this.log(`starting pipeline pass #${passCount + 1}`)
|
|
246
248
|
passCount++
|
|
247
249
|
|
|
248
|
-
this.log.trace('checking which plugins can handle %c%s with accept %o', context.cid, context.path
|
|
250
|
+
this.log.trace('checking which plugins can handle %c%s with accept %o', context.cid, context.path.length > 0 ? `/${context.path.join('/')}` : '', context.accept)
|
|
249
251
|
|
|
250
252
|
// gather plugins that say they can handle the *current* context, but haven't been used yet
|
|
251
253
|
const readyPlugins = this.plugins.filter(p => !pluginsUsed.has(p.id)).filter(p => p.canHandle(context))
|