@helia/verified-fetch 7.2.15 → 8.0.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 (48) hide show
  1. package/README.md +8 -12
  2. package/dist/index.min.js +70 -59
  3. package/dist/index.min.js.map +4 -4
  4. package/dist/src/index.d.ts +27 -17
  5. package/dist/src/index.d.ts.map +1 -1
  6. package/dist/src/index.js +38 -34
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/plugins/plugin-handle-ipns-record.d.ts +1 -1
  9. package/dist/src/plugins/plugin-handle-ipns-record.d.ts.map +1 -1
  10. package/dist/src/plugins/plugin-handle-ipns-record.js +23 -5
  11. package/dist/src/plugins/plugin-handle-ipns-record.js.map +1 -1
  12. package/dist/src/plugins/plugin-handle-unixfs.d.ts.map +1 -1
  13. package/dist/src/plugins/plugin-handle-unixfs.js +7 -4
  14. package/dist/src/plugins/plugin-handle-unixfs.js.map +1 -1
  15. package/dist/src/url-resolver.d.ts.map +1 -1
  16. package/dist/src/url-resolver.js +33 -9
  17. package/dist/src/url-resolver.js.map +1 -1
  18. package/dist/src/utils/convert-output.d.ts +2 -2
  19. package/dist/src/utils/convert-output.d.ts.map +1 -1
  20. package/dist/src/utils/convert-output.js +11 -5
  21. package/dist/src/utils/convert-output.js.map +1 -1
  22. package/dist/src/utils/ipfs-path-to-cid.d.ts +6 -0
  23. package/dist/src/utils/ipfs-path-to-cid.d.ts.map +1 -0
  24. package/dist/src/utils/ipfs-path-to-cid.js +9 -0
  25. package/dist/src/utils/ipfs-path-to-cid.js.map +1 -0
  26. package/dist/src/utils/libp2p-defaults.browser.js +1 -1
  27. package/dist/src/utils/libp2p-defaults.browser.js.map +1 -1
  28. package/dist/src/utils/libp2p-defaults.d.ts.map +1 -1
  29. package/dist/src/utils/libp2p-defaults.js +2 -10
  30. package/dist/src/utils/libp2p-defaults.js.map +1 -1
  31. package/dist/src/utils/response-headers.d.ts +12 -4
  32. package/dist/src/utils/response-headers.d.ts.map +1 -1
  33. package/dist/src/utils/response-headers.js +25 -13
  34. package/dist/src/utils/response-headers.js.map +1 -1
  35. package/dist/src/verified-fetch.d.ts.map +1 -1
  36. package/dist/src/verified-fetch.js +6 -4
  37. package/dist/src/verified-fetch.js.map +1 -1
  38. package/package.json +28 -31
  39. package/src/index.ts +65 -41
  40. package/src/plugins/plugin-handle-ipns-record.ts +31 -6
  41. package/src/plugins/plugin-handle-unixfs.ts +7 -4
  42. package/src/url-resolver.ts +43 -9
  43. package/src/utils/convert-output.ts +13 -7
  44. package/src/utils/ipfs-path-to-cid.ts +9 -0
  45. package/src/utils/libp2p-defaults.browser.ts +2 -2
  46. package/src/utils/libp2p-defaults.ts +3 -11
  47. package/src/utils/response-headers.ts +33 -15
  48. package/src/verified-fetch.ts +7 -4
package/README.md CHANGED
@@ -130,23 +130,19 @@ The [helia](https://www.npmjs.com/package/helia) module is configured with a lib
130
130
  You can see variations of Helia and js-libp2p configuration options at <https://ipfs.github.io/helia/interfaces/helia.HeliaInit.html>.
131
131
 
132
132
  ```typescript
133
- import { trustlessGateway } from '@helia/block-brokers'
134
- import { createHeliaHTTP } from '@helia/http'
133
+ import { createHeliaLight } from 'helia'
134
+ import { withHTTP } from '@helia/http'
135
135
  import { delegatedHTTPRouting, httpGatewayRouting } from '@helia/routers'
136
136
  import { createVerifiedFetch } from '@helia/verified-fetch'
137
137
 
138
138
  const fetch = await createVerifiedFetch(
139
- await createHeliaHTTP({
140
- blockBrokers: [
141
- trustlessGateway()
139
+ await withHTTP(createHeliaLight(), {
140
+ delegatedRouters: [
141
+ 'http://delegated-ipfs.dev'
142
142
  ],
143
- routers: [
144
- delegatedHTTPRouting({
145
- url: 'http://delegated-ipfs.dev'
146
- }),
147
- httpGatewayRouting({
148
- gateways: ['https://mygateway.example.net', 'https://trustless-gateway.link']
149
- })
143
+ recursiveGateways: [
144
+ 'https://mygateway.example.net',
145
+ 'https://trustless-gateway.link'
150
146
  ]
151
147
  })
152
148
  )