@libp2p/utils 7.0.15 → 7.0.17

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 (64) hide show
  1. package/dist/index.min.js +4 -9
  2. package/dist/index.min.js.map +4 -4
  3. package/dist/src/abstract-stream.d.ts +2 -2
  4. package/dist/src/abstract-stream.js +1 -1
  5. package/dist/src/adaptive-timeout.js +1 -1
  6. package/dist/src/errors.d.ts +1 -1
  7. package/dist/src/filters/bloom-filter.d.ts +1 -1
  8. package/dist/src/filters/bloom-filter.js +1 -1
  9. package/dist/src/filters/bucket.d.ts +1 -1
  10. package/dist/src/filters/bucket.js +2 -2
  11. package/dist/src/filters/cuckoo-filter.d.ts +2 -2
  12. package/dist/src/filters/cuckoo-filter.js +4 -4
  13. package/dist/src/filters/fingerprint.d.ts +1 -1
  14. package/dist/src/filters/index.d.ts +6 -6
  15. package/dist/src/filters/index.js +3 -3
  16. package/dist/src/filters/scalable-cuckoo-filter.d.ts +2 -2
  17. package/dist/src/filters/scalable-cuckoo-filter.js +3 -3
  18. package/dist/src/get-thin-waist-addresses.js +1 -1
  19. package/dist/src/index.d.ts +31 -31
  20. package/dist/src/index.js +31 -31
  21. package/dist/src/message-queue.js +1 -1
  22. package/dist/src/mock-muxer.js +1 -1
  23. package/dist/src/multiaddr/index.d.ts +5 -5
  24. package/dist/src/multiaddr/index.js +5 -5
  25. package/dist/src/peer-queue.d.ts +2 -2
  26. package/dist/src/peer-queue.js +1 -1
  27. package/dist/src/priority-queue.d.ts +2 -2
  28. package/dist/src/priority-queue.js +1 -1
  29. package/dist/src/queue/index.d.ts +5 -4
  30. package/dist/src/queue/index.d.ts.map +1 -1
  31. package/dist/src/queue/index.js +4 -3
  32. package/dist/src/queue/index.js.map +1 -1
  33. package/dist/src/queue/job.d.ts +5 -4
  34. package/dist/src/queue/job.d.ts.map +1 -1
  35. package/dist/src/queue/job.js +10 -5
  36. package/dist/src/queue/job.js.map +1 -1
  37. package/dist/src/queue/recipient.d.ts +5 -2
  38. package/dist/src/queue/recipient.d.ts.map +1 -1
  39. package/dist/src/queue/recipient.js +4 -2
  40. package/dist/src/queue/recipient.js.map +1 -1
  41. package/dist/src/rate-limiter.js +1 -1
  42. package/dist/src/stream-utils.js +1 -1
  43. package/package.json +9 -7
  44. package/src/abstract-stream.ts +2 -2
  45. package/src/adaptive-timeout.ts +1 -1
  46. package/src/errors.ts +1 -1
  47. package/src/filters/bloom-filter.ts +2 -2
  48. package/src/filters/bucket.ts +2 -2
  49. package/src/filters/cuckoo-filter.ts +6 -6
  50. package/src/filters/fingerprint.ts +1 -1
  51. package/src/filters/index.ts +6 -6
  52. package/src/filters/scalable-cuckoo-filter.ts +6 -6
  53. package/src/get-thin-waist-addresses.ts +1 -1
  54. package/src/index.ts +31 -31
  55. package/src/message-queue.ts +1 -1
  56. package/src/mock-muxer.ts +1 -1
  57. package/src/multiaddr/index.ts +5 -5
  58. package/src/peer-queue.ts +2 -2
  59. package/src/priority-queue.ts +2 -2
  60. package/src/queue/index.ts +10 -6
  61. package/src/queue/job.ts +13 -7
  62. package/src/queue/recipient.ts +7 -3
  63. package/src/rate-limiter.ts +1 -1
  64. package/src/stream-utils.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { RateLimitError } from './errors.js';
1
+ import { RateLimitError } from "./errors.js";
2
2
  export class RateLimiter {
3
3
  memoryStorage;
4
4
  points;
@@ -5,7 +5,7 @@ import { pEvent } from 'p-event';
5
5
  import { raceSignal } from 'race-signal';
6
6
  import * as varint from 'uint8-varint';
7
7
  import { Uint8ArrayList } from 'uint8arraylist';
8
- import { UnexpectedEOFError } from './errors.js';
8
+ import { UnexpectedEOFError } from "./errors.js";
9
9
  const DEFAULT_MAX_BUFFER_SIZE = 4_194_304;
10
10
  export class UnwrappedError extends Error {
11
11
  static name = 'UnwrappedError';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/utils",
3
- "version": "7.0.15",
3
+ "version": "7.0.17",
4
4
  "description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/utils#readme",
@@ -26,7 +26,8 @@
26
26
  "exports": {
27
27
  ".": {
28
28
  "types": "./dist/src/index.d.ts",
29
- "import": "./dist/src/index.js"
29
+ "import": "./dist/src/index.js",
30
+ "module-sync": "./dist/src/index.js"
30
31
  }
31
32
  },
32
33
  "scripts": {
@@ -46,13 +47,13 @@
46
47
  "dependencies": {
47
48
  "@chainsafe/is-ip": "^2.1.0",
48
49
  "@chainsafe/netmask": "^2.0.0",
49
- "@libp2p/crypto": "^5.1.15",
50
- "@libp2p/interface": "^3.2.0",
51
- "@libp2p/logger": "^6.2.4",
50
+ "@libp2p/crypto": "^5.1.17",
51
+ "@libp2p/interface": "^3.2.2",
52
+ "@libp2p/logger": "^6.2.6",
52
53
  "@multiformats/multiaddr": "^13.0.1",
53
54
  "@sindresorhus/fnv1a": "^3.1.0",
54
55
  "any-signal": "^4.1.1",
55
- "cborg": "^4.2.14",
56
+ "cborg": "^5.1.0",
56
57
  "delay": "^7.0.0",
57
58
  "is-loopback-addr": "^2.0.2",
58
59
  "it-length-prefixed": "^10.0.1",
@@ -63,13 +64,14 @@
63
64
  "netmask": "^2.0.2",
64
65
  "p-defer": "^4.0.1",
65
66
  "p-event": "^7.0.0",
67
+ "progress-events": "^1.1.0",
66
68
  "race-signal": "^2.0.0",
67
69
  "uint8-varint": "^2.0.4",
68
70
  "uint8arraylist": "^2.4.8",
69
71
  "uint8arrays": "^5.1.0"
70
72
  },
71
73
  "devDependencies": {
72
- "@libp2p/peer-id": "^6.0.6",
74
+ "@libp2p/peer-id": "^6.0.8",
73
75
  "@types/netmask": "^2.0.5",
74
76
  "aegir": "^47.0.22",
75
77
  "benchmark": "^2.1.4",
@@ -1,6 +1,6 @@
1
1
  import { pEvent } from 'p-event'
2
- import { AbstractMessageStream } from './abstract-message-stream.js'
3
- import type { MessageStreamInit } from './abstract-message-stream.js'
2
+ import { AbstractMessageStream } from './abstract-message-stream.ts'
3
+ import type { MessageStreamInit } from './abstract-message-stream.ts'
4
4
  import type { AbortOptions, Stream } from '@libp2p/interface'
5
5
 
6
6
  export interface AbstractStreamInit extends MessageStreamInit {
@@ -1,6 +1,6 @@
1
1
  import { anySignal } from 'any-signal'
2
2
  import { setMaxListeners } from 'main-event'
3
- import { MovingAverage } from './moving-average.js'
3
+ import { MovingAverage } from './moving-average.ts'
4
4
  import type { MetricGroup, Metrics } from '@libp2p/interface'
5
5
  import type { ClearableSignal } from 'any-signal'
6
6
 
package/src/errors.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RateLimiterResult } from './rate-limiter.js'
1
+ import type { RateLimiterResult } from './rate-limiter.ts'
2
2
 
3
3
  /**
4
4
  * A rate limit was hit
@@ -3,8 +3,8 @@ import { randomBytes } from '@libp2p/crypto'
3
3
  import { Uint8ArrayList } from 'uint8arraylist'
4
4
  import { alloc } from 'uint8arrays/alloc'
5
5
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
6
- import { fnv1a } from './hashes.js'
7
- import type { Filter } from './index.js'
6
+ import { fnv1a } from './hashes.ts'
7
+ import type { Filter } from './index.ts'
8
8
 
9
9
  const LN2_SQUARED = Math.LN2 * Math.LN2
10
10
 
@@ -1,5 +1,5 @@
1
- import { Fingerprint } from './fingerprint.js'
2
- import { getRandomInt } from './utils.js'
1
+ import { Fingerprint } from './fingerprint.ts'
2
+ import { getRandomInt } from './utils.ts'
3
3
 
4
4
  export class Bucket {
5
5
  private readonly contents: Array<Fingerprint | null>
@@ -1,10 +1,10 @@
1
1
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
2
- import { Bucket } from './bucket.js'
3
- import { Fingerprint, MAX_FINGERPRINT_SIZE } from './fingerprint.js'
4
- import { fnv1a } from './hashes.js'
5
- import { getRandomInt } from './utils.js'
6
- import type { Hash } from './hashes.js'
7
- import type { Filter } from './index.js'
2
+ import { Bucket } from './bucket.ts'
3
+ import { Fingerprint, MAX_FINGERPRINT_SIZE } from './fingerprint.ts'
4
+ import { fnv1a } from './hashes.ts'
5
+ import { getRandomInt } from './utils.ts'
6
+ import type { Hash } from './hashes.ts'
7
+ import type { Filter } from './index.ts'
8
8
 
9
9
  const maxCuckooCount = 500
10
10
 
@@ -1,6 +1,6 @@
1
1
  import { alloc as uint8ArrayAlloc } from 'uint8arrays/alloc'
2
2
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
3
- import type { Hash } from './hashes.js'
3
+ import type { Hash } from './hashes.ts'
4
4
 
5
5
  export const MAX_FINGERPRINT_SIZE = 64
6
6
 
@@ -1,9 +1,9 @@
1
- export { BloomFilter, createBloomFilter, type BloomFilterOptions } from './bloom-filter.js'
2
- export { CuckooFilter, createCuckooFilter, type CuckooFilterInit } from './cuckoo-filter.js'
3
- export { ScalableCuckooFilter, createScalableCuckooFilter, type ScalableCuckooFilterInit } from './scalable-cuckoo-filter.js'
4
- export type { Bucket } from './bucket.js'
5
- export type { Fingerprint } from './fingerprint.js'
6
- export type { Hash } from './hashes.js'
1
+ export { BloomFilter, createBloomFilter, type BloomFilterOptions } from './bloom-filter.ts'
2
+ export { CuckooFilter, createCuckooFilter, type CuckooFilterInit } from './cuckoo-filter.ts'
3
+ export { ScalableCuckooFilter, createScalableCuckooFilter, type ScalableCuckooFilterInit } from './scalable-cuckoo-filter.ts'
4
+ export type { Bucket } from './bucket.ts'
5
+ export type { Fingerprint } from './fingerprint.ts'
6
+ export type { Hash } from './hashes.ts'
7
7
 
8
8
  export interface Filter {
9
9
  add(item: Uint8Array | string): void
@@ -1,10 +1,10 @@
1
1
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
2
- import { CuckooFilter, optimize } from './cuckoo-filter.js'
3
- import { fnv1a } from './hashes.js'
4
- import { getRandomInt } from './utils.js'
5
- import type { CuckooFilterInit } from './cuckoo-filter.js'
6
- import type { Hash } from './hashes.js'
7
- import type { Filter } from './index.js'
2
+ import { CuckooFilter, optimize } from './cuckoo-filter.ts'
3
+ import { fnv1a } from './hashes.ts'
4
+ import { getRandomInt } from './utils.ts'
5
+ import type { CuckooFilterInit } from './cuckoo-filter.ts'
6
+ import type { Hash } from './hashes.ts'
7
+ import type { Filter } from './index.ts'
8
8
 
9
9
  export interface ScalableCuckooFilterInit extends CuckooFilterInit {
10
10
  /**
@@ -1,5 +1,5 @@
1
1
  import os from 'node:os'
2
- import { isLinkLocalIp } from './link-local-ip.js'
2
+ import { isLinkLocalIp } from './link-local-ip.ts'
3
3
  import { getNetConfig } from './multiaddr/get-net-config.ts'
4
4
  import { netConfigToMultiaddr } from './multiaddr/utils.ts'
5
5
  import type { Multiaddr } from '@multiformats/multiaddr'
package/src/index.ts CHANGED
@@ -4,34 +4,34 @@
4
4
  * This module contains utility functions used by libp2p modules.
5
5
  */
6
6
 
7
- export * from './filters/index.js'
8
- export * from './multiaddr/index.js'
9
- export * from './queue/index.js'
10
- export * from './abstract-message-stream.js'
11
- export * from './abstract-multiaddr-connection.js'
12
- export * from './abstract-stream-muxer.js'
13
- export * from './abstract-stream.js'
14
- export * from './adaptive-timeout.js'
15
- export * from './debounce.js'
16
- export * from './errors.js'
17
- export * from './get-thin-waist-addresses.js'
18
- export * from './global-unicast-ip.js'
19
- export * from './ip-port-to-multiaddr.js'
20
- export * from './is-async-generator.js'
21
- export * from './is-generator.js'
22
- export * from './is-promise.js'
23
- export * from './length-prefixed-decoder.js'
24
- export * from './link-local-ip.js'
25
- export * from './mock-muxer.js'
26
- export * from './mock-stream.js'
27
- export * from './moving-average.js'
28
- export * from './multiaddr-connection-pair.js'
29
- export * from './peer-queue.js'
30
- export * from './priority-queue.js'
31
- export * from './private-ip.js'
32
- export * from './rate-limiter.js'
33
- export * from './repeating-task.js'
34
- export * from './stream-pair.js'
35
- export * from './stream-utils.js'
36
- export * from './tracked-list.js'
37
- export * from './tracked-map.js'
7
+ export * from './filters/index.ts'
8
+ export * from './multiaddr/index.ts'
9
+ export * from './queue/index.ts'
10
+ export * from './abstract-message-stream.ts'
11
+ export * from './abstract-multiaddr-connection.ts'
12
+ export * from './abstract-stream-muxer.ts'
13
+ export * from './abstract-stream.ts'
14
+ export * from './adaptive-timeout.ts'
15
+ export * from './debounce.ts'
16
+ export * from './errors.ts'
17
+ export * from './get-thin-waist-addresses.ts'
18
+ export * from './global-unicast-ip.ts'
19
+ export * from './ip-port-to-multiaddr.ts'
20
+ export * from './is-async-generator.ts'
21
+ export * from './is-generator.ts'
22
+ export * from './is-promise.ts'
23
+ export * from './length-prefixed-decoder.ts'
24
+ export * from './link-local-ip.ts'
25
+ export * from './mock-muxer.ts'
26
+ export * from './mock-stream.ts'
27
+ export * from './moving-average.ts'
28
+ export * from './multiaddr-connection-pair.ts'
29
+ export * from './peer-queue.ts'
30
+ export * from './priority-queue.ts'
31
+ export * from './private-ip.ts'
32
+ export * from './rate-limiter.ts'
33
+ export * from './repeating-task.ts'
34
+ export * from './stream-pair.ts'
35
+ export * from './stream-utils.ts'
36
+ export * from './tracked-list.ts'
37
+ export * from './tracked-map.ts'
@@ -3,7 +3,7 @@ import delay from 'delay'
3
3
  import { TypedEventEmitter } from 'main-event'
4
4
  import { raceSignal } from 'race-signal'
5
5
  import { isUint8ArrayList, Uint8ArrayList } from 'uint8arraylist'
6
- import { Queue } from './queue/index.js'
6
+ import { Queue } from './queue/index.ts'
7
7
  import type { AbortOptions, Logger } from '@libp2p/interface'
8
8
 
9
9
  const DEFAULT_CHUNK_SIZE = 1024 * 64
package/src/mock-muxer.ts CHANGED
@@ -4,7 +4,7 @@ import { pushable } from 'it-pushable'
4
4
  import { Uint8ArrayList } from 'uint8arraylist'
5
5
  import { AbstractStreamMuxer } from './abstract-stream-muxer.ts'
6
6
  import { AbstractStream } from './abstract-stream.ts'
7
- import { Queue } from './queue/index.js'
7
+ import { Queue } from './queue/index.ts'
8
8
  import type { SendResult } from './abstract-message-stream.ts'
9
9
  import type { AbstractStreamInit } from './abstract-stream.ts'
10
10
  import type { AbortOptions, MessageStreamDirection, CreateStreamOptions, StreamMuxerFactory, StreamMuxer, MultiaddrConnection, StreamMuxerOptions } from '@libp2p/interface'
@@ -1,6 +1,6 @@
1
1
  export * from './get-net-config.ts'
2
- export * from './is-global-unicast.js'
3
- export * from './is-link-local.js'
4
- export * from './is-loopback.js'
5
- export * from './is-network-address.js'
6
- export * from './is-private.js'
2
+ export * from './is-global-unicast.ts'
3
+ export * from './is-link-local.ts'
4
+ export * from './is-loopback.ts'
5
+ export * from './is-network-address.ts'
6
+ export * from './is-private.ts'
package/src/peer-queue.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Queue } from './queue/index.js'
2
- import type { Job } from './queue/job.js'
1
+ import { Queue } from './queue/index.ts'
2
+ import type { Job } from './queue/job.ts'
3
3
  import type { AbortOptions, PeerId } from '@libp2p/interface'
4
4
 
5
5
  export interface PeerQueueJobOptions extends AbortOptions {
@@ -1,5 +1,5 @@
1
- import { Queue } from './queue/index.js'
2
- import type { QueueInit } from './queue/index.js'
1
+ import { Queue } from './queue/index.ts'
2
+ import type { QueueInit } from './queue/index.ts'
3
3
  import type { AbortOptions } from '@libp2p/interface'
4
4
 
5
5
  export interface PriorityQueueJobOptions extends AbortOptions {
@@ -4,11 +4,12 @@ import { TypedEventEmitter } from 'main-event'
4
4
  import { pEvent } from 'p-event'
5
5
  import { debounce } from '../debounce.js'
6
6
  import { QueueFullError } from '../errors.js'
7
- import { Job } from './job.js'
7
+ import { Job } from './job.ts'
8
8
  import type { AbortOptions, Metrics } from '@libp2p/interface'
9
+ import type { ProgressOptions } from 'progress-events'
9
10
 
10
- export type { Job, JobTimeline } from './job.js'
11
- export type { JobRecipient } from './recipient.js'
11
+ export type { Job, JobTimeline } from './job.ts'
12
+ export type { JobRecipient } from './recipient.ts'
12
13
 
13
14
  export interface Comparator<T> {
14
15
  (a: T, b: T): -1 | 0 | 1
@@ -118,7 +119,7 @@ export interface QueueEvents<JobReturnType, JobOptions extends AbortOptions = Ab
118
119
  * 1. Items remain at the head of the queue while they are running so `queue.size` includes `queue.pending` items - this is so interested parties can join the results of a queue item while it is running
119
120
  * 2. The options for a job are stored separately to the job in order for them to be modified while they are still in the queue
120
121
  */
121
- export class Queue<JobReturnType = unknown, JobOptions extends AbortOptions = AbortOptions> extends TypedEventEmitter<QueueEvents<JobReturnType, JobOptions>> {
122
+ export class Queue<JobReturnType = unknown, JobOptions extends AbortOptions & ProgressOptions = AbortOptions> extends TypedEventEmitter<QueueEvents<JobReturnType, JobOptions>> {
122
123
  public concurrency: number
123
124
  public maxSize: number
124
125
  public queue: Array<Job<JobOptions, JobReturnType>>
@@ -257,9 +258,8 @@ export class Queue<JobReturnType = unknown, JobOptions extends AbortOptions = Ab
257
258
  const job = new Job<JobOptions, JobReturnType>(fn, options)
258
259
  this.enqueue(job)
259
260
  this.safeDispatchEvent('add')
260
- this.tryToStartAnother()
261
261
 
262
- return job.join(options)
262
+ const result = job.join(options)
263
263
  .then(result => {
264
264
  this.safeDispatchEvent('completed', { detail: result })
265
265
  this.safeDispatchEvent('success', { detail: { job, result } })
@@ -281,6 +281,10 @@ export class Queue<JobReturnType = unknown, JobOptions extends AbortOptions = Ab
281
281
 
282
282
  throw err
283
283
  })
284
+
285
+ this.tryToStartAnother()
286
+
287
+ return result
284
288
  }
285
289
 
286
290
  /**
package/src/queue/job.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { AbortError } from '@libp2p/interface'
2
2
  import { setMaxListeners } from 'main-event'
3
3
  import { raceSignal } from 'race-signal'
4
- import { JobRecipient } from './recipient.js'
5
- import type { JobStatus } from './index.js'
4
+ import { JobRecipient } from './recipient.ts'
5
+ import type { JobStatus } from './index.ts'
6
6
  import type { AbortOptions } from '@libp2p/interface'
7
+ import type { ProgressOptions } from 'progress-events'
7
8
 
8
9
  /**
9
10
  * Returns a random string
@@ -18,7 +19,7 @@ export interface JobTimeline {
18
19
  finished?: number
19
20
  }
20
21
 
21
- export class Job <JobOptions extends AbortOptions = AbortOptions, JobReturnType = unknown> {
22
+ export class Job <JobOptions extends AbortOptions & ProgressOptions = AbortOptions, JobReturnType = unknown> {
22
23
  public id: string
23
24
  public fn: (options: JobOptions) => Promise<JobReturnType>
24
25
  public options: JobOptions
@@ -59,11 +60,11 @@ export class Job <JobOptions extends AbortOptions = AbortOptions, JobReturnType
59
60
  }
60
61
  }
61
62
 
62
- async join (options: AbortOptions = {}): Promise<JobReturnType> {
63
- const recipient = new JobRecipient<JobReturnType>(options.signal)
63
+ async join (options?: Partial<Pick<JobOptions, 'signal' | 'onProgress'>>): Promise<JobReturnType> {
64
+ const recipient = new JobRecipient<JobReturnType>(options)
64
65
  this.recipients.push(recipient)
65
66
 
66
- options.signal?.addEventListener('abort', this.onAbort)
67
+ options?.signal?.addEventListener('abort', this.onAbort)
67
68
 
68
69
  return recipient.deferred.promise
69
70
  }
@@ -77,7 +78,12 @@ export class Job <JobOptions extends AbortOptions = AbortOptions, JobReturnType
77
78
 
78
79
  const result = await raceSignal(this.fn({
79
80
  ...(this.options ?? {}),
80
- signal: this.controller.signal
81
+ signal: this.controller.signal,
82
+ onProgress: (evt: any): void => {
83
+ this.recipients.forEach(recipient => {
84
+ recipient.onProgress?.(evt)
85
+ })
86
+ }
81
87
  }), this.controller.signal)
82
88
 
83
89
  this.recipients.forEach(recipient => {
@@ -1,13 +1,17 @@
1
1
  import { AbortError } from '@libp2p/interface'
2
2
  import pDefer from 'p-defer'
3
+ import type { AbortOptions } from '@libp2p/interface'
3
4
  import type { DeferredPromise } from 'p-defer'
5
+ import type { ProgressOptions, ProgressEventListener } from 'progress-events'
4
6
 
5
- export class JobRecipient<JobReturnType> {
7
+ export class JobRecipient<JobReturnType, JobOptions extends AbortOptions & ProgressOptions = any> {
6
8
  public deferred: DeferredPromise<JobReturnType>
7
9
  public signal?: AbortSignal
10
+ public onProgress?: ProgressEventListener
8
11
 
9
- constructor (signal?: AbortSignal) {
10
- this.signal = signal
12
+ constructor (options?: Partial<Pick<JobOptions, 'signal' | 'onProgress'>>) {
13
+ this.signal = options?.signal
14
+ this.onProgress = options?.onProgress
11
15
  this.deferred = pDefer()
12
16
 
13
17
  this.onAbort = this.onAbort.bind(this)
@@ -1,4 +1,4 @@
1
- import { RateLimitError } from './errors.js'
1
+ import { RateLimitError } from './errors.ts'
2
2
 
3
3
  export interface RateLimiterInit {
4
4
  /**
@@ -5,7 +5,7 @@ import { pEvent } from 'p-event'
5
5
  import { raceSignal } from 'race-signal'
6
6
  import * as varint from 'uint8-varint'
7
7
  import { Uint8ArrayList } from 'uint8arraylist'
8
- import { UnexpectedEOFError } from './errors.js'
8
+ import { UnexpectedEOFError } from './errors.ts'
9
9
  import type { MessageStream, MultiaddrConnection, Stream, AbortOptions } from '@libp2p/interface'
10
10
  import type { Duplex, Source, Transform, Sink } from 'it-stream-types'
11
11