@rio-cloud/cdk-v2-constructs 8.2.0-alpha.0 → 8.2.1-alpha.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 (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
@@ -20,9 +20,10 @@
20
20
  * should generally include the module name to avoid collisions with data from
21
21
  * other modules.
22
22
  * @since v15.1.0, v14.17.0
23
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/diagnostics_channel.js)
23
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/diagnostics_channel.js)
24
24
  */
25
25
  declare module "diagnostics_channel" {
26
+ import { AsyncLocalStorage } from "node:async_hooks";
26
27
  /**
27
28
  * Check if there are active subscribers to the named channel. This is helpful if
28
29
  * the message you want to send might be expensive to prepare.
@@ -95,6 +96,36 @@ declare module "diagnostics_channel" {
95
96
  * @return `true` if the handler was found, `false` otherwise.
96
97
  */
97
98
  function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
99
+ /**
100
+ * Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing
101
+ * channels will be created in the form of `tracing:${name}:${eventType}` where `eventType` corresponds to the types of `TracingChannel Channels`.
102
+ *
103
+ * ```js
104
+ * import diagnostics_channel from 'node:diagnostics_channel';
105
+ *
106
+ * const channelsByName = diagnostics_channel.tracingChannel('my-channel');
107
+ *
108
+ * // or...
109
+ *
110
+ * const channelsByCollection = diagnostics_channel.tracingChannel({
111
+ * start: diagnostics_channel.channel('tracing:my-channel:start'),
112
+ * end: diagnostics_channel.channel('tracing:my-channel:end'),
113
+ * asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
114
+ * asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
115
+ * error: diagnostics_channel.channel('tracing:my-channel:error'),
116
+ * });
117
+ * ```
118
+ * @since v19.9.0
119
+ * @experimental
120
+ * @param nameOrChannels Channel name or object containing all the `TracingChannel Channels`
121
+ * @return Collection of channels to trace with
122
+ */
123
+ function tracingChannel<
124
+ StoreType = unknown,
125
+ ContextType extends object = StoreType extends object ? StoreType : object,
126
+ >(
127
+ nameOrChannels: string | TracingChannelCollection<StoreType, ContextType>,
128
+ ): TracingChannel<StoreType, ContextType>;
98
129
  /**
99
130
  * The class `Channel` represents an individual named channel within the data
100
131
  * pipeline. It is used to track subscribers and to publish messages when there
@@ -104,7 +135,7 @@ declare module "diagnostics_channel" {
104
135
  * with `new Channel(name)` is not supported.
105
136
  * @since v15.1.0, v14.17.0
106
137
  */
107
- class Channel {
138
+ class Channel<StoreType = unknown, ContextType = StoreType> {
108
139
  readonly name: string | symbol;
109
140
  /**
110
141
  * Check if there are active subscribers to this channel. This is helpful if
@@ -158,7 +189,6 @@ declare module "diagnostics_channel" {
158
189
  * });
159
190
  * ```
160
191
  * @since v15.1.0, v14.17.0
161
- * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
162
192
  * @param onMessage The handler to receive channel messages
163
193
  */
164
194
  subscribe(onMessage: ChannelListener): void;
@@ -179,11 +209,366 @@ declare module "diagnostics_channel" {
179
209
  * channel.unsubscribe(onMessage);
180
210
  * ```
181
211
  * @since v15.1.0, v14.17.0
182
- * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
183
212
  * @param onMessage The previous subscribed handler to remove
184
213
  * @return `true` if the handler was found, `false` otherwise.
185
214
  */
186
215
  unsubscribe(onMessage: ChannelListener): void;
216
+ /**
217
+ * When `channel.runStores(context, ...)` is called, the given context data
218
+ * will be applied to any store bound to the channel. If the store has already been
219
+ * bound the previous `transform` function will be replaced with the new one.
220
+ * The `transform` function may be omitted to set the given context data as the
221
+ * context directly.
222
+ *
223
+ * ```js
224
+ * import diagnostics_channel from 'node:diagnostics_channel';
225
+ * import { AsyncLocalStorage } from 'node:async_hooks';
226
+ *
227
+ * const store = new AsyncLocalStorage();
228
+ *
229
+ * const channel = diagnostics_channel.channel('my-channel');
230
+ *
231
+ * channel.bindStore(store, (data) => {
232
+ * return { data };
233
+ * });
234
+ * ```
235
+ * @since v19.9.0
236
+ * @experimental
237
+ * @param store The store to which to bind the context data
238
+ * @param transform Transform context data before setting the store context
239
+ */
240
+ bindStore(store: AsyncLocalStorage<StoreType>, transform?: (context: ContextType) => StoreType): void;
241
+ /**
242
+ * Remove a message handler previously registered to this channel with `channel.bindStore(store)`.
243
+ *
244
+ * ```js
245
+ * import diagnostics_channel from 'node:diagnostics_channel';
246
+ * import { AsyncLocalStorage } from 'node:async_hooks';
247
+ *
248
+ * const store = new AsyncLocalStorage();
249
+ *
250
+ * const channel = diagnostics_channel.channel('my-channel');
251
+ *
252
+ * channel.bindStore(store);
253
+ * channel.unbindStore(store);
254
+ * ```
255
+ * @since v19.9.0
256
+ * @experimental
257
+ * @param store The store to unbind from the channel.
258
+ * @return `true` if the store was found, `false` otherwise.
259
+ */
260
+ unbindStore(store: AsyncLocalStorage<StoreType>): boolean;
261
+ /**
262
+ * Applies the given data to any AsyncLocalStorage instances bound to the channel
263
+ * for the duration of the given function, then publishes to the channel within
264
+ * the scope of that data is applied to the stores.
265
+ *
266
+ * If a transform function was given to `channel.bindStore(store)` it will be
267
+ * applied to transform the message data before it becomes the context value for
268
+ * the store. The prior storage context is accessible from within the transform
269
+ * function in cases where context linking is required.
270
+ *
271
+ * The context applied to the store should be accessible in any async code which
272
+ * continues from execution which began during the given function, however
273
+ * there are some situations in which `context loss` may occur.
274
+ *
275
+ * ```js
276
+ * import diagnostics_channel from 'node:diagnostics_channel';
277
+ * import { AsyncLocalStorage } from 'node:async_hooks';
278
+ *
279
+ * const store = new AsyncLocalStorage();
280
+ *
281
+ * const channel = diagnostics_channel.channel('my-channel');
282
+ *
283
+ * channel.bindStore(store, (message) => {
284
+ * const parent = store.getStore();
285
+ * return new Span(message, parent);
286
+ * });
287
+ * channel.runStores({ some: 'message' }, () => {
288
+ * store.getStore(); // Span({ some: 'message' })
289
+ * });
290
+ * ```
291
+ * @since v19.9.0
292
+ * @experimental
293
+ * @param context Message to send to subscribers and bind to stores
294
+ * @param fn Handler to run within the entered storage context
295
+ * @param thisArg The receiver to be used for the function call.
296
+ * @param args Optional arguments to pass to the function.
297
+ */
298
+ runStores<ThisArg = any, Args extends any[] = any[], Result = any>(
299
+ context: ContextType,
300
+ fn: (this: ThisArg, ...args: Args) => Result,
301
+ thisArg?: ThisArg,
302
+ ...args: Args
303
+ ): Result;
304
+ }
305
+ interface TracingChannelSubscribers<ContextType extends object> {
306
+ start: (message: ContextType) => void;
307
+ end: (
308
+ message: ContextType & {
309
+ error?: unknown;
310
+ result?: unknown;
311
+ },
312
+ ) => void;
313
+ asyncStart: (
314
+ message: ContextType & {
315
+ error?: unknown;
316
+ result?: unknown;
317
+ },
318
+ ) => void;
319
+ asyncEnd: (
320
+ message: ContextType & {
321
+ error?: unknown;
322
+ result?: unknown;
323
+ },
324
+ ) => void;
325
+ error: (
326
+ message: ContextType & {
327
+ error: unknown;
328
+ },
329
+ ) => void;
330
+ }
331
+ interface TracingChannelCollection<StoreType = unknown, ContextType = StoreType> {
332
+ start: Channel<StoreType, ContextType>;
333
+ end: Channel<StoreType, ContextType>;
334
+ asyncStart: Channel<StoreType, ContextType>;
335
+ asyncEnd: Channel<StoreType, ContextType>;
336
+ error: Channel<StoreType, ContextType>;
337
+ }
338
+ /**
339
+ * The class `TracingChannel` is a collection of `TracingChannel Channels` which
340
+ * together express a single traceable action. It is used to formalize and
341
+ * simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a `TracingChannel`. As with `Channel` it is recommended to create and reuse a
342
+ * single `TracingChannel` at the top-level of the file rather than creating them
343
+ * dynamically.
344
+ * @since v19.9.0
345
+ * @experimental
346
+ */
347
+ class TracingChannel<StoreType = unknown, ContextType extends object = {}> implements TracingChannelCollection {
348
+ start: Channel<StoreType, ContextType>;
349
+ end: Channel<StoreType, ContextType>;
350
+ asyncStart: Channel<StoreType, ContextType>;
351
+ asyncEnd: Channel<StoreType, ContextType>;
352
+ error: Channel<StoreType, ContextType>;
353
+ /**
354
+ * Helper to subscribe a collection of functions to the corresponding channels.
355
+ * This is the same as calling `channel.subscribe(onMessage)` on each channel
356
+ * individually.
357
+ *
358
+ * ```js
359
+ * import diagnostics_channel from 'node:diagnostics_channel';
360
+ *
361
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
362
+ *
363
+ * channels.subscribe({
364
+ * start(message) {
365
+ * // Handle start message
366
+ * },
367
+ * end(message) {
368
+ * // Handle end message
369
+ * },
370
+ * asyncStart(message) {
371
+ * // Handle asyncStart message
372
+ * },
373
+ * asyncEnd(message) {
374
+ * // Handle asyncEnd message
375
+ * },
376
+ * error(message) {
377
+ * // Handle error message
378
+ * },
379
+ * });
380
+ * ```
381
+ * @since v19.9.0
382
+ * @experimental
383
+ * @param subscribers Set of `TracingChannel Channels` subscribers
384
+ */
385
+ subscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
386
+ /**
387
+ * Helper to unsubscribe a collection of functions from the corresponding channels.
388
+ * This is the same as calling `channel.unsubscribe(onMessage)` on each channel
389
+ * individually.
390
+ *
391
+ * ```js
392
+ * import diagnostics_channel from 'node:diagnostics_channel';
393
+ *
394
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
395
+ *
396
+ * channels.unsubscribe({
397
+ * start(message) {
398
+ * // Handle start message
399
+ * },
400
+ * end(message) {
401
+ * // Handle end message
402
+ * },
403
+ * asyncStart(message) {
404
+ * // Handle asyncStart message
405
+ * },
406
+ * asyncEnd(message) {
407
+ * // Handle asyncEnd message
408
+ * },
409
+ * error(message) {
410
+ * // Handle error message
411
+ * },
412
+ * });
413
+ * ```
414
+ * @since v19.9.0
415
+ * @experimental
416
+ * @param subscribers Set of `TracingChannel Channels` subscribers
417
+ * @return `true` if all handlers were successfully unsubscribed, and `false` otherwise.
418
+ */
419
+ unsubscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
420
+ /**
421
+ * Trace a synchronous function call. This will always produce a `start event` and `end event` around the execution and may produce an `error event` if the given function throws an error.
422
+ * This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
423
+ * events should have any bound stores set to match this trace context.
424
+ *
425
+ * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
426
+ * which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
427
+ *
428
+ * ```js
429
+ * import diagnostics_channel from 'node:diagnostics_channel';
430
+ *
431
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
432
+ *
433
+ * channels.traceSync(() => {
434
+ * // Do something
435
+ * }, {
436
+ * some: 'thing',
437
+ * });
438
+ * ```
439
+ * @since v19.9.0
440
+ * @experimental
441
+ * @param fn Function to wrap a trace around
442
+ * @param context Shared object to correlate events through
443
+ * @param thisArg The receiver to be used for the function call
444
+ * @param args Optional arguments to pass to the function
445
+ * @return The return value of the given function
446
+ */
447
+ traceSync<ThisArg = any, Args extends any[] = any[], Result = any>(
448
+ fn: (this: ThisArg, ...args: Args) => Result,
449
+ context?: ContextType,
450
+ thisArg?: ThisArg,
451
+ ...args: Args
452
+ ): Result;
453
+ /**
454
+ * Trace a promise-returning function call. This will always produce a `start event` and `end event` around the synchronous portion of the
455
+ * function execution, and will produce an `asyncStart event` and `asyncEnd event` when a promise continuation is reached. It may also
456
+ * produce an `error event` if the given function throws an error or the
457
+ * returned promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
458
+ * events should have any bound stores set to match this trace context.
459
+ *
460
+ * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
461
+ * which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
462
+ *
463
+ * ```js
464
+ * import diagnostics_channel from 'node:diagnostics_channel';
465
+ *
466
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
467
+ *
468
+ * channels.tracePromise(async () => {
469
+ * // Do something
470
+ * }, {
471
+ * some: 'thing',
472
+ * });
473
+ * ```
474
+ * @since v19.9.0
475
+ * @experimental
476
+ * @param fn Promise-returning function to wrap a trace around
477
+ * @param context Shared object to correlate trace events through
478
+ * @param thisArg The receiver to be used for the function call
479
+ * @param args Optional arguments to pass to the function
480
+ * @return Chained from promise returned by the given function
481
+ */
482
+ tracePromise<ThisArg = any, Args extends any[] = any[], Result = any>(
483
+ fn: (this: ThisArg, ...args: Args) => Promise<Result>,
484
+ context?: ContextType,
485
+ thisArg?: ThisArg,
486
+ ...args: Args
487
+ ): Promise<Result>;
488
+ /**
489
+ * Trace a callback-receiving function call. This will always produce a `start event` and `end event` around the synchronous portion of the
490
+ * function execution, and will produce a `asyncStart event` and `asyncEnd event` around the callback execution. It may also produce an `error event` if the given function throws an error or
491
+ * the returned
492
+ * promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
493
+ * events should have any bound stores set to match this trace context.
494
+ *
495
+ * The `position` will be -1 by default to indicate the final argument should
496
+ * be used as the callback.
497
+ *
498
+ * ```js
499
+ * import diagnostics_channel from 'node:diagnostics_channel';
500
+ *
501
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
502
+ *
503
+ * channels.traceCallback((arg1, callback) => {
504
+ * // Do something
505
+ * callback(null, 'result');
506
+ * }, 1, {
507
+ * some: 'thing',
508
+ * }, thisArg, arg1, callback);
509
+ * ```
510
+ *
511
+ * The callback will also be run with `channel.runStores(context, ...)` which
512
+ * enables context loss recovery in some cases.
513
+ *
514
+ * To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
515
+ * which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
516
+ *
517
+ * ```js
518
+ * import diagnostics_channel from 'node:diagnostics_channel';
519
+ * import { AsyncLocalStorage } from 'node:async_hooks';
520
+ *
521
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
522
+ * const myStore = new AsyncLocalStorage();
523
+ *
524
+ * // The start channel sets the initial store data to something
525
+ * // and stores that store data value on the trace context object
526
+ * channels.start.bindStore(myStore, (data) => {
527
+ * const span = new Span(data);
528
+ * data.span = span;
529
+ * return span;
530
+ * });
531
+ *
532
+ * // Then asyncStart can restore from that data it stored previously
533
+ * channels.asyncStart.bindStore(myStore, (data) => {
534
+ * return data.span;
535
+ * });
536
+ * ```
537
+ * @since v19.9.0
538
+ * @experimental
539
+ * @param fn callback using function to wrap a trace around
540
+ * @param position Zero-indexed argument position of expected callback
541
+ * @param context Shared object to correlate trace events through
542
+ * @param thisArg The receiver to be used for the function call
543
+ * @param args Optional arguments to pass to the function
544
+ * @return The return value of the given function
545
+ */
546
+ traceCallback<ThisArg = any, Args extends any[] = any[], Result = any>(
547
+ fn: (this: ThisArg, ...args: Args) => Result,
548
+ position?: number,
549
+ context?: ContextType,
550
+ thisArg?: ThisArg,
551
+ ...args: Args
552
+ ): Result;
553
+ /**
554
+ * `true` if any of the individual channels has a subscriber, `false` if not.
555
+ *
556
+ * This is a helper method available on a {@link TracingChannel} instance to check
557
+ * if any of the [TracingChannel Channels](https://nodejs.org/api/diagnostics_channel.html#tracingchannel-channels) have subscribers.
558
+ * A `true` is returned if any of them have at least one subscriber, a `false` is returned otherwise.
559
+ *
560
+ * ```js
561
+ * const diagnostics_channel = require('node:diagnostics_channel');
562
+ *
563
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
564
+ *
565
+ * if (channels.hasSubscribers) {
566
+ * // Do something
567
+ * }
568
+ * ```
569
+ * @since v22.0.0, v20.13.0
570
+ */
571
+ readonly hasSubscribers: boolean;
187
572
  }
188
573
  }
189
574
  declare module "node:diagnostics_channel" {