@helia/interop 10.2.5 → 11.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 (66) hide show
  1. package/dist/src/car.spec.js.map +1 -1
  2. package/dist/src/dag-cbor.spec.js.map +1 -1
  3. package/dist/src/dag-json.spec.js.map +1 -1
  4. package/dist/src/dnslink.spec.js.map +1 -1
  5. package/dist/src/fixtures/connect.d.ts +2 -2
  6. package/dist/src/fixtures/connect.d.ts.map +1 -1
  7. package/dist/src/fixtures/connect.js.map +1 -1
  8. package/dist/src/fixtures/create-helia.browser.d.ts +3 -4
  9. package/dist/src/fixtures/create-helia.browser.d.ts.map +1 -1
  10. package/dist/src/fixtures/create-helia.browser.js +18 -18
  11. package/dist/src/fixtures/create-helia.browser.js.map +1 -1
  12. package/dist/src/fixtures/create-helia.d.ts +3 -5
  13. package/dist/src/fixtures/create-helia.d.ts.map +1 -1
  14. package/dist/src/fixtures/create-helia.js +18 -16
  15. package/dist/src/fixtures/create-helia.js.map +1 -1
  16. package/dist/src/fixtures/key-types.d.ts.map +1 -1
  17. package/dist/src/fixtures/key-types.js +0 -1
  18. package/dist/src/fixtures/key-types.js.map +1 -1
  19. package/dist/src/helia-blockstore-sessions.spec.js +1 -1
  20. package/dist/src/helia-blockstore-sessions.spec.js.map +1 -1
  21. package/dist/src/helia-blockstore.spec.js +2 -3
  22. package/dist/src/helia-blockstore.spec.js.map +1 -1
  23. package/dist/src/helia-hashes.spec.js.map +1 -1
  24. package/dist/src/helia-pins.spec.js.map +1 -1
  25. package/dist/src/helia-progress-events.spec.js +2 -3
  26. package/dist/src/helia-progress-events.spec.js.map +1 -1
  27. package/dist/src/ipns-http.spec.js +11 -7
  28. package/dist/src/ipns-http.spec.js.map +1 -1
  29. package/dist/src/ipns-pubsub.spec.js +5 -7
  30. package/dist/src/ipns-pubsub.spec.js.map +1 -1
  31. package/dist/src/ipns.spec.js +29 -21
  32. package/dist/src/ipns.spec.js.map +1 -1
  33. package/dist/src/json.spec.js.map +1 -1
  34. package/dist/src/libp2p.spec.d.ts +2 -0
  35. package/dist/src/libp2p.spec.d.ts.map +1 -0
  36. package/dist/src/libp2p.spec.js +80 -0
  37. package/dist/src/libp2p.spec.js.map +1 -0
  38. package/dist/src/providers.spec.js +7 -7
  39. package/dist/src/providers.spec.js.map +1 -1
  40. package/dist/src/strings.spec.js.map +1 -1
  41. package/dist/src/unixfs-bitswap.spec.js.map +1 -1
  42. package/dist/src/unixfs-files.spec.js.map +1 -1
  43. package/package.json +44 -45
  44. package/src/car.spec.ts +2 -2
  45. package/src/dag-cbor.spec.ts +2 -2
  46. package/src/dag-json.spec.ts +2 -2
  47. package/src/dnslink.spec.ts +2 -3
  48. package/src/fixtures/connect.ts +2 -2
  49. package/src/fixtures/create-helia.browser.ts +22 -24
  50. package/src/fixtures/create-helia.ts +22 -22
  51. package/src/fixtures/key-types.ts +0 -1
  52. package/src/helia-blockstore-sessions.spec.ts +4 -4
  53. package/src/helia-blockstore.spec.ts +4 -5
  54. package/src/helia-hashes.spec.ts +2 -2
  55. package/src/helia-pins.spec.ts +2 -2
  56. package/src/helia-progress-events.spec.ts +2 -3
  57. package/src/ipns-http.spec.ts +15 -9
  58. package/src/ipns-pubsub.spec.ts +7 -10
  59. package/src/ipns.spec.ts +37 -22
  60. package/src/json.spec.ts +2 -2
  61. package/src/libp2p.spec.ts +107 -0
  62. package/src/providers.spec.ts +14 -15
  63. package/src/strings.spec.ts +2 -2
  64. package/src/unixfs-bitswap.spec.ts +2 -2
  65. package/src/unixfs-files.spec.ts +2 -2
  66. package/.aegir.js +0 -49
@@ -13,7 +13,6 @@ import { multiaddr } from 'kubo-rpc-client'
13
13
  import { CID } from 'multiformats/cid'
14
14
  import { createHeliaNode } from './fixtures/create-helia.ts'
15
15
  import { createKuboNode } from './fixtures/create-kubo.ts'
16
- import type { PeerId } from '@libp2p/interface'
17
16
  import type { Helia } from 'helia'
18
17
  import type { FileCandidate } from 'ipfs-unixfs-importer'
19
18
  import type { KuboInfo, KuboNode } from 'ipfsd-ctl'
@@ -68,7 +67,7 @@ describe('providers', () => {
68
67
  })
69
68
 
70
69
  it('should fetch raw using a provider', async () => {
71
- let sender: PeerId | undefined
70
+ let sender: CID | undefined
72
71
 
73
72
  const buf = await toBuffer(helia.blockstore.get(cid, {
74
73
  providers: [
@@ -82,11 +81,11 @@ describe('providers', () => {
82
81
  }))
83
82
 
84
83
  expect(buf).to.have.lengthOf(1930)
85
- expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? ''))
84
+ expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? '').toCID())
86
85
  })
87
86
 
88
87
  it('should fetch dag-cbor using a provider', async () => {
89
- let sender: PeerId | undefined
88
+ let sender: CID | undefined
90
89
  const obj = { hello: 'world' }
91
90
  const cid = await kubo.api.dag.put(obj, {
92
91
  storeCodec: 'dag-cbor'
@@ -104,11 +103,11 @@ describe('providers', () => {
104
103
  }
105
104
  }
106
105
  })).to.eventually.deep.equal(obj)
107
- expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? ''))
106
+ expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? '').toCID())
108
107
  })
109
108
 
110
109
  it('should fetch dag-json using a provider', async () => {
111
- let sender: PeerId | undefined
110
+ let sender: CID | undefined
112
111
  const obj = { hello: 'world' }
113
112
  const cid = await kubo.api.dag.put(obj, {
114
113
  storeCodec: 'dag-json'
@@ -126,11 +125,11 @@ describe('providers', () => {
126
125
  }
127
126
  }
128
127
  })).to.eventually.deep.equal(obj)
129
- expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? ''))
128
+ expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? '').toCID())
130
129
  })
131
130
 
132
131
  it('should fetch string using a provider', async () => {
133
- let sender: PeerId | undefined
132
+ let sender: CID | undefined
134
133
  const obj = 'hello world'
135
134
  const cid = await kubo.api.dag.put(obj, {
136
135
  storeCodec: 'dag-json'
@@ -148,11 +147,11 @@ describe('providers', () => {
148
147
  }
149
148
  }
150
149
  })).to.eventually.equal(JSON.stringify(obj))
151
- expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? ''))
150
+ expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? '').toCID())
152
151
  })
153
152
 
154
153
  it('should fetch via unixfs using a provider', async () => {
155
- let sender: PeerId | undefined
154
+ let sender: CID | undefined
156
155
  const fs = unixfs(helia)
157
156
 
158
157
  const bytes = await toBuffer(fs.cat(cid, {
@@ -167,11 +166,11 @@ describe('providers', () => {
167
166
  }))
168
167
 
169
168
  expect(bytes).to.equalBytes(toBuffer(input))
170
- expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? ''))
169
+ expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? '').toCID())
171
170
  })
172
171
 
173
172
  it('should fetch via mfs using a provider', async () => {
174
- let sender: PeerId | undefined
173
+ let sender: CID | undefined
175
174
  const fs = mfs(helia)
176
175
 
177
176
  await fs.cp(cid, '/file.txt', {
@@ -188,11 +187,11 @@ describe('providers', () => {
188
187
  const bytes = await toBuffer(fs.cat('/file.txt'))
189
188
 
190
189
  expect(bytes).to.equalBytes(toBuffer(input))
191
- expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? ''))
190
+ expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? '').toCID())
192
191
  })
193
192
 
194
193
  it('should fetch via car using a provider', async () => {
195
- let sender: PeerId | undefined
194
+ let sender: CID | undefined
196
195
  const c = car(helia)
197
196
 
198
197
  expect(await toBuffer(
@@ -210,6 +209,6 @@ describe('providers', () => {
210
209
  ).to.equalBytes(await toBuffer(
211
210
  kubo.api.dag.export(cid)
212
211
  ))
213
- expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? ''))
212
+ expect(sender).to.deep.equal(peerIdFromString(kuboInfo.peerId?.toString() ?? '').toCID())
214
213
  })
215
214
  })
@@ -5,13 +5,13 @@ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
5
5
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
6
6
  import { createHeliaNode } from './fixtures/create-helia.ts'
7
7
  import { createKuboNode } from './fixtures/create-kubo.ts'
8
+ import type { HeliaWithLibp2p } from '@helia/libp2p'
8
9
  import type { Strings, AddOptions } from '@helia/strings'
9
- import type { Helia } from 'helia'
10
10
  import type { KuboNode } from 'ipfsd-ctl'
11
11
  import type { BlockPutOptions as KuboAddOptions } from 'kubo-rpc-client'
12
12
 
13
13
  describe('@helia/strings', () => {
14
- let helia: Helia
14
+ let helia: HeliaWithLibp2p
15
15
  let str: Strings
16
16
  let kubo: KuboNode
17
17
 
@@ -4,13 +4,13 @@ import toBuffer from 'it-to-buffer'
4
4
  import { CID } from 'multiformats/cid'
5
5
  import { createHeliaNode } from './fixtures/create-helia.ts'
6
6
  import { createKuboNode } from './fixtures/create-kubo.ts'
7
+ import type { HeliaWithLibp2p } from '@helia/libp2p'
7
8
  import type { UnixFS } from '@helia/unixfs'
8
- import type { Helia } from 'helia'
9
9
  import type { ByteStream, FileCandidate } from 'ipfs-unixfs-importer'
10
10
  import type { KuboNode } from 'ipfsd-ctl'
11
11
 
12
12
  describe('@helia/unixfs - bitswap', () => {
13
- let helia: Helia
13
+ let helia: HeliaWithLibp2p
14
14
  let unixFs: UnixFS
15
15
  let kubo: KuboNode
16
16
 
@@ -11,14 +11,14 @@ import { CID } from 'multiformats/cid'
11
11
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
12
12
  import { createHeliaNode } from './fixtures/create-helia.ts'
13
13
  import { createKuboNode } from './fixtures/create-kubo.ts'
14
+ import type { HeliaWithLibp2p } from '@helia/libp2p'
14
15
  import type { AddOptions, UnixFS } from '@helia/unixfs'
15
- import type { Helia } from 'helia'
16
16
  import type { ByteStream, ImportCandidateStream } from 'ipfs-unixfs-importer'
17
17
  import type { KuboNode } from 'ipfsd-ctl'
18
18
  import type { AddOptions as KuboAddOptions } from 'kubo-rpc-client'
19
19
 
20
20
  describe('@helia/unixfs - files', () => {
21
- let helia: Helia
21
+ let helia: HeliaWithLibp2p
22
22
  let unixFs: UnixFS
23
23
  let kubo: KuboNode
24
24
 
package/.aegir.js DELETED
@@ -1,49 +0,0 @@
1
- import getPort from 'aegir/get-port'
2
- import { createServer } from 'ipfsd-ctl'
3
- import { create } from 'kubo-rpc-client'
4
- import { path } from 'kubo'
5
-
6
- /** @type {import('aegir').PartialOptions} */
7
- export default {
8
- test: {
9
- files: './dist/src/*.spec.js',
10
- before: async (options) => {
11
- if (options.runner !== 'node') {
12
- const ipfsdPort = await getPort()
13
- const ipfsdServer = await createServer({
14
- host: '127.0.0.1',
15
- port: ipfsdPort
16
- }, {
17
- type: 'kubo',
18
- bin: path(),
19
- rpc: create,
20
- test: true,
21
- init: {
22
- config: {
23
- Addresses: {
24
- Swarm: [
25
- "/ip4/0.0.0.0/tcp/0",
26
- "/ip4/0.0.0.0/tcp/0/ws"
27
- ]
28
- }
29
- }
30
- }
31
- }).start()
32
-
33
- return {
34
- env: {
35
- IPFSD_SERVER: `http://127.0.0.1:${ipfsdPort}`
36
- },
37
- ipfsdServer
38
- }
39
- }
40
-
41
- return {}
42
- },
43
- after: async (options, beforeResult) => {
44
- if (options.runner !== 'node') {
45
- await beforeResult.ipfsdServer.stop()
46
- }
47
- }
48
- }
49
- }