@rio-cloud/cdk-v2-constructs 8.2.0 → 8.2.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 (179) hide show
  1. package/.jsii +2 -2
  2. package/node_modules/@types/node/README.md +3 -3
  3. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  4. package/node_modules/@types/node/assert.d.ts +211 -92
  5. package/node_modules/@types/node/async_hooks.d.ts +103 -19
  6. package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  7. package/node_modules/@types/node/buffer.d.ts +88 -516
  8. package/node_modules/@types/node/child_process.d.ts +167 -231
  9. package/node_modules/@types/node/cluster.d.ts +172 -26
  10. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  11. package/node_modules/@types/node/console.d.ts +66 -28
  12. package/node_modules/@types/node/constants.d.ts +14 -12
  13. package/node_modules/@types/node/crypto.d.ts +1458 -497
  14. package/node_modules/@types/node/dgram.d.ts +44 -30
  15. package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
  16. package/node_modules/@types/node/dns/promises.d.ts +120 -42
  17. package/node_modules/@types/node/dns.d.ts +209 -95
  18. package/node_modules/@types/node/domain.d.ts +14 -18
  19. package/node_modules/@types/node/events.d.ts +245 -113
  20. package/node_modules/@types/node/fs/promises.d.ts +194 -96
  21. package/node_modules/@types/node/fs.d.ts +695 -270
  22. package/node_modules/@types/node/globals.d.ts +97 -308
  23. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  24. package/node_modules/@types/node/http.d.ts +363 -97
  25. package/node_modules/@types/node/http2.d.ts +684 -231
  26. package/node_modules/@types/node/https.d.ts +122 -87
  27. package/node_modules/@types/node/index.d.ts +24 -11
  28. package/node_modules/@types/node/inspector.d.ts +220 -2690
  29. package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
  30. package/node_modules/@types/node/module.d.ts +705 -149
  31. package/node_modules/@types/node/net.d.ts +178 -54
  32. package/node_modules/@types/node/os.d.ts +47 -17
  33. package/node_modules/@types/node/package.json +22 -97
  34. package/node_modules/@types/node/path.d.ts +12 -3
  35. package/node_modules/@types/node/perf_hooks.d.ts +500 -97
  36. package/node_modules/@types/node/process.d.ts +657 -87
  37. package/node_modules/@types/node/punycode.d.ts +5 -5
  38. package/node_modules/@types/node/querystring.d.ts +24 -13
  39. package/node_modules/@types/node/readline/promises.d.ts +25 -14
  40. package/node_modules/@types/node/readline.d.ts +102 -41
  41. package/node_modules/@types/node/repl.d.ts +38 -30
  42. package/node_modules/@types/node/sea.d.ts +162 -0
  43. package/node_modules/@types/node/sqlite.d.ts +1040 -0
  44. package/node_modules/@types/node/stream/consumers.d.ts +33 -7
  45. package/node_modules/@types/node/stream/promises.d.ts +8 -1
  46. package/node_modules/@types/node/stream/web.d.ts +251 -28
  47. package/node_modules/@types/node/stream.d.ts +1060 -1055
  48. package/node_modules/@types/node/string_decoder.d.ts +8 -8
  49. package/node_modules/@types/node/test.d.ts +2133 -1166
  50. package/node_modules/@types/node/timers/promises.d.ts +31 -16
  51. package/node_modules/@types/node/timers.d.ts +159 -114
  52. package/node_modules/@types/node/tls.d.ts +232 -163
  53. package/node_modules/@types/node/trace_events.d.ts +43 -28
  54. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  55. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  56. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  57. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  58. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  59. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  60. package/node_modules/@types/node/tty.d.ts +9 -9
  61. package/node_modules/@types/node/url.d.ts +236 -84
  62. package/node_modules/@types/node/util.d.ts +562 -412
  63. package/node_modules/@types/node/v8.d.ts +368 -21
  64. package/node_modules/@types/node/vm.d.ts +443 -149
  65. package/node_modules/@types/node/wasi.d.ts +62 -18
  66. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  67. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  68. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  69. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  70. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  71. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  72. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  73. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  74. package/node_modules/@types/node/worker_threads.d.ts +310 -107
  75. package/node_modules/@types/node/zlib.d.ts +301 -73
  76. package/node_modules/undici-types/LICENSE +21 -0
  77. package/node_modules/undici-types/agent.d.ts +13 -12
  78. package/node_modules/undici-types/api.d.ts +26 -26
  79. package/node_modules/undici-types/balanced-pool.d.ts +19 -7
  80. package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  81. package/node_modules/undici-types/client-stats.d.ts +15 -0
  82. package/node_modules/undici-types/client.d.ts +26 -15
  83. package/node_modules/undici-types/connector.d.ts +2 -2
  84. package/node_modules/undici-types/cookies.d.ts +2 -0
  85. package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
  86. package/node_modules/undici-types/dispatcher.d.ts +148 -113
  87. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  88. package/node_modules/undici-types/errors.d.ts +79 -46
  89. package/node_modules/undici-types/eventsource.d.ts +66 -0
  90. package/node_modules/undici-types/fetch.d.ts +41 -39
  91. package/node_modules/undici-types/formdata.d.ts +8 -8
  92. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  93. package/node_modules/undici-types/global-origin.d.ts +5 -5
  94. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  95. package/node_modules/undici-types/handlers.d.ts +11 -5
  96. package/node_modules/undici-types/header.d.ts +157 -1
  97. package/node_modules/undici-types/index.d.ts +68 -43
  98. package/node_modules/undici-types/interceptors.d.ts +71 -3
  99. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  100. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  101. package/node_modules/undici-types/mock-client.d.ts +6 -4
  102. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  103. package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
  104. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  105. package/node_modules/undici-types/package.json +1 -1
  106. package/node_modules/undici-types/patch.d.ts +0 -42
  107. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  108. package/node_modules/undici-types/pool.d.ts +21 -8
  109. package/node_modules/undici-types/proxy-agent.d.ts +5 -6
  110. package/node_modules/undici-types/readable.d.ts +24 -17
  111. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  112. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  113. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  114. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  115. package/node_modules/undici-types/util.d.ts +18 -0
  116. package/node_modules/undici-types/utility.d.ts +7 -0
  117. package/node_modules/undici-types/webidl.d.ts +157 -36
  118. package/node_modules/undici-types/websocket.d.ts +67 -12
  119. package/package.json +9 -60
  120. package/version.json +1 -1
  121. package/node_modules/@types/node/dom-events.d.ts +0 -122
  122. package/node_modules/@types/node/globals.global.d.ts +0 -1
  123. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  124. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  125. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  126. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  127. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  128. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  129. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  130. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  131. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
  132. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
  133. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
  134. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  135. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  136. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  137. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  138. package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
  139. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
  140. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
  141. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
  142. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  143. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
  144. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  145. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  146. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  147. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  148. package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
  149. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  150. package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
  151. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  152. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
  153. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
  154. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  155. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  156. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  157. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  158. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  159. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  160. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  161. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
  162. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  163. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  164. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
  165. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  166. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  167. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  168. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  169. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  170. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  171. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
  172. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
  173. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
  174. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  175. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  176. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  177. package/node_modules/argparse/CHANGELOG.md +0 -216
  178. package/node_modules/undici-types/file.d.ts +0 -39
  179. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -1,796 +0,0 @@
1
- /**
2
- * Much of the Node.js core API is built around an idiomatic asynchronous
3
- * event-driven architecture in which certain kinds of objects (called "emitters")
4
- * emit named events that cause `Function` objects ("listeners") to be called.
5
- *
6
- * For instance: a `net.Server` object emits an event each time a peer
7
- * connects to it; a `fs.ReadStream` emits an event when the file is opened;
8
- * a `stream` emits an event whenever data is available to be read.
9
- *
10
- * All objects that emit events are instances of the `EventEmitter` class. These
11
- * objects expose an `eventEmitter.on()` function that allows one or more
12
- * functions to be attached to named events emitted by the object. Typically,
13
- * event names are camel-cased strings but any valid JavaScript property key
14
- * can be used.
15
- *
16
- * When the `EventEmitter` object emits an event, all of the functions attached
17
- * to that specific event are called _synchronously_. Any values returned by the
18
- * called listeners are _ignored_ and discarded.
19
- *
20
- * The following example shows a simple `EventEmitter` instance with a single
21
- * listener. The `eventEmitter.on()` method is used to register listeners, while
22
- * the `eventEmitter.emit()` method is used to trigger the event.
23
- *
24
- * ```js
25
- * import { EventEmitter } from 'node:events';
26
- *
27
- * class MyEmitter extends EventEmitter {}
28
- *
29
- * const myEmitter = new MyEmitter();
30
- * myEmitter.on('event', () => {
31
- * console.log('an event occurred!');
32
- * });
33
- * myEmitter.emit('event');
34
- * ```
35
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/events.js)
36
- */
37
- declare module "events" {
38
- // NOTE: This class is in the docs but is **not actually exported** by Node.
39
- // If https://github.com/nodejs/node/issues/39903 gets resolved and Node
40
- // actually starts exporting the class, uncomment below.
41
- // import { EventListener, EventListenerObject } from '__dom-events';
42
- // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
43
- // interface NodeEventTarget extends EventTarget {
44
- // /**
45
- // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
46
- // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
47
- // */
48
- // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
49
- // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
50
- // eventNames(): string[];
51
- // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
52
- // listenerCount(type: string): number;
53
- // /** Node.js-specific alias for `eventTarget.removeListener()`. */
54
- // off(type: string, listener: EventListener | EventListenerObject): this;
55
- // /** Node.js-specific alias for `eventTarget.addListener()`. */
56
- // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
57
- // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */
58
- // once(type: string, listener: EventListener | EventListenerObject): this;
59
- // /**
60
- // * Node.js-specific extension to the `EventTarget` class.
61
- // * If `type` is specified, removes all registered listeners for `type`,
62
- // * otherwise removes all registered listeners.
63
- // */
64
- // removeAllListeners(type: string): this;
65
- // /**
66
- // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
67
- // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
68
- // */
69
- // removeListener(type: string, listener: EventListener | EventListenerObject): this;
70
- // }
71
- interface EventEmitterOptions {
72
- /**
73
- * Enables automatic capturing of promise rejection.
74
- */
75
- captureRejections?: boolean | undefined;
76
- }
77
- // Any EventTarget with a Node-style `once` function
78
- interface _NodeEventTarget {
79
- once(eventName: string | symbol, listener: (...args: any[]) => void): this;
80
- }
81
- // Any EventTarget with a DOM-style `addEventListener`
82
- interface _DOMEventTarget {
83
- addEventListener(
84
- eventName: string,
85
- listener: (...args: any[]) => void,
86
- opts?: {
87
- once: boolean;
88
- },
89
- ): any;
90
- }
91
- interface StaticEventEmitterOptions {
92
- signal?: AbortSignal | undefined;
93
- }
94
- interface EventEmitter extends NodeJS.EventEmitter {}
95
- /**
96
- * The `EventEmitter` class is defined and exposed by the `node:events` module:
97
- *
98
- * ```js
99
- * import { EventEmitter } from 'node:events';
100
- * ```
101
- *
102
- * All `EventEmitter`s emit the event `'newListener'` when new listeners are
103
- * added and `'removeListener'` when existing listeners are removed.
104
- *
105
- * It supports the following option:
106
- * @since v0.1.26
107
- */
108
- class EventEmitter {
109
- constructor(options?: EventEmitterOptions);
110
- /**
111
- * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
112
- * event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
113
- * The `Promise` will resolve with an array of all the arguments emitted to the
114
- * given event.
115
- *
116
- * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
117
- * semantics and does not listen to the `'error'` event.
118
- *
119
- * ```js
120
- * import { once, EventEmitter } from 'node:events';
121
- * import process from 'node:process';
122
- *
123
- * const ee = new EventEmitter();
124
- *
125
- * process.nextTick(() => {
126
- * ee.emit('myevent', 42);
127
- * });
128
- *
129
- * const [value] = await once(ee, 'myevent');
130
- * console.log(value);
131
- *
132
- * const err = new Error('kaboom');
133
- * process.nextTick(() => {
134
- * ee.emit('error', err);
135
- * });
136
- *
137
- * try {
138
- * await once(ee, 'myevent');
139
- * } catch (err) {
140
- * console.error('error happened', err);
141
- * }
142
- * ```
143
- *
144
- * The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
145
- * '`error'` event itself, then it is treated as any other kind of event without
146
- * special handling:
147
- *
148
- * ```js
149
- * import { EventEmitter, once } from 'node:events';
150
- *
151
- * const ee = new EventEmitter();
152
- *
153
- * once(ee, 'error')
154
- * .then(([err]) => console.log('ok', err.message))
155
- * .catch((err) => console.error('error', err.message));
156
- *
157
- * ee.emit('error', new Error('boom'));
158
- *
159
- * // Prints: ok boom
160
- * ```
161
- *
162
- * An `AbortSignal` can be used to cancel waiting for the event:
163
- *
164
- * ```js
165
- * import { EventEmitter, once } from 'node:events';
166
- *
167
- * const ee = new EventEmitter();
168
- * const ac = new AbortController();
169
- *
170
- * async function foo(emitter, event, signal) {
171
- * try {
172
- * await once(emitter, event, { signal });
173
- * console.log('event emitted!');
174
- * } catch (error) {
175
- * if (error.name === 'AbortError') {
176
- * console.error('Waiting for the event was canceled!');
177
- * } else {
178
- * console.error('There was an error', error.message);
179
- * }
180
- * }
181
- * }
182
- *
183
- * foo(ee, 'foo', ac.signal);
184
- * ac.abort(); // Abort waiting for the event
185
- * ee.emit('foo'); // Prints: Waiting for the event was canceled!
186
- * ```
187
- * @since v11.13.0, v10.16.0
188
- */
189
- static once(
190
- emitter: _NodeEventTarget,
191
- eventName: string | symbol,
192
- options?: StaticEventEmitterOptions,
193
- ): Promise<any[]>;
194
- static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
195
- /**
196
- * ```js
197
- * import { on, EventEmitter } from 'node:events';
198
- * import process from 'node:process';
199
- *
200
- * const ee = new EventEmitter();
201
- *
202
- * // Emit later on
203
- * process.nextTick(() => {
204
- * ee.emit('foo', 'bar');
205
- * ee.emit('foo', 42);
206
- * });
207
- *
208
- * for await (const event of on(ee, 'foo')) {
209
- * // The execution of this inner block is synchronous and it
210
- * // processes one event at a time (even with await). Do not use
211
- * // if concurrent execution is required.
212
- * console.log(event); // prints ['bar'] [42]
213
- * }
214
- * // Unreachable here
215
- * ```
216
- *
217
- * Returns an `AsyncIterator` that iterates `eventName` events. It will throw
218
- * if the `EventEmitter` emits `'error'`. It removes all listeners when
219
- * exiting the loop. The `value` returned by each iteration is an array
220
- * composed of the emitted event arguments.
221
- *
222
- * An `AbortSignal` can be used to cancel waiting on events:
223
- *
224
- * ```js
225
- * import { on, EventEmitter } from 'node:events';
226
- * import process from 'node:process';
227
- *
228
- * const ac = new AbortController();
229
- *
230
- * (async () => {
231
- * const ee = new EventEmitter();
232
- *
233
- * // Emit later on
234
- * process.nextTick(() => {
235
- * ee.emit('foo', 'bar');
236
- * ee.emit('foo', 42);
237
- * });
238
- *
239
- * for await (const event of on(ee, 'foo', { signal: ac.signal })) {
240
- * // The execution of this inner block is synchronous and it
241
- * // processes one event at a time (even with await). Do not use
242
- * // if concurrent execution is required.
243
- * console.log(event); // prints ['bar'] [42]
244
- * }
245
- * // Unreachable here
246
- * })();
247
- *
248
- * process.nextTick(() => ac.abort());
249
- * ```
250
- * @since v13.6.0, v12.16.0
251
- * @param eventName The name of the event being listened for
252
- * @return that iterates `eventName` events emitted by the `emitter`
253
- */
254
- static on(
255
- emitter: NodeJS.EventEmitter,
256
- eventName: string,
257
- options?: StaticEventEmitterOptions,
258
- ): AsyncIterableIterator<any>;
259
- /**
260
- * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
261
- *
262
- * ```js
263
- * import { EventEmitter, listenerCount } from 'node:events';
264
- *
265
- * const myEmitter = new EventEmitter();
266
- * myEmitter.on('event', () => {});
267
- * myEmitter.on('event', () => {});
268
- * console.log(listenerCount(myEmitter, 'event'));
269
- * // Prints: 2
270
- * ```
271
- * @since v0.9.12
272
- * @deprecated Since v3.2.0 - Use `listenerCount` instead.
273
- * @param emitter The emitter to query
274
- * @param eventName The event name
275
- */
276
- static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number;
277
- /**
278
- * Returns a copy of the array of listeners for the event named `eventName`.
279
- *
280
- * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
281
- * the emitter.
282
- *
283
- * For `EventTarget`s this is the only way to get the event listeners for the
284
- * event target. This is useful for debugging and diagnostic purposes.
285
- *
286
- * ```js
287
- * import { getEventListeners, EventEmitter } from 'node:events';
288
- *
289
- * {
290
- * const ee = new EventEmitter();
291
- * const listener = () => console.log('Events are fun');
292
- * ee.on('foo', listener);
293
- * console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
294
- * }
295
- * {
296
- * const et = new EventTarget();
297
- * const listener = () => console.log('Events are fun');
298
- * et.addEventListener('foo', listener);
299
- * console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
300
- * }
301
- * ```
302
- * @since v15.2.0, v14.17.0
303
- */
304
- static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
305
- /**
306
- * Returns the currently set max amount of listeners.
307
- *
308
- * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on
309
- * the emitter.
310
- *
311
- * For `EventTarget`s this is the only way to get the max event listeners for the
312
- * event target. If the number of event handlers on a single EventTarget exceeds
313
- * the max set, the EventTarget will print a warning.
314
- *
315
- * ```js
316
- * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
317
- *
318
- * {
319
- * const ee = new EventEmitter();
320
- * console.log(getMaxListeners(ee)); // 10
321
- * setMaxListeners(11, ee);
322
- * console.log(getMaxListeners(ee)); // 11
323
- * }
324
- * {
325
- * const et = new EventTarget();
326
- * console.log(getMaxListeners(et)); // 10
327
- * setMaxListeners(11, et);
328
- * console.log(getMaxListeners(et)); // 11
329
- * }
330
- * ```
331
- * @since v19.9.0
332
- */
333
- static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number;
334
- /**
335
- * ```js
336
- * import { setMaxListeners, EventEmitter } from 'node:events';
337
- *
338
- * const target = new EventTarget();
339
- * const emitter = new EventEmitter();
340
- *
341
- * setMaxListeners(5, target, emitter);
342
- * ```
343
- * @since v15.4.0
344
- * @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
345
- * @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
346
- * objects.
347
- */
348
- static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void;
349
- /**
350
- * Listens once to the `abort` event on the provided `signal`.
351
- *
352
- * Listening to the `abort` event on abort signals is unsafe and may
353
- * lead to resource leaks since another third party with the signal can
354
- * call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change
355
- * this since it would violate the web standard. Additionally, the original
356
- * API makes it easy to forget to remove listeners.
357
- *
358
- * This API allows safely using `AbortSignal`s in Node.js APIs by solving these
359
- * two issues by listening to the event such that `stopImmediatePropagation` does
360
- * not prevent the listener from running.
361
- *
362
- * Returns a disposable so that it may be unsubscribed from more easily.
363
- *
364
- * ```js
365
- * import { addAbortListener } from 'node:events';
366
- *
367
- * function example(signal) {
368
- * let disposable;
369
- * try {
370
- * signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
371
- * disposable = addAbortListener(signal, (e) => {
372
- * // Do something when signal is aborted.
373
- * });
374
- * } finally {
375
- * disposable?.[Symbol.dispose]();
376
- * }
377
- * }
378
- * ```
379
- * @since v20.5.0
380
- * @experimental
381
- * @return that removes the `abort` listener.
382
- */
383
- static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
384
- /**
385
- * This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called.
386
- *
387
- * Installing a listener using this symbol does not change the behavior once an`'error'` event is emitted. Therefore, the process will still crash if no
388
- * regular `'error'` listener is installed.
389
- * @since v13.6.0, v12.17.0
390
- */
391
- static readonly errorMonitor: unique symbol;
392
- /**
393
- * Value: `Symbol.for('nodejs.rejection')`
394
- *
395
- * See how to write a custom `rejection handler`.
396
- * @since v13.4.0, v12.16.0
397
- */
398
- static readonly captureRejectionSymbol: unique symbol;
399
- /**
400
- * Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)
401
- *
402
- * Change the default `captureRejections` option on all new `EventEmitter` objects.
403
- * @since v13.4.0, v12.16.0
404
- */
405
- static captureRejections: boolean;
406
- /**
407
- * By default, a maximum of `10` listeners can be registered for any single
408
- * event. This limit can be changed for individual `EventEmitter` instances
409
- * using the `emitter.setMaxListeners(n)` method. To change the default
410
- * for _all_`EventEmitter` instances, the `events.defaultMaxListeners`property can be used. If this value is not a positive number, a `RangeError`is thrown.
411
- *
412
- * Take caution when setting the `events.defaultMaxListeners` because the
413
- * change affects _all_`EventEmitter` instances, including those created before
414
- * the change is made. However, calling `emitter.setMaxListeners(n)` still has
415
- * precedence over `events.defaultMaxListeners`.
416
- *
417
- * This is not a hard limit. The `EventEmitter` instance will allow
418
- * more listeners to be added but will output a trace warning to stderr indicating
419
- * that a "possible EventEmitter memory leak" has been detected. For any single`EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()`methods can be used to
420
- * temporarily avoid this warning:
421
- *
422
- * ```js
423
- * import { EventEmitter } from 'node:events';
424
- * const emitter = new EventEmitter();
425
- * emitter.setMaxListeners(emitter.getMaxListeners() + 1);
426
- * emitter.once('event', () => {
427
- * // do stuff
428
- * emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
429
- * });
430
- * ```
431
- *
432
- * The `--trace-warnings` command-line flag can be used to display the
433
- * stack trace for such warnings.
434
- *
435
- * The emitted warning can be inspected with `process.on('warning')` and will
436
- * have the additional `emitter`, `type`, and `count` properties, referring to
437
- * the event emitter instance, the event's name and the number of attached
438
- * listeners, respectively.
439
- * Its `name` property is set to `'MaxListenersExceededWarning'`.
440
- * @since v0.11.2
441
- */
442
- static defaultMaxListeners: number;
443
- }
444
- import internal = require("node:events");
445
- namespace EventEmitter {
446
- // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
447
- export { internal as EventEmitter };
448
- export interface Abortable {
449
- /**
450
- * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
451
- */
452
- signal?: AbortSignal | undefined;
453
- }
454
- }
455
- global {
456
- namespace NodeJS {
457
- interface EventEmitter {
458
- /**
459
- * Alias for `emitter.on(eventName, listener)`.
460
- * @since v0.1.26
461
- */
462
- addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
463
- /**
464
- * Adds the `listener` function to the end of the listeners array for the
465
- * event named `eventName`. No checks are made to see if the `listener` has
466
- * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
467
- * times.
468
- *
469
- * ```js
470
- * server.on('connection', (stream) => {
471
- * console.log('someone connected!');
472
- * });
473
- * ```
474
- *
475
- * Returns a reference to the `EventEmitter`, so that calls can be chained.
476
- *
477
- * By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the
478
- * event listener to the beginning of the listeners array.
479
- *
480
- * ```js
481
- * import { EventEmitter } from 'node:events';
482
- * const myEE = new EventEmitter();
483
- * myEE.on('foo', () => console.log('a'));
484
- * myEE.prependListener('foo', () => console.log('b'));
485
- * myEE.emit('foo');
486
- * // Prints:
487
- * // b
488
- * // a
489
- * ```
490
- * @since v0.1.101
491
- * @param eventName The name of the event.
492
- * @param listener The callback function
493
- */
494
- on(eventName: string | symbol, listener: (...args: any[]) => void): this;
495
- /**
496
- * Adds a **one-time**`listener` function for the event named `eventName`. The
497
- * next time `eventName` is triggered, this listener is removed and then invoked.
498
- *
499
- * ```js
500
- * server.once('connection', (stream) => {
501
- * console.log('Ah, we have our first user!');
502
- * });
503
- * ```
504
- *
505
- * Returns a reference to the `EventEmitter`, so that calls can be chained.
506
- *
507
- * By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the
508
- * event listener to the beginning of the listeners array.
509
- *
510
- * ```js
511
- * import { EventEmitter } from 'node:events';
512
- * const myEE = new EventEmitter();
513
- * myEE.once('foo', () => console.log('a'));
514
- * myEE.prependOnceListener('foo', () => console.log('b'));
515
- * myEE.emit('foo');
516
- * // Prints:
517
- * // b
518
- * // a
519
- * ```
520
- * @since v0.3.0
521
- * @param eventName The name of the event.
522
- * @param listener The callback function
523
- */
524
- once(eventName: string | symbol, listener: (...args: any[]) => void): this;
525
- /**
526
- * Removes the specified `listener` from the listener array for the event named`eventName`.
527
- *
528
- * ```js
529
- * const callback = (stream) => {
530
- * console.log('someone connected!');
531
- * };
532
- * server.on('connection', callback);
533
- * // ...
534
- * server.removeListener('connection', callback);
535
- * ```
536
- *
537
- * `removeListener()` will remove, at most, one instance of a listener from the
538
- * listener array. If any single listener has been added multiple times to the
539
- * listener array for the specified `eventName`, then `removeListener()` must be
540
- * called multiple times to remove each instance.
541
- *
542
- * Once an event is emitted, all listeners attached to it at the
543
- * time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
544
- * will not remove them from`emit()` in progress. Subsequent events behave as expected.
545
- *
546
- * ```js
547
- * import { EventEmitter } from 'node:events';
548
- * class MyEmitter extends EventEmitter {}
549
- * const myEmitter = new MyEmitter();
550
- *
551
- * const callbackA = () => {
552
- * console.log('A');
553
- * myEmitter.removeListener('event', callbackB);
554
- * };
555
- *
556
- * const callbackB = () => {
557
- * console.log('B');
558
- * };
559
- *
560
- * myEmitter.on('event', callbackA);
561
- *
562
- * myEmitter.on('event', callbackB);
563
- *
564
- * // callbackA removes listener callbackB but it will still be called.
565
- * // Internal listener array at time of emit [callbackA, callbackB]
566
- * myEmitter.emit('event');
567
- * // Prints:
568
- * // A
569
- * // B
570
- *
571
- * // callbackB is now removed.
572
- * // Internal listener array [callbackA]
573
- * myEmitter.emit('event');
574
- * // Prints:
575
- * // A
576
- * ```
577
- *
578
- * Because listeners are managed using an internal array, calling this will
579
- * change the position indices of any listener registered _after_ the listener
580
- * being removed. This will not impact the order in which listeners are called,
581
- * but it means that any copies of the listener array as returned by
582
- * the `emitter.listeners()` method will need to be recreated.
583
- *
584
- * When a single function has been added as a handler multiple times for a single
585
- * event (as in the example below), `removeListener()` will remove the most
586
- * recently added instance. In the example the `once('ping')`listener is removed:
587
- *
588
- * ```js
589
- * import { EventEmitter } from 'node:events';
590
- * const ee = new EventEmitter();
591
- *
592
- * function pong() {
593
- * console.log('pong');
594
- * }
595
- *
596
- * ee.on('ping', pong);
597
- * ee.once('ping', pong);
598
- * ee.removeListener('ping', pong);
599
- *
600
- * ee.emit('ping');
601
- * ee.emit('ping');
602
- * ```
603
- *
604
- * Returns a reference to the `EventEmitter`, so that calls can be chained.
605
- * @since v0.1.26
606
- */
607
- removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
608
- /**
609
- * Alias for `emitter.removeListener()`.
610
- * @since v10.0.0
611
- */
612
- off(eventName: string | symbol, listener: (...args: any[]) => void): this;
613
- /**
614
- * Removes all listeners, or those of the specified `eventName`.
615
- *
616
- * It is bad practice to remove listeners added elsewhere in the code,
617
- * particularly when the `EventEmitter` instance was created by some other
618
- * component or module (e.g. sockets or file streams).
619
- *
620
- * Returns a reference to the `EventEmitter`, so that calls can be chained.
621
- * @since v0.1.26
622
- */
623
- removeAllListeners(event?: string | symbol): this;
624
- /**
625
- * By default `EventEmitter`s will print a warning if more than `10` listeners are
626
- * added for a particular event. This is a useful default that helps finding
627
- * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
628
- * modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
629
- *
630
- * Returns a reference to the `EventEmitter`, so that calls can be chained.
631
- * @since v0.3.5
632
- */
633
- setMaxListeners(n: number): this;
634
- /**
635
- * Returns the current max listener value for the `EventEmitter` which is either
636
- * set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}.
637
- * @since v1.0.0
638
- */
639
- getMaxListeners(): number;
640
- /**
641
- * Returns a copy of the array of listeners for the event named `eventName`.
642
- *
643
- * ```js
644
- * server.on('connection', (stream) => {
645
- * console.log('someone connected!');
646
- * });
647
- * console.log(util.inspect(server.listeners('connection')));
648
- * // Prints: [ [Function] ]
649
- * ```
650
- * @since v0.1.26
651
- */
652
- listeners(eventName: string | symbol): Function[];
653
- /**
654
- * Returns a copy of the array of listeners for the event named `eventName`,
655
- * including any wrappers (such as those created by `.once()`).
656
- *
657
- * ```js
658
- * import { EventEmitter } from 'node:events';
659
- * const emitter = new EventEmitter();
660
- * emitter.once('log', () => console.log('log once'));
661
- *
662
- * // Returns a new Array with a function `onceWrapper` which has a property
663
- * // `listener` which contains the original listener bound above
664
- * const listeners = emitter.rawListeners('log');
665
- * const logFnWrapper = listeners[0];
666
- *
667
- * // Logs "log once" to the console and does not unbind the `once` event
668
- * logFnWrapper.listener();
669
- *
670
- * // Logs "log once" to the console and removes the listener
671
- * logFnWrapper();
672
- *
673
- * emitter.on('log', () => console.log('log persistently'));
674
- * // Will return a new Array with a single function bound by `.on()` above
675
- * const newListeners = emitter.rawListeners('log');
676
- *
677
- * // Logs "log persistently" twice
678
- * newListeners[0]();
679
- * emitter.emit('log');
680
- * ```
681
- * @since v9.4.0
682
- */
683
- rawListeners(eventName: string | symbol): Function[];
684
- /**
685
- * Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
686
- * to each.
687
- *
688
- * Returns `true` if the event had listeners, `false` otherwise.
689
- *
690
- * ```js
691
- * import { EventEmitter } from 'node:events';
692
- * const myEmitter = new EventEmitter();
693
- *
694
- * // First listener
695
- * myEmitter.on('event', function firstListener() {
696
- * console.log('Helloooo! first listener');
697
- * });
698
- * // Second listener
699
- * myEmitter.on('event', function secondListener(arg1, arg2) {
700
- * console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
701
- * });
702
- * // Third listener
703
- * myEmitter.on('event', function thirdListener(...args) {
704
- * const parameters = args.join(', ');
705
- * console.log(`event with parameters ${parameters} in third listener`);
706
- * });
707
- *
708
- * console.log(myEmitter.listeners('event'));
709
- *
710
- * myEmitter.emit('event', 1, 2, 3, 4, 5);
711
- *
712
- * // Prints:
713
- * // [
714
- * // [Function: firstListener],
715
- * // [Function: secondListener],
716
- * // [Function: thirdListener]
717
- * // ]
718
- * // Helloooo! first listener
719
- * // event with parameters 1, 2 in second listener
720
- * // event with parameters 1, 2, 3, 4, 5 in third listener
721
- * ```
722
- * @since v0.1.26
723
- */
724
- emit(eventName: string | symbol, ...args: any[]): boolean;
725
- /**
726
- * Returns the number of listeners listening for the event named `eventName`.
727
- * If `listener` is provided, it will return how many times the listener is found
728
- * in the list of the listeners of the event.
729
- * @since v3.2.0
730
- * @param eventName The name of the event being listened for
731
- * @param listener The event handler function
732
- */
733
- listenerCount(eventName: string | symbol, listener?: Function): number;
734
- /**
735
- * Adds the `listener` function to the _beginning_ of the listeners array for the
736
- * event named `eventName`. No checks are made to see if the `listener` has
737
- * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
738
- * times.
739
- *
740
- * ```js
741
- * server.prependListener('connection', (stream) => {
742
- * console.log('someone connected!');
743
- * });
744
- * ```
745
- *
746
- * Returns a reference to the `EventEmitter`, so that calls can be chained.
747
- * @since v6.0.0
748
- * @param eventName The name of the event.
749
- * @param listener The callback function
750
- */
751
- prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
752
- /**
753
- * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this
754
- * listener is removed, and then invoked.
755
- *
756
- * ```js
757
- * server.prependOnceListener('connection', (stream) => {
758
- * console.log('Ah, we have our first user!');
759
- * });
760
- * ```
761
- *
762
- * Returns a reference to the `EventEmitter`, so that calls can be chained.
763
- * @since v6.0.0
764
- * @param eventName The name of the event.
765
- * @param listener The callback function
766
- */
767
- prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
768
- /**
769
- * Returns an array listing the events for which the emitter has registered
770
- * listeners. The values in the array are strings or `Symbol`s.
771
- *
772
- * ```js
773
- * import { EventEmitter } from 'node:events';
774
- *
775
- * const myEE = new EventEmitter();
776
- * myEE.on('foo', () => {});
777
- * myEE.on('bar', () => {});
778
- *
779
- * const sym = Symbol('symbol');
780
- * myEE.on(sym, () => {});
781
- *
782
- * console.log(myEE.eventNames());
783
- * // Prints: [ 'foo', 'bar', Symbol(symbol) ]
784
- * ```
785
- * @since v6.0.0
786
- */
787
- eventNames(): Array<string | symbol>;
788
- }
789
- }
790
- }
791
- export = EventEmitter;
792
- }
793
- declare module "node:events" {
794
- import events = require("events");
795
- export = events;
796
- }