omegon 0.8.4 → 0.9.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 (138) hide show
  1. package/extensions/cleave/dispatcher.ts +213 -20
  2. package/extensions/cleave/rpc-child.ts +269 -0
  3. package/extensions/cleave/types.ts +52 -0
  4. package/node_modules/@types/node/README.md +3 -3
  5. package/node_modules/@types/node/assert/strict.d.ts +11 -5
  6. package/node_modules/@types/node/assert.d.ts +173 -50
  7. package/node_modules/@types/node/async_hooks.d.ts +8 -28
  8. package/node_modules/@types/node/buffer.buffer.d.ts +7 -1
  9. package/node_modules/@types/node/buffer.d.ts +168 -44
  10. package/node_modules/@types/node/child_process.d.ts +70 -27
  11. package/node_modules/@types/node/cluster.d.ts +332 -240
  12. package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  13. package/node_modules/@types/node/compatibility/index.d.ts +9 -0
  14. package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  15. package/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
  16. package/node_modules/@types/node/console.d.ts +350 -49
  17. package/node_modules/@types/node/constants.d.ts +4 -3
  18. package/node_modules/@types/node/crypto.d.ts +1110 -630
  19. package/node_modules/@types/node/dgram.d.ts +51 -15
  20. package/node_modules/@types/node/diagnostics_channel.d.ts +6 -4
  21. package/node_modules/@types/node/dns/promises.d.ts +4 -4
  22. package/node_modules/@types/node/dns.d.ts +133 -132
  23. package/node_modules/@types/node/domain.d.ts +17 -13
  24. package/node_modules/@types/node/events.d.ts +663 -734
  25. package/node_modules/@types/node/fs/promises.d.ts +9 -43
  26. package/node_modules/@types/node/fs.d.ts +411 -628
  27. package/node_modules/@types/node/globals.d.ts +30 -8
  28. package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
  29. package/node_modules/@types/node/http.d.ts +265 -364
  30. package/node_modules/@types/node/http2.d.ts +715 -551
  31. package/node_modules/@types/node/https.d.ts +239 -65
  32. package/node_modules/@types/node/index.d.ts +6 -24
  33. package/node_modules/@types/node/inspector.d.ts +53 -69
  34. package/node_modules/@types/node/inspector.generated.d.ts +410 -759
  35. package/node_modules/@types/node/module.d.ts +186 -52
  36. package/node_modules/@types/node/net.d.ts +194 -70
  37. package/node_modules/@types/node/os.d.ts +11 -12
  38. package/node_modules/@types/node/package.json +3 -13
  39. package/node_modules/@types/node/path.d.ts +133 -120
  40. package/node_modules/@types/node/perf_hooks.d.ts +643 -318
  41. package/node_modules/@types/node/process.d.ts +132 -223
  42. package/node_modules/@types/node/punycode.d.ts +5 -5
  43. package/node_modules/@types/node/querystring.d.ts +4 -4
  44. package/node_modules/@types/node/readline/promises.d.ts +3 -3
  45. package/node_modules/@types/node/readline.d.ts +120 -68
  46. package/node_modules/@types/node/repl.d.ts +100 -87
  47. package/node_modules/@types/node/sea.d.ts +1 -10
  48. package/node_modules/@types/node/sqlite.d.ts +19 -363
  49. package/node_modules/@types/node/stream/consumers.d.ts +10 -10
  50. package/node_modules/@types/node/stream/promises.d.ts +15 -136
  51. package/node_modules/@types/node/stream/web.d.ts +502 -176
  52. package/node_modules/@types/node/stream.d.ts +475 -581
  53. package/node_modules/@types/node/string_decoder.d.ts +4 -4
  54. package/node_modules/@types/node/test.d.ts +196 -308
  55. package/node_modules/@types/node/timers/promises.d.ts +4 -4
  56. package/node_modules/@types/node/timers.d.ts +132 -4
  57. package/node_modules/@types/node/tls.d.ts +226 -110
  58. package/node_modules/@types/node/trace_events.d.ts +9 -9
  59. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -1
  60. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
  61. package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
  62. package/node_modules/@types/node/tty.d.ts +16 -58
  63. package/node_modules/@types/node/url.d.ts +573 -130
  64. package/node_modules/@types/node/util.d.ts +1100 -181
  65. package/node_modules/@types/node/v8.d.ts +8 -76
  66. package/node_modules/@types/node/vm.d.ts +72 -280
  67. package/node_modules/@types/node/wasi.d.ts +4 -25
  68. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
  69. package/node_modules/@types/node/web-globals/events.d.ts +0 -9
  70. package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
  71. package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
  72. package/node_modules/@types/node/worker_threads.d.ts +335 -268
  73. package/node_modules/@types/node/zlib.d.ts +74 -9
  74. package/node_modules/undici-types/agent.d.ts +12 -13
  75. package/node_modules/undici-types/api.d.ts +26 -26
  76. package/node_modules/undici-types/balanced-pool.d.ts +12 -13
  77. package/node_modules/undici-types/client.d.ts +19 -19
  78. package/node_modules/undici-types/connector.d.ts +2 -2
  79. package/node_modules/undici-types/cookies.d.ts +0 -2
  80. package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
  81. package/node_modules/undici-types/dispatcher.d.ts +103 -123
  82. package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
  83. package/node_modules/undici-types/errors.d.ts +54 -66
  84. package/node_modules/undici-types/eventsource.d.ts +4 -9
  85. package/node_modules/undici-types/fetch.d.ts +20 -22
  86. package/node_modules/undici-types/file.d.ts +39 -0
  87. package/node_modules/undici-types/filereader.d.ts +54 -0
  88. package/node_modules/undici-types/formdata.d.ts +7 -7
  89. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  90. package/node_modules/undici-types/global-origin.d.ts +5 -5
  91. package/node_modules/undici-types/handlers.d.ts +8 -8
  92. package/node_modules/undici-types/header.d.ts +1 -157
  93. package/node_modules/undici-types/index.d.ts +47 -64
  94. package/node_modules/undici-types/interceptors.d.ts +8 -64
  95. package/node_modules/undici-types/mock-agent.d.ts +18 -36
  96. package/node_modules/undici-types/mock-client.d.ts +4 -6
  97. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  98. package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
  99. package/node_modules/undici-types/mock-pool.d.ts +4 -6
  100. package/node_modules/undici-types/package.json +1 -1
  101. package/node_modules/undici-types/patch.d.ts +4 -0
  102. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  103. package/node_modules/undici-types/pool.d.ts +13 -15
  104. package/node_modules/undici-types/proxy-agent.d.ts +4 -5
  105. package/node_modules/undici-types/readable.d.ts +16 -19
  106. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  107. package/node_modules/undici-types/retry-handler.d.ts +10 -19
  108. package/node_modules/undici-types/util.d.ts +3 -3
  109. package/node_modules/undici-types/webidl.d.ts +29 -142
  110. package/node_modules/undici-types/websocket.d.ts +10 -46
  111. package/package.json +2 -1
  112. package/skills/cleave/SKILL.md +62 -2
  113. package/node_modules/@types/node/inspector/promises.d.ts +0 -41
  114. package/node_modules/@types/node/path/posix.d.ts +0 -8
  115. package/node_modules/@types/node/path/win32.d.ts +0 -8
  116. package/node_modules/@types/node/quic.d.ts +0 -910
  117. package/node_modules/@types/node/test/reporters.d.ts +0 -96
  118. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
  119. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
  120. package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
  121. package/node_modules/@types/node/util/types.d.ts +0 -558
  122. package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
  123. package/node_modules/@types/node/web-globals/console.d.ts +0 -9
  124. package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
  125. package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
  126. package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
  127. package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
  128. package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
  129. package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
  130. package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
  131. package/node_modules/@types/node/web-globals/url.d.ts +0 -24
  132. package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
  133. package/node_modules/undici-types/client-stats.d.ts +0 -15
  134. package/node_modules/undici-types/h2c-client.d.ts +0 -73
  135. package/node_modules/undici-types/mock-call-history.d.ts +0 -111
  136. package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
  137. package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
  138. package/node_modules/undici-types/utility.d.ts +0 -7
@@ -1,104 +1,103 @@
1
- import { URL } from 'node:url'
2
- import { Duplex, Readable, Writable } from 'node:stream'
3
- import { EventEmitter } from 'node:events'
4
- import { Blob } from 'node:buffer'
1
+ import { URL } from 'url'
2
+ import { Duplex, Readable, Writable } from 'stream'
3
+ import { EventEmitter } from 'events'
4
+ import { Blob } from 'buffer'
5
5
  import { IncomingHttpHeaders } from './header'
6
6
  import BodyReadable from './readable'
7
7
  import { FormData } from './formdata'
8
8
  import Errors from './errors'
9
- import { Autocomplete } from './utility'
10
9
 
11
- type AbortSignal = unknown
10
+ type AbortSignal = unknown;
12
11
 
13
12
  export default Dispatcher
14
13
 
15
- export type UndiciHeaders = Record<string, string | string[]> | IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null
16
-
17
14
  /** Dispatcher is the core API used to dispatch requests. */
18
15
  declare class Dispatcher extends EventEmitter {
19
16
  /** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
20
- dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
17
+ dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
21
18
  /** Starts two-way communications with the requested resource. */
22
- connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void
23
- connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>
19
+ connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData>;
20
+ connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
24
21
  /** Compose a chain of dispatchers */
25
- compose (dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
26
- compose (...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
22
+ compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
23
+ compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
27
24
  /** Performs an HTTP request. */
28
- request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void
29
- request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>
25
+ request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData>;
26
+ request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void;
30
27
  /** For easy use with `stream.pipeline`. */
31
- pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex
28
+ pipeline(options: Dispatcher.PipelineOptions, handler: Dispatcher.PipelineHandler): Duplex;
32
29
  /** A faster version of `Dispatcher.request`. */
33
- stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void
34
- stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>
30
+ stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory): Promise<Dispatcher.StreamData>;
31
+ stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory, callback: (err: Error | null, data: Dispatcher.StreamData) => void): void;
35
32
  /** Upgrade to a different protocol. */
36
- upgrade (options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void
37
- upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>
33
+ upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
34
+ upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
38
35
  /** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
39
- close (callback: () => void): void
40
- close (): Promise<void>
36
+ close(): Promise<void>;
37
+ close(callback: () => void): void;
41
38
  /** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
42
- destroy (err: Error | null, callback: () => void): void
43
- destroy (callback: () => void): void
44
- destroy (err: Error | null): Promise<void>
45
- destroy (): Promise<void>
39
+ destroy(): Promise<void>;
40
+ destroy(err: Error | null): Promise<void>;
41
+ destroy(callback: () => void): void;
42
+ destroy(err: Error | null, callback: () => void): void;
43
+
44
+ on(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
45
+ on(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
46
+ on(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
47
+ on(eventName: 'drain', callback: (origin: URL) => void): this;
48
+
49
+
50
+ once(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
51
+ once(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
52
+ once(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
53
+ once(eventName: 'drain', callback: (origin: URL) => void): this;
46
54
 
47
- on (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
48
- on (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
49
- on (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
50
- on (eventName: 'drain', callback: (origin: URL) => void): this
51
55
 
52
- once (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
53
- once (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
54
- once (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
55
- once (eventName: 'drain', callback: (origin: URL) => void): this
56
+ off(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
57
+ off(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
58
+ off(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
59
+ off(eventName: 'drain', callback: (origin: URL) => void): this;
56
60
 
57
- off (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
58
- off (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
59
- off (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
60
- off (eventName: 'drain', callback: (origin: URL) => void): this
61
61
 
62
- addListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
63
- addListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
64
- addListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
65
- addListener (eventName: 'drain', callback: (origin: URL) => void): this
62
+ addListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
63
+ addListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
64
+ addListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
65
+ addListener(eventName: 'drain', callback: (origin: URL) => void): this;
66
66
 
67
- removeListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
68
- removeListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
69
- removeListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
70
- removeListener (eventName: 'drain', callback: (origin: URL) => void): this
67
+ removeListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
68
+ removeListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
69
+ removeListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
70
+ removeListener(eventName: 'drain', callback: (origin: URL) => void): this;
71
71
 
72
- prependListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
73
- prependListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
74
- prependListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
75
- prependListener (eventName: 'drain', callback: (origin: URL) => void): this
72
+ prependListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
73
+ prependListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
74
+ prependListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
75
+ prependListener(eventName: 'drain', callback: (origin: URL) => void): this;
76
76
 
77
- prependOnceListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
78
- prependOnceListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
79
- prependOnceListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
80
- prependOnceListener (eventName: 'drain', callback: (origin: URL) => void): this
77
+ prependOnceListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
78
+ prependOnceListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
79
+ prependOnceListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
80
+ prependOnceListener(eventName: 'drain', callback: (origin: URL) => void): this;
81
81
 
82
- listeners (eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
83
- listeners (eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
84
- listeners (eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
85
- listeners (eventName: 'drain'): ((origin: URL) => void)[]
82
+ listeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
83
+ listeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
84
+ listeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
85
+ listeners(eventName: 'drain'): ((origin: URL) => void)[];
86
86
 
87
- rawListeners (eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
88
- rawListeners (eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
89
- rawListeners (eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
90
- rawListeners (eventName: 'drain'): ((origin: URL) => void)[]
87
+ rawListeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
88
+ rawListeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
89
+ rawListeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
90
+ rawListeners(eventName: 'drain'): ((origin: URL) => void)[];
91
91
 
92
- emit (eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean
93
- emit (eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean
94
- emit (eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean
95
- emit (eventName: 'drain', origin: URL): boolean
92
+ emit(eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean;
93
+ emit(eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
94
+ emit(eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
95
+ emit(eventName: 'drain', origin: URL): boolean;
96
96
  }
97
97
 
98
98
  declare namespace Dispatcher {
99
99
  export interface ComposedDispatcher extends Dispatcher {}
100
- export type Dispatch = Dispatcher['dispatch']
101
- export type DispatcherComposeInterceptor = (dispatch: Dispatch) => Dispatch
100
+ export type DispatcherComposeInterceptor = (dispatch: Dispatcher['dispatch']) => Dispatcher['dispatch'];
102
101
  export interface DispatchOptions {
103
102
  origin?: string | URL;
104
103
  path: string;
@@ -106,12 +105,12 @@ declare namespace Dispatcher {
106
105
  /** Default: `null` */
107
106
  body?: string | Buffer | Uint8Array | Readable | null | FormData;
108
107
  /** Default: `null` */
109
- headers?: UndiciHeaders;
108
+ headers?: IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null;
110
109
  /** Query string params to be embedded in the request URL. Default: `null` */
111
110
  query?: Record<string, any>;
112
111
  /** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
113
112
  idempotent?: boolean;
114
- /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. Defaults to `method !== 'HEAD'`. */
113
+ /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. */
115
114
  blocking?: boolean;
116
115
  /** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
117
116
  upgrade?: boolean | string | null;
@@ -123,38 +122,42 @@ declare namespace Dispatcher {
123
122
  reset?: boolean;
124
123
  /** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
125
124
  throwOnError?: boolean;
126
- /** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server */
125
+ /** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server*/
127
126
  expectContinue?: boolean;
128
127
  }
129
- export interface ConnectOptions<TOpaque = null> {
128
+ export interface ConnectOptions {
130
129
  origin: string | URL;
131
130
  path: string;
132
131
  /** Default: `null` */
133
- headers?: UndiciHeaders;
132
+ headers?: IncomingHttpHeaders | string[] | null;
134
133
  /** Default: `null` */
135
134
  signal?: AbortSignal | EventEmitter | null;
136
135
  /** This argument parameter is passed through to `ConnectData` */
137
- opaque?: TOpaque;
136
+ opaque?: unknown;
137
+ /** Default: 0 */
138
+ maxRedirections?: number;
138
139
  /** Default: false */
139
140
  redirectionLimitReached?: boolean;
140
141
  /** Default: `null` */
141
- responseHeaders?: 'raw' | null;
142
+ responseHeader?: 'raw' | null;
142
143
  }
143
- export interface RequestOptions<TOpaque = null> extends DispatchOptions {
144
+ export interface RequestOptions extends DispatchOptions {
144
145
  /** Default: `null` */
145
- opaque?: TOpaque;
146
+ opaque?: unknown;
146
147
  /** Default: `null` */
147
148
  signal?: AbortSignal | EventEmitter | null;
149
+ /** Default: 0 */
150
+ maxRedirections?: number;
148
151
  /** Default: false */
149
152
  redirectionLimitReached?: boolean;
150
153
  /** Default: `null` */
151
154
  onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
152
155
  /** Default: `null` */
153
- responseHeaders?: 'raw' | null;
156
+ responseHeader?: 'raw' | null;
154
157
  /** Default: `64 KiB` */
155
158
  highWaterMark?: number;
156
159
  }
157
- export interface PipelineOptions<TOpaque = null> extends RequestOptions<TOpaque> {
160
+ export interface PipelineOptions extends RequestOptions {
158
161
  /** `true` if the `handler` will return an object stream. Default: `false` */
159
162
  objectMode?: boolean;
160
163
  }
@@ -163,98 +166,75 @@ declare namespace Dispatcher {
163
166
  /** Default: `'GET'` */
164
167
  method?: string;
165
168
  /** Default: `null` */
166
- headers?: UndiciHeaders;
169
+ headers?: IncomingHttpHeaders | string[] | null;
167
170
  /** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
168
171
  protocol?: string;
169
172
  /** Default: `null` */
170
173
  signal?: AbortSignal | EventEmitter | null;
174
+ /** Default: 0 */
175
+ maxRedirections?: number;
171
176
  /** Default: false */
172
177
  redirectionLimitReached?: boolean;
173
178
  /** Default: `null` */
174
- responseHeaders?: 'raw' | null;
179
+ responseHeader?: 'raw' | null;
175
180
  }
176
- export interface ConnectData<TOpaque = null> {
181
+ export interface ConnectData {
177
182
  statusCode: number;
178
183
  headers: IncomingHttpHeaders;
179
184
  socket: Duplex;
180
- opaque: TOpaque;
185
+ opaque: unknown;
181
186
  }
182
- export interface ResponseData<TOpaque = null> {
187
+ export interface ResponseData {
183
188
  statusCode: number;
184
189
  headers: IncomingHttpHeaders;
185
190
  body: BodyReadable & BodyMixin;
186
191
  trailers: Record<string, string>;
187
- opaque: TOpaque;
192
+ opaque: unknown;
188
193
  context: object;
189
194
  }
190
- export interface PipelineHandlerData<TOpaque = null> {
195
+ export interface PipelineHandlerData {
191
196
  statusCode: number;
192
197
  headers: IncomingHttpHeaders;
193
- opaque: TOpaque;
198
+ opaque: unknown;
194
199
  body: BodyReadable;
195
200
  context: object;
196
201
  }
197
- export interface StreamData<TOpaque = null> {
198
- opaque: TOpaque;
202
+ export interface StreamData {
203
+ opaque: unknown;
199
204
  trailers: Record<string, string>;
200
205
  }
201
- export interface UpgradeData<TOpaque = null> {
206
+ export interface UpgradeData {
202
207
  headers: IncomingHttpHeaders;
203
208
  socket: Duplex;
204
- opaque: TOpaque;
209
+ opaque: unknown;
205
210
  }
206
- export interface StreamFactoryData<TOpaque = null> {
211
+ export interface StreamFactoryData {
207
212
  statusCode: number;
208
213
  headers: IncomingHttpHeaders;
209
- opaque: TOpaque;
214
+ opaque: unknown;
210
215
  context: object;
211
216
  }
212
- export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable
213
-
214
- export interface DispatchController {
215
- get aborted () : boolean
216
- get paused () : boolean
217
- get reason () : Error | null
218
- abort (reason: Error): void
219
- pause(): void
220
- resume(): void
221
- }
222
-
223
- export interface DispatchHandler {
224
- onRequestStart?(controller: DispatchController, context: any): void;
225
- onRequestUpgrade?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, socket: Duplex): void;
226
- onResponseStart?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, statusMessage?: string): void;
227
- onResponseData?(controller: DispatchController, chunk: Buffer): void;
228
- onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
229
- onResponseError?(controller: DispatchController, error: Error): void;
230
-
217
+ export type StreamFactory = (data: StreamFactoryData) => Writable;
218
+ export interface DispatchHandlers {
231
219
  /** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
232
- /** @deprecated */
233
220
  onConnect?(abort: (err?: Error) => void): void;
234
221
  /** Invoked when an error has occurred. */
235
- /** @deprecated */
236
222
  onError?(err: Error): void;
237
223
  /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
238
- /** @deprecated */
239
224
  onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
240
225
  /** Invoked when response is received, before headers have been read. **/
241
- /** @deprecated */
242
226
  onResponseStarted?(): void;
243
227
  /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
244
- /** @deprecated */
245
228
  onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
246
229
  /** Invoked when response payload data is received. */
247
- /** @deprecated */
248
230
  onData?(chunk: Buffer): boolean;
249
231
  /** Invoked when response payload and trailers have been received and the request has completed. */
250
- /** @deprecated */
251
232
  onComplete?(trailers: string[] | null): void;
252
233
  /** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
253
- /** @deprecated */
254
234
  onBodySent?(chunkSize: number, totalBytesSent: number): void;
255
235
  }
256
- export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable
257
- export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>
236
+ export type PipelineHandler = (data: PipelineHandlerData) => Readable;
237
+ export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
258
238
 
259
239
  /**
260
240
  * @link https://fetch.spec.whatwg.org/#body-mixin
@@ -271,6 +251,6 @@ declare namespace Dispatcher {
271
251
  }
272
252
 
273
253
  export interface DispatchInterceptor {
274
- (dispatch: Dispatch): Dispatch
254
+ (dispatch: Dispatcher['dispatch']): Dispatcher['dispatch']
275
255
  }
276
256
  }
@@ -1,17 +1,16 @@
1
1
  import Agent from './agent'
2
- import ProxyAgent from './proxy-agent'
3
2
  import Dispatcher from './dispatcher'
4
3
 
5
4
  export default EnvHttpProxyAgent
6
5
 
7
6
  declare class EnvHttpProxyAgent extends Dispatcher {
8
- constructor (opts?: EnvHttpProxyAgent.Options)
7
+ constructor(opts?: EnvHttpProxyAgent.Options)
9
8
 
10
- dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
9
+ dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
11
10
  }
12
11
 
13
12
  declare namespace EnvHttpProxyAgent {
14
- export interface Options extends Omit<ProxyAgent.Options, 'uri'> {
13
+ export interface Options extends Agent.Options {
15
14
  /** Overrides the value of the HTTP_PROXY environment variable */
16
15
  httpProxy?: string;
17
16
  /** Overrides the value of the HTTPS_PROXY environment variable */
@@ -1,24 +1,24 @@
1
- import { IncomingHttpHeaders } from './header'
1
+ import { IncomingHttpHeaders } from "./header";
2
2
  import Client from './client'
3
3
 
4
4
  export default Errors
5
5
 
6
6
  declare namespace Errors {
7
7
  export class UndiciError extends Error {
8
- name: string
9
- code: string
8
+ name: string;
9
+ code: string;
10
10
  }
11
11
 
12
12
  /** Connect timeout error. */
13
13
  export class ConnectTimeoutError extends UndiciError {
14
- name: 'ConnectTimeoutError'
15
- code: 'UND_ERR_CONNECT_TIMEOUT'
14
+ name: 'ConnectTimeoutError';
15
+ code: 'UND_ERR_CONNECT_TIMEOUT';
16
16
  }
17
17
 
18
18
  /** A header exceeds the `headersTimeout` option. */
19
19
  export class HeadersTimeoutError extends UndiciError {
20
- name: 'HeadersTimeoutError'
21
- code: 'UND_ERR_HEADERS_TIMEOUT'
20
+ name: 'HeadersTimeoutError';
21
+ code: 'UND_ERR_HEADERS_TIMEOUT';
22
22
  }
23
23
 
24
24
  /** Headers overflow error. */
@@ -29,102 +29,101 @@ declare namespace Errors {
29
29
 
30
30
  /** A body exceeds the `bodyTimeout` option. */
31
31
  export class BodyTimeoutError extends UndiciError {
32
- name: 'BodyTimeoutError'
33
- code: 'UND_ERR_BODY_TIMEOUT'
32
+ name: 'BodyTimeoutError';
33
+ code: 'UND_ERR_BODY_TIMEOUT';
34
34
  }
35
35
 
36
- export class ResponseError extends UndiciError {
36
+ export class ResponseStatusCodeError extends UndiciError {
37
37
  constructor (
38
- message: string,
39
- code: number,
40
- options: {
41
- headers?: IncomingHttpHeaders | string[] | null,
42
- body?: null | Record<string, any> | string
43
- }
44
- )
45
- name: 'ResponseError'
46
- code: 'UND_ERR_RESPONSE'
47
- statusCode: number
38
+ message?: string,
39
+ statusCode?: number,
40
+ headers?: IncomingHttpHeaders | string[] | null,
41
+ body?: null | Record<string, any> | string
42
+ );
43
+ name: 'ResponseStatusCodeError';
44
+ code: 'UND_ERR_RESPONSE_STATUS_CODE';
48
45
  body: null | Record<string, any> | string
49
- headers: IncomingHttpHeaders | string[] | null
46
+ status: number
47
+ statusCode: number
48
+ headers: IncomingHttpHeaders | string[] | null;
50
49
  }
51
50
 
52
51
  /** Passed an invalid argument. */
53
52
  export class InvalidArgumentError extends UndiciError {
54
- name: 'InvalidArgumentError'
55
- code: 'UND_ERR_INVALID_ARG'
53
+ name: 'InvalidArgumentError';
54
+ code: 'UND_ERR_INVALID_ARG';
56
55
  }
57
56
 
58
57
  /** Returned an invalid value. */
59
58
  export class InvalidReturnValueError extends UndiciError {
60
- name: 'InvalidReturnValueError'
61
- code: 'UND_ERR_INVALID_RETURN_VALUE'
59
+ name: 'InvalidReturnValueError';
60
+ code: 'UND_ERR_INVALID_RETURN_VALUE';
62
61
  }
63
62
 
64
63
  /** The request has been aborted by the user. */
65
64
  export class RequestAbortedError extends UndiciError {
66
- name: 'AbortError'
67
- code: 'UND_ERR_ABORTED'
65
+ name: 'AbortError';
66
+ code: 'UND_ERR_ABORTED';
68
67
  }
69
68
 
70
69
  /** Expected error with reason. */
71
70
  export class InformationalError extends UndiciError {
72
- name: 'InformationalError'
73
- code: 'UND_ERR_INFO'
71
+ name: 'InformationalError';
72
+ code: 'UND_ERR_INFO';
74
73
  }
75
74
 
76
75
  /** Request body length does not match content-length header. */
77
76
  export class RequestContentLengthMismatchError extends UndiciError {
78
- name: 'RequestContentLengthMismatchError'
79
- code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
77
+ name: 'RequestContentLengthMismatchError';
78
+ code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
80
79
  }
81
80
 
82
81
  /** Response body length does not match content-length header. */
83
82
  export class ResponseContentLengthMismatchError extends UndiciError {
84
- name: 'ResponseContentLengthMismatchError'
85
- code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH'
83
+ name: 'ResponseContentLengthMismatchError';
84
+ code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
86
85
  }
87
86
 
88
87
  /** Trying to use a destroyed client. */
89
88
  export class ClientDestroyedError extends UndiciError {
90
- name: 'ClientDestroyedError'
91
- code: 'UND_ERR_DESTROYED'
89
+ name: 'ClientDestroyedError';
90
+ code: 'UND_ERR_DESTROYED';
92
91
  }
93
92
 
94
93
  /** Trying to use a closed client. */
95
94
  export class ClientClosedError extends UndiciError {
96
- name: 'ClientClosedError'
97
- code: 'UND_ERR_CLOSED'
95
+ name: 'ClientClosedError';
96
+ code: 'UND_ERR_CLOSED';
98
97
  }
99
98
 
100
99
  /** There is an error with the socket. */
101
100
  export class SocketError extends UndiciError {
102
- name: 'SocketError'
103
- code: 'UND_ERR_SOCKET'
101
+ name: 'SocketError';
102
+ code: 'UND_ERR_SOCKET';
104
103
  socket: Client.SocketInfo | null
105
104
  }
106
105
 
107
106
  /** Encountered unsupported functionality. */
108
107
  export class NotSupportedError extends UndiciError {
109
- name: 'NotSupportedError'
110
- code: 'UND_ERR_NOT_SUPPORTED'
108
+ name: 'NotSupportedError';
109
+ code: 'UND_ERR_NOT_SUPPORTED';
111
110
  }
112
111
 
113
112
  /** No upstream has been added to the BalancedPool. */
114
113
  export class BalancedPoolMissingUpstreamError extends UndiciError {
115
- name: 'MissingUpstreamError'
116
- code: 'UND_ERR_BPL_MISSING_UPSTREAM'
114
+ name: 'MissingUpstreamError';
115
+ code: 'UND_ERR_BPL_MISSING_UPSTREAM';
117
116
  }
118
117
 
119
118
  export class HTTPParserError extends UndiciError {
120
- name: 'HTTPParserError'
121
- code: string
119
+ name: 'HTTPParserError';
120
+ code: string;
122
121
  }
123
122
 
124
123
  /** The response exceed the length allowed. */
125
124
  export class ResponseExceededMaxSizeError extends UndiciError {
126
- name: 'ResponseExceededMaxSizeError'
127
- code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE'
125
+ name: 'ResponseExceededMaxSizeError';
126
+ code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
128
127
  }
129
128
 
130
129
  export class RequestRetryError extends UndiciError {
@@ -133,29 +132,18 @@ declare namespace Errors {
133
132
  statusCode: number,
134
133
  headers?: IncomingHttpHeaders | string[] | null,
135
134
  body?: null | Record<string, any> | string
136
- )
137
- name: 'RequestRetryError'
138
- code: 'UND_ERR_REQ_RETRY'
139
- statusCode: number
135
+ );
136
+ name: 'RequestRetryError';
137
+ code: 'UND_ERR_REQ_RETRY';
138
+ statusCode: number;
140
139
  data: {
141
140
  count: number;
142
- }
143
-
144
- headers: Record<string, string | string[]>
141
+ };
142
+ headers: Record<string, string | string[]>;
145
143
  }
146
144
 
147
145
  export class SecureProxyConnectionError extends UndiciError {
148
- constructor (
149
- cause?: Error,
150
- message?: string,
151
- options?: Record<any, any>
152
- )
153
- name: 'SecureProxyConnectionError'
154
- code: 'UND_ERR_PRX_TLS'
155
- }
156
-
157
- class MaxOriginsReachedError extends UndiciError {
158
- name: 'MaxOriginsReachedError'
159
- code: 'UND_ERR_MAX_ORIGINS_REACHED'
146
+ name: 'SecureProxyConnectionError';
147
+ code: 'UND_ERR_PRX_TLS';
160
148
  }
161
149
  }
@@ -18,9 +18,9 @@ interface EventSource extends EventTarget {
18
18
  readonly CLOSED: 2
19
19
  readonly CONNECTING: 0
20
20
  readonly OPEN: 1
21
- onerror: ((this: EventSource, ev: ErrorEvent) => any) | null
22
- onmessage: ((this: EventSource, ev: MessageEvent) => any) | null
23
- onopen: ((this: EventSource, ev: Event) => any) | null
21
+ onerror: (this: EventSource, ev: ErrorEvent) => any
22
+ onmessage: (this: EventSource, ev: MessageEvent) => any
23
+ onopen: (this: EventSource, ev: Event) => any
24
24
  readonly readyState: 0 | 1 | 2
25
25
  readonly url: string
26
26
  readonly withCredentials: boolean
@@ -56,11 +56,6 @@ export declare const EventSource: {
56
56
  }
57
57
 
58
58
  interface EventSourceInit {
59
- withCredentials?: boolean
60
- // @deprecated use `node.dispatcher` instead
59
+ withCredentials?: boolean,
61
60
  dispatcher?: Dispatcher
62
- node?: {
63
- dispatcher?: Dispatcher
64
- reconnectionTime?: number
65
- }
66
61
  }