Skip to content

Commit 6332556

Browse files
authored
fix!: remove deprecated code (#3271)
Removes all deprecated properties and methods that were flagged for later removal. BREAKING CHANGE: All props and methods flagged as deprecated and for removal have been removed
1 parent da78fa8 commit 6332556

File tree

24 files changed

+20
-498
lines changed

24 files changed

+20
-498
lines changed

packages/integration-tests/test/dht.node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
1717
import type { Identify } from '@libp2p/identify'
1818
import type { Libp2p, PeerId } from '@libp2p/interface'
1919
import type { KadDHT } from '@libp2p/kad-dht'
20-
import type { PingService } from '@libp2p/ping'
20+
import type { Ping } from '@libp2p/ping'
2121
import type { Multiaddr } from '@multiformats/multiaddr'
2222
import type { Libp2pOptions } from 'libp2p'
2323

@@ -151,7 +151,7 @@ describe('DHT subsystem operates correctly', () => {
151151
it('kad-dht should discover other peers', async () => {
152152
const deferred = pDefer()
153153

154-
const getConfig = (): Libp2pOptions<{ dht: KadDHT, ping: PingService, identify: Identify }> => ({
154+
const getConfig = (): Libp2pOptions<{ dht: KadDHT, ping: Ping, identify: Identify }> => ({
155155
addresses: {
156156
listen: [
157157
listenAddr.toString()

packages/integration-tests/test/identify.node.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,11 @@ describe('identify', () => {
224224
const agentVersion = 'js-project/1.0.0'
225225

226226
const libp2p = await createLibp2p(createBaseOptions({
227+
nodeInfo: {
228+
userAgent: agentVersion
229+
},
227230
services: {
228-
identify: identify({
229-
agentVersion
230-
})
231+
identify: identify()
231232
}
232233
}))
233234

packages/integration-tests/test/interop.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import pDefer from 'p-defer'
2525
import type { Identify } from '@libp2p/identify'
2626
import type { ServiceMap, PrivateKey } from '@libp2p/interface'
2727
import type { SpawnOptions, Daemon, DaemonFactory } from '@libp2p/interop'
28-
import type { PingService } from '@libp2p/ping'
28+
import type { Ping } from '@libp2p/ping'
2929
import type { Libp2pOptions, ServiceFactoryMap } from 'libp2p'
3030

3131
/**
@@ -159,7 +159,7 @@ async function createJsPeer (options: SpawnOptions): Promise<Daemon> {
159159
throw new UnsupportedError()
160160
}
161161

162-
const services: ServiceFactoryMap<{ identify: Identify, ping: PingService } & Record<string, any>> = {
162+
const services: ServiceFactoryMap<{ identify: Identify, ping: Ping } & Record<string, any>> = {
163163
identify: identify(),
164164
ping: ping()
165165
}

packages/integration-tests/test/ping.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import { expect } from 'aegir/chai'
66
import { createLibp2p } from 'libp2p'
77
import { createBaseOptions } from './fixtures/base-options.js'
88
import type { Libp2p } from '@libp2p/interface'
9-
import type { PingService } from '@libp2p/ping'
9+
import type { Ping } from '@libp2p/ping'
1010

1111
describe('ping', () => {
12-
let nodes: Array<Libp2p<{ ping: PingService }>>
12+
let nodes: Array<Libp2p<{ ping: Ping }>>
1313

1414
beforeEach(async () => {
1515
nodes = await Promise.all([

packages/interface-internal/src/registrar.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology, StreamMiddleware, AbortOptions } from '@libp2p/interface'
22

3-
export type {
4-
/**
5-
* @deprecated This type should be imported from @libp2p/interface directly
6-
*/
7-
StreamHandler,
8-
9-
/**
10-
* @deprecated This type should be imported from @libp2p/interface directly
11-
*/
12-
StreamHandlerOptions,
13-
14-
/**
15-
* @deprecated This type should be imported from @libp2p/interface directly
16-
*/
17-
StreamHandlerRecord
18-
}
19-
203
/**
214
* The `Registrar` provides an interface for registering protocol handlers -
225
* these are invoked when remote peers open streams on the local node with the

packages/interface/src/errors.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -132,34 +132,6 @@ export class MuxerClosedError extends Error {
132132
}
133133
}
134134

135-
/**
136-
* Thrown when a protocol stream is closed during an operation
137-
*
138-
* @deprecated delete if unused
139-
*/
140-
export class StreamClosedError extends Error {
141-
static name = 'StreamClosedError'
142-
143-
constructor (message = 'The stream has been closed') {
144-
super(message)
145-
this.name = 'StreamClosedError'
146-
}
147-
}
148-
149-
/**
150-
* Thrown when a protocol stream is closing during an operation
151-
*
152-
* @deprecated delete if unused
153-
*/
154-
export class StreamClosingError extends Error {
155-
static name = 'StreamClosingError'
156-
157-
constructor (message = 'The stream is closing') {
158-
super(message)
159-
this.name = 'StreamClosingError'
160-
}
161-
}
162-
163135
/**
164136
* Thrown when a protocol stream is reset by the remote muxer
165137
*/

packages/interface/src/peer-store.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,4 @@ export interface PeerStore {
314314
* ```
315315
*/
316316
consumePeerRecord(buf: Uint8Array, options?: ConsumePeerRecordOptions): Promise<boolean>
317-
318-
/**
319-
* @deprecated Pass `expectedPeer` as a property of `options` instead
320-
*/
321-
consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId, options?: AbortOptions): Promise<boolean>
322317
}

packages/libp2p/src/connection-manager/index.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,24 +82,6 @@ export interface ConnectionManagerInit {
8282
*/
8383
inboundUpgradeTimeout?: number
8484

85-
/**
86-
* When a new outbound connection is opened, the upgrade process (e.g.
87-
* protect, encrypt, multiplex etc) must complete within this number of ms.
88-
*
89-
* Does not apply if an abort signal is passed to the `.dial` method.
90-
*
91-
* @deprecated This is handled by `dialTimeout`
92-
*/
93-
outboundUpgradeTimeout?: number
94-
95-
/**
96-
* Protocol negotiation must complete within this number of ms
97-
*
98-
* @default 2000
99-
* @deprecated use outboundStreamProtocolNegotiationTimeout or inboundStreamProtocolNegotiationTimeout instead
100-
*/
101-
protocolNegotiationTimeout?: number
102-
10385
/**
10486
* Outbound protocol negotiation must complete within this number of ms.
10587
*

packages/libp2p/src/libp2p.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ export class Libp2p<T extends ServiceMap = ServiceMap> extends TypedEventEmitter
119119
connectionEncrypters: (init.connectionEncrypters ?? []).map((fn, index) => this.configureComponent(`connection-encryption-${index}`, fn(this.components))),
120120
streamMuxers: (init.streamMuxers ?? []).map((fn, index) => this.configureComponent(`stream-muxers-${index}`, fn(this.components))),
121121
inboundUpgradeTimeout: init.connectionManager?.inboundUpgradeTimeout,
122-
inboundStreamProtocolNegotiationTimeout: init.connectionManager?.inboundStreamProtocolNegotiationTimeout ?? init.connectionManager?.protocolNegotiationTimeout,
123-
outboundStreamProtocolNegotiationTimeout: init.connectionManager?.outboundStreamProtocolNegotiationTimeout ?? init.connectionManager?.protocolNegotiationTimeout,
122+
inboundStreamProtocolNegotiationTimeout: init.connectionManager?.inboundStreamProtocolNegotiationTimeout,
123+
outboundStreamProtocolNegotiationTimeout: init.connectionManager?.outboundStreamProtocolNegotiationTimeout,
124124
connectionCloseTimeout: init.connectionManager?.connectionCloseTimeout
125125
})
126126

packages/protocol-identify/src/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ export interface IdentifyInit {
5555
*/
5656
protocolPrefix?: string
5757

58-
/**
59-
* What details we should send as part of an identify message
60-
*
61-
* @deprecated Use `nodeInfo.userAgent` in the main libp2p config instead
62-
*/
63-
agentVersion?: string
64-
6558
/**
6659
* How long we should wait for a remote peer to send their identify response
6760
*

0 commit comments

Comments
 (0)