@libp2p/kad-dht 16.3.0 → 16.3.1

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 (56) hide show
  1. package/dist/index.min.js +1 -1
  2. package/dist/index.min.js.map +4 -4
  3. package/dist/src/content-fetching/index.d.ts +4 -4
  4. package/dist/src/content-fetching/index.js +7 -7
  5. package/dist/src/content-routing/index.d.ts +6 -6
  6. package/dist/src/content-routing/index.js +4 -4
  7. package/dist/src/peer-routing/index.d.ts +4 -4
  8. package/dist/src/peer-routing/index.js +6 -6
  9. package/dist/src/query/events.d.ts +1 -1
  10. package/dist/src/query/manager.d.ts +2 -2
  11. package/dist/src/query/manager.js +2 -2
  12. package/dist/src/query/query-path.d.ts +2 -2
  13. package/dist/src/query/query-path.js +1 -1
  14. package/dist/src/query/types.d.ts +1 -1
  15. package/dist/src/record/selectors.d.ts +1 -1
  16. package/dist/src/record/selectors.js +1 -1
  17. package/dist/src/record/validators.d.ts +1 -1
  18. package/dist/src/routing-table/closest-peers.js +3 -3
  19. package/dist/src/routing-table/index.d.ts +1 -1
  20. package/dist/src/routing-table/index.js +1 -1
  21. package/dist/src/routing-table/k-bucket.js +2 -2
  22. package/dist/src/routing-table/refresh.d.ts +1 -1
  23. package/dist/src/routing-table/refresh.js +1 -1
  24. package/dist/src/rpc/handlers/add-provider.d.ts +3 -3
  25. package/dist/src/rpc/handlers/find-node.d.ts +4 -4
  26. package/dist/src/rpc/handlers/find-node.js +1 -1
  27. package/dist/src/rpc/handlers/get-providers.d.ts +5 -5
  28. package/dist/src/rpc/handlers/get-providers.js +1 -1
  29. package/dist/src/rpc/handlers/get-value.d.ts +3 -3
  30. package/dist/src/rpc/handlers/get-value.js +3 -3
  31. package/dist/src/rpc/handlers/ping.d.ts +2 -2
  32. package/dist/src/rpc/handlers/put-value.d.ts +3 -3
  33. package/dist/src/rpc/handlers/put-value.js +2 -2
  34. package/dist/src/rpc/index.d.ts +5 -5
  35. package/dist/src/rpc/index.js +1 -1
  36. package/package.json +16 -16
  37. package/src/content-fetching/index.ts +13 -13
  38. package/src/content-routing/index.ts +12 -12
  39. package/src/peer-routing/index.ts +12 -12
  40. package/src/query/events.ts +1 -1
  41. package/src/query/manager.ts +4 -4
  42. package/src/query/query-path.ts +3 -3
  43. package/src/query/types.ts +1 -1
  44. package/src/record/selectors.ts +2 -2
  45. package/src/record/validators.ts +1 -1
  46. package/src/routing-table/closest-peers.ts +3 -3
  47. package/src/routing-table/index.ts +2 -2
  48. package/src/routing-table/k-bucket.ts +2 -2
  49. package/src/routing-table/refresh.ts +2 -2
  50. package/src/rpc/handlers/add-provider.ts +3 -3
  51. package/src/rpc/handlers/find-node.ts +5 -5
  52. package/src/rpc/handlers/get-providers.ts +6 -6
  53. package/src/rpc/handlers/get-value.ts +6 -6
  54. package/src/rpc/handlers/ping.ts +2 -2
  55. package/src/rpc/handlers/put-value.ts +5 -5
  56. package/src/rpc/index.ts +5 -5
@@ -3,10 +3,10 @@ import { Queue } from '@libp2p/utils'
3
3
  import { pushable } from 'it-pushable'
4
4
  import { xor as uint8ArrayXor } from 'uint8arrays/xor'
5
5
  import { xorCompare as uint8ArrayXorCompare } from 'uint8arrays/xor-compare'
6
- import { convertPeerId, convertBuffer } from '../utils.js'
6
+ import { convertPeerId, convertBuffer } from '../utils.ts'
7
7
  import { pathEndedEvent, queryErrorEvent } from './events.ts'
8
- import type { QueryEvent } from '../index.js'
9
- import type { QueryFunc } from '../query/types.js'
8
+ import type { QueryEvent } from '../index.ts'
9
+ import type { QueryFunc } from '../query/types.ts'
10
10
  import type { Logger, PeerId, RoutingOptions, AbortOptions, PeerInfo } from '@libp2p/interface'
11
11
  import type { ConnectionManager } from '@libp2p/interface-internal'
12
12
  import type { Filter } from '@libp2p/utils'
@@ -1,4 +1,4 @@
1
- import type { DisjointPath, QueryEvent } from '../index.js'
1
+ import type { DisjointPath, QueryEvent } from '../index.ts'
2
2
  import type { PeerInfo } from '@libp2p/interface'
3
3
 
4
4
  export interface QueryContext {
@@ -1,7 +1,7 @@
1
1
  import { InvalidParametersError } from '@libp2p/interface'
2
2
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
3
- import { MissingSelectorError } from '../errors.js'
4
- import type { Selectors } from '../index.js'
3
+ import { MissingSelectorError } from '../errors.ts'
4
+ import type { Selectors } from '../index.ts'
5
5
 
6
6
  /**
7
7
  * Select the best record out of the given records
@@ -2,7 +2,7 @@ import { publicKeyFromProtobuf } from '@libp2p/crypto/keys'
2
2
  import { InvalidParametersError } from '@libp2p/interface'
3
3
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
4
4
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
5
- import type { Validators } from '../index.js'
5
+ import type { Validators } from '../index.ts'
6
6
  import type { Libp2pRecord } from '@libp2p/record'
7
7
  import type { AbortOptions } from 'it-pushable'
8
8
 
@@ -1,7 +1,7 @@
1
1
  import { PeerSet } from '@libp2p/peer-collections'
2
- import { KEEP_ALIVE_TAG } from '../constants.js'
3
- import { PeerDistanceList } from '../peer-distance-list.js'
4
- import { convertPeerId } from '../utils.js'
2
+ import { KEEP_ALIVE_TAG } from '../constants.ts'
3
+ import { PeerDistanceList } from '../peer-distance-list.ts'
4
+ import { convertPeerId } from '../utils.ts'
5
5
  import type { RoutingTable } from './index.ts'
6
6
  import type { ComponentLogger, Logger, Metrics, PeerId, PeerStore, Startable } from '@libp2p/interface'
7
7
 
@@ -3,11 +3,11 @@ import { AdaptiveTimeout, PeerQueue } from '@libp2p/utils'
3
3
  import { anySignal } from 'any-signal'
4
4
  import parallel from 'it-parallel'
5
5
  import { TypedEventEmitter, setMaxListeners } from 'main-event'
6
- import * as utils from '../utils.js'
6
+ import * as utils from '../utils.ts'
7
7
  import { ClosestPeers } from './closest-peers.ts'
8
8
  import { KBucket, isLeafBucket } from './k-bucket.ts'
9
9
  import type { Bucket, GetClosestPeersOptions, LeafBucket, Peer } from './k-bucket.ts'
10
- import type { Network } from '../network.js'
10
+ import type { Network } from '../network.ts'
11
11
  import type { AbortOptions, ComponentLogger, CounterGroup, Logger, Metric, Metrics, PeerId, PeerStore, Startable, Stream } from '@libp2p/interface'
12
12
  import type { Ping } from '@libp2p/ping'
13
13
  import type { AdaptiveTimeoutInit } from '@libp2p/utils'
@@ -3,8 +3,8 @@ import map from 'it-map'
3
3
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
4
4
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
5
5
  import { xor as uint8ArrayXor } from 'uint8arrays/xor'
6
- import { PeerDistanceList } from '../peer-distance-list.js'
7
- import { convertPeerId } from '../utils.js'
6
+ import { PeerDistanceList } from '../peer-distance-list.ts'
7
+ import { convertPeerId } from '../utils.ts'
8
8
  import { KBUCKET_SIZE, LAST_PING_THRESHOLD, PING_OLD_CONTACT_COUNT, PREFIX_LENGTH } from './index.ts'
9
9
  import type { PeerId, AbortOptions, Metrics } from '@libp2p/interface'
10
10
 
@@ -6,10 +6,10 @@ import { setMaxListeners } from 'main-event'
6
6
  import * as Digest from 'multiformats/hashes/digest'
7
7
  import { sha256 } from 'multiformats/hashes/sha2'
8
8
  import { xor as uint8ArrayXor } from 'uint8arrays/xor'
9
- import { TABLE_REFRESH_INTERVAL, TABLE_REFRESH_QUERY_TIMEOUT } from '../constants.js'
9
+ import { TABLE_REFRESH_INTERVAL, TABLE_REFRESH_QUERY_TIMEOUT } from '../constants.ts'
10
10
  import GENERATED_PREFIXES from './generated-prefix-list.ts'
11
11
  import type { RoutingTable } from './index.ts'
12
- import type { PeerRouting } from '../peer-routing/index.js'
12
+ import type { PeerRouting } from '../peer-routing/index.ts'
13
13
  import type { AbortOptions, ComponentLogger, Logger, PeerId } from '@libp2p/interface'
14
14
 
15
15
  /**
@@ -3,9 +3,9 @@ import { peerIdFromMultihash } from '@libp2p/peer-id'
3
3
  import { multiaddr } from '@multiformats/multiaddr'
4
4
  import { CID } from 'multiformats/cid'
5
5
  import * as Digest from 'multiformats/hashes/digest'
6
- import type { Message } from '../../message/dht.js'
7
- import type { Providers } from '../../providers.js'
8
- import type { DHTMessageHandler } from '../index.js'
6
+ import type { Message } from '../../message/dht.ts'
7
+ import type { Providers } from '../../providers.ts'
8
+ import type { DHTMessageHandler } from '../index.ts'
9
9
  import type { ComponentLogger, Logger, PeerId, PeerStore } from '@libp2p/interface'
10
10
 
11
11
  export interface AddProviderComponents {
@@ -1,11 +1,11 @@
1
1
  import { InvalidMessageError } from '@libp2p/interface'
2
2
  import { CODE_P2P } from '@multiformats/multiaddr'
3
3
  import { equals as uint8ArrayEquals } from 'uint8arrays'
4
- import { MessageType } from '../../message/dht.js'
5
- import type { PeerInfoMapper } from '../../index.js'
6
- import type { Message } from '../../message/dht.js'
7
- import type { PeerRouting } from '../../peer-routing/index.js'
8
- import type { DHTMessageHandler } from '../index.js'
4
+ import { MessageType } from '../../message/dht.ts'
5
+ import type { PeerInfoMapper } from '../../index.ts'
6
+ import type { Message } from '../../message/dht.ts'
7
+ import type { PeerRouting } from '../../peer-routing/index.ts'
8
+ import type { DHTMessageHandler } from '../index.ts'
9
9
  import type { ComponentLogger, Logger, PeerId, PeerInfo } from '@libp2p/interface'
10
10
  import type { AddressManager } from '@libp2p/interface-internal'
11
11
 
@@ -2,12 +2,12 @@ import { InvalidMessageError } from '@libp2p/interface'
2
2
  import all from 'it-all'
3
3
  import map from 'it-map'
4
4
  import { CID } from 'multiformats/cid'
5
- import { MessageType } from '../../message/dht.js'
6
- import type { PeerInfoMapper } from '../../index.js'
7
- import type { Message } from '../../message/dht.js'
8
- import type { PeerRouting } from '../../peer-routing/index.js'
9
- import type { Providers } from '../../providers.js'
10
- import type { DHTMessageHandler } from '../index.js'
5
+ import { MessageType } from '../../message/dht.ts'
6
+ import type { PeerInfoMapper } from '../../index.ts'
7
+ import type { Message } from '../../message/dht.ts'
8
+ import type { PeerRouting } from '../../peer-routing/index.ts'
9
+ import type { Providers } from '../../providers.ts'
10
+ import type { DHTMessageHandler } from '../index.ts'
11
11
  import type { ComponentLogger, Logger, PeerId, PeerInfo, PeerStore } from '@libp2p/interface'
12
12
  import type { Multiaddr } from '@multiformats/multiaddr'
13
13
 
@@ -3,12 +3,12 @@ import { InvalidMessageError, NotFoundError } from '@libp2p/interface'
3
3
  import { Libp2pRecord } from '@libp2p/record'
4
4
  import {
5
5
  PROVIDERS_VALIDITY
6
- } from '../../constants.js'
7
- import { MessageType } from '../../message/dht.js'
8
- import { bufferToRecordKey, isPublicKeyKey, fromPublicKeyKey } from '../../utils.js'
9
- import type { Message } from '../../message/dht.js'
10
- import type { PeerRouting } from '../../peer-routing/index.js'
11
- import type { DHTMessageHandler } from '../index.js'
6
+ } from '../../constants.ts'
7
+ import { MessageType } from '../../message/dht.ts'
8
+ import { bufferToRecordKey, isPublicKeyKey, fromPublicKeyKey } from '../../utils.ts'
9
+ import type { Message } from '../../message/dht.ts'
10
+ import type { PeerRouting } from '../../peer-routing/index.ts'
11
+ import type { DHTMessageHandler } from '../index.ts'
12
12
  import type { ComponentLogger, Logger, PeerId, PeerStore } from '@libp2p/interface'
13
13
  import type { Datastore } from 'interface-datastore'
14
14
 
@@ -1,5 +1,5 @@
1
- import type { Message } from '../../message/dht.js'
2
- import type { DHTMessageHandler } from '../index.js'
1
+ import type { Message } from '../../message/dht.ts'
2
+ import type { DHTMessageHandler } from '../index.ts'
3
3
  import type { ComponentLogger, Logger, PeerId } from '@libp2p/interface'
4
4
 
5
5
  export interface PingComponents {
@@ -1,10 +1,10 @@
1
1
  import { InvalidMessageError } from '@libp2p/interface'
2
2
  import { Libp2pRecord } from '@libp2p/record'
3
- import { verifyRecord } from '../../record/validators.js'
4
- import { bufferToRecordKey } from '../../utils.js'
5
- import type { Validators } from '../../index.js'
6
- import type { Message } from '../../message/dht.js'
7
- import type { DHTMessageHandler } from '../index.js'
3
+ import { verifyRecord } from '../../record/validators.ts'
4
+ import { bufferToRecordKey } from '../../utils.ts'
5
+ import type { Validators } from '../../index.ts'
6
+ import type { Message } from '../../message/dht.ts'
7
+ import type { DHTMessageHandler } from '../index.ts'
8
8
  import type { ComponentLogger, Logger, PeerId } from '@libp2p/interface'
9
9
  import type { Datastore } from 'interface-datastore'
10
10
 
package/src/rpc/index.ts CHANGED
@@ -1,20 +1,20 @@
1
1
  import { InvalidMessageError, TimeoutError } from '@libp2p/interface'
2
2
  import { pbStream } from '@libp2p/utils'
3
- import { Message, MessageType } from '../message/dht.js'
3
+ import { Message, MessageType } from '../message/dht.ts'
4
4
  import { AddProviderHandler } from './handlers/add-provider.ts'
5
5
  import { FindNodeHandler } from './handlers/find-node.ts'
6
6
  import { GetProvidersHandler } from './handlers/get-providers.ts'
7
7
  import { GetValueHandler } from './handlers/get-value.ts'
8
8
  import { PingHandler } from './handlers/ping.ts'
9
9
  import { PutValueHandler } from './handlers/put-value.ts'
10
- import type { PeerInfoMapper, Validators } from '../index.js'
11
- import type { PeerRouting } from '../peer-routing/index.js'
12
- import type { Providers } from '../providers.js'
10
+ import type { PeerInfoMapper, Validators } from '../index.ts'
11
+ import type { PeerRouting } from '../peer-routing/index.ts'
12
+ import type { Providers } from '../providers.ts'
13
13
  import type { FindNodeHandlerComponents } from './handlers/find-node.ts'
14
14
  import type { GetProvidersHandlerComponents } from './handlers/get-providers.ts'
15
15
  import type { GetValueHandlerComponents } from './handlers/get-value.ts'
16
16
  import type { PutValueHandlerComponents } from './handlers/put-value.ts'
17
- import type { RoutingTable } from '../routing-table/index.js'
17
+ import type { RoutingTable } from '../routing-table/index.ts'
18
18
  import type { CounterGroup, Logger, Metrics, PeerId, MetricGroup, Connection, Stream } from '@libp2p/interface'
19
19
 
20
20
  export interface DHTMessageHandler {