@idlebox/stripe-node-types 24.0.14-patch.0 → 24.0.15

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 (134) hide show
  1. package/README.md +1 -1
  2. package/assert/strict.d.ts +113 -1
  3. package/assert.d.ts +162 -248
  4. package/async_hooks.d.ts +20 -5
  5. package/buffer.buffer.d.ts +24 -6
  6. package/buffer.d.ts +63 -168
  7. package/child_process.d.ts +117 -223
  8. package/cluster.d.ts +251 -329
  9. package/compatibility/iterators.d.ts +15 -0
  10. package/console.d.ts +60 -346
  11. package/constants.d.ts +15 -1
  12. package/crypto.d.ts +713 -1149
  13. package/dgram.d.ts +30 -50
  14. package/diagnostics_channel.d.ts +16 -3
  15. package/dns/promises.d.ts +15 -0
  16. package/dns.d.ts +150 -131
  17. package/domain.d.ts +25 -14
  18. package/events.d.ts +858 -719
  19. package/fs/promises.d.ts +117 -53
  20. package/fs.d.ts +729 -484
  21. package/globals.d.ts +142 -344
  22. package/globals.typedarray.d.ts +94 -0
  23. package/http.d.ts +358 -246
  24. package/http2.d.ts +578 -711
  25. package/https.d.ts +85 -216
  26. package/index.d.ts +39 -3
  27. package/inspector/promises.d.ts +54 -0
  28. package/inspector.d.ts +180 -3936
  29. package/inspector.generated.d.ts +4242 -0
  30. package/module.d.ts +60 -95
  31. package/my-shim.d.ts +15 -0
  32. package/net.d.ts +102 -186
  33. package/os.d.ts +32 -6
  34. package/package.json +3 -8
  35. package/path/posix.d.ts +20 -0
  36. package/path/win32.d.ts +20 -0
  37. package/path.d.ts +132 -122
  38. package/perf_hooks.d.ts +310 -644
  39. package/process.d.ts +192 -138
  40. package/punycode.d.ts +17 -2
  41. package/querystring.d.ts +16 -1
  42. package/quic.d.ts +926 -0
  43. package/readline/promises.d.ts +16 -1
  44. package/readline.d.ts +80 -118
  45. package/repl.d.ts +98 -96
  46. package/sea.d.ts +25 -1
  47. package/sqlite.d.ts +277 -13
  48. package/stream/consumers.d.ts +22 -7
  49. package/stream/promises.d.ts +148 -12
  50. package/stream/web.d.ts +187 -494
  51. package/stream.d.ts +608 -490
  52. package/string_decoder.d.ts +18 -3
  53. package/test/reporters.d.ts +112 -0
  54. package/test.d.ts +238 -199
  55. package/timers/promises.d.ts +16 -1
  56. package/timers.d.ts +16 -129
  57. package/tls.d.ts +163 -163
  58. package/trace_events.d.ts +21 -6
  59. package/ts5.6/buffer.buffer.d.ts +25 -8
  60. package/ts5.6/compatibility/float16array.d.ts +15 -0
  61. package/ts5.6/globals.typedarray.d.ts +31 -0
  62. package/ts5.6/index.d.ts +39 -3
  63. package/ts5.7/compatibility/float16array.d.ts +15 -0
  64. package/ts5.7/index.d.ts +39 -3
  65. package/tty.d.ts +70 -13
  66. package/undici-types/agent.d.ts +20 -4
  67. package/undici-types/api.d.ts +15 -0
  68. package/undici-types/balanced-pool.d.ts +15 -0
  69. package/undici-types/cache-interceptor.d.ts +15 -0
  70. package/undici-types/cache.d.ts +15 -0
  71. package/undici-types/client-stats.d.ts +31 -0
  72. package/undici-types/client.d.ts +21 -5
  73. package/undici-types/connector.d.ts +15 -0
  74. package/undici-types/content-type.d.ts +15 -0
  75. package/undici-types/cookies.d.ts +15 -0
  76. package/undici-types/diagnostics-channel.d.ts +24 -1
  77. package/undici-types/dispatcher.d.ts +18 -8
  78. package/undici-types/env-http-proxy-agent.d.ts +17 -1
  79. package/undici-types/errors.d.ts +20 -15
  80. package/undici-types/eventsource.d.ts +24 -4
  81. package/undici-types/fetch.d.ts +16 -0
  82. package/undici-types/formdata.d.ts +15 -0
  83. package/undici-types/global-dispatcher.d.ts +15 -0
  84. package/undici-types/global-origin.d.ts +15 -0
  85. package/undici-types/h2c-client.d.ts +15 -2
  86. package/undici-types/handlers.d.ts +16 -1
  87. package/undici-types/header.d.ts +15 -0
  88. package/undici-types/index.d.ts +21 -1
  89. package/undici-types/interceptors.d.ts +20 -0
  90. package/undici-types/mock-agent.d.ts +18 -0
  91. package/undici-types/mock-call-history.d.ts +15 -0
  92. package/undici-types/mock-client.d.ts +17 -0
  93. package/undici-types/mock-errors.d.ts +15 -0
  94. package/undici-types/mock-interceptor.d.ts +17 -1
  95. package/undici-types/mock-pool.d.ts +17 -0
  96. package/undici-types/package.json +1 -1
  97. package/undici-types/patch.d.ts +15 -0
  98. package/undici-types/pool-stats.d.ts +15 -0
  99. package/undici-types/pool.d.ts +17 -0
  100. package/undici-types/proxy-agent.d.ts +16 -0
  101. package/undici-types/readable.d.ts +15 -0
  102. package/undici-types/retry-agent.d.ts +15 -0
  103. package/undici-types/retry-handler.d.ts +24 -0
  104. package/undici-types/snapshot-agent.d.ts +125 -0
  105. package/undici-types/util.d.ts +15 -0
  106. package/undici-types/utility.d.ts +15 -0
  107. package/undici-types/webidl.d.ts +126 -36
  108. package/undici-types/websocket.d.ts +18 -1
  109. package/url.d.ts +107 -587
  110. package/util/types.d.ts +571 -0
  111. package/util.d.ts +158 -792
  112. package/v8.d.ts +82 -7
  113. package/vm.d.ts +267 -108
  114. package/wasi.d.ts +38 -2
  115. package/web-globals/abortcontroller.d.ts +75 -0
  116. package/web-globals/blob.d.ts +39 -0
  117. package/web-globals/console.d.ts +25 -0
  118. package/web-globals/crypto.d.ts +55 -0
  119. package/web-globals/domexception.d.ts +84 -0
  120. package/web-globals/encoding.d.ts +27 -0
  121. package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
  122. package/web-globals/fetch.d.ts +70 -0
  123. package/web-globals/importmeta.d.ts +29 -0
  124. package/web-globals/messaging.d.ts +39 -0
  125. package/web-globals/navigator.d.ts +41 -0
  126. package/web-globals/performance.d.ts +61 -0
  127. package/web-globals/storage.d.ts +40 -0
  128. package/web-globals/streams.d.ts +131 -0
  129. package/web-globals/timers.d.ts +60 -0
  130. package/web-globals/url.d.ts +40 -0
  131. package/worker_threads.d.ts +306 -349
  132. package/zlib.d.ts +59 -94
  133. package/ts5.1/compatibility/disposable.d.ts +0 -13
  134. package/ts5.1/index.d.ts +0 -100
package/perf_hooks.d.ts CHANGED
@@ -1,3 +1,18 @@
1
+ // biome-ignore-all lint: generated file
2
+ // biome-ignore-all assist: generated file
3
+ /* eslint-disable */
4
+ // @ts-ignore
5
+
6
+ /******************************************************************************
7
+ * GENERATED FILE, DO NOT MODIFY
8
+ * 这是生成的文件,千万不要修改
9
+ *
10
+ * @build-script/codegen - The Simple Code Generater
11
+ * https://github.com/GongT/baobao
12
+ *
13
+ ******************************************************************************/
14
+
15
+
1
16
  /**
2
17
  * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for
3
18
  * Node.js-specific performance measurements.
@@ -27,11 +42,12 @@
27
42
  * performance.measure('A to B', 'A', 'B');
28
43
  * });
29
44
  * ```
30
- * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/perf_hooks.js)
45
+ * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/perf_hooks.js)
31
46
  */
32
47
 
33
48
  declare module "node:perf_hooks" {
34
- import { AsyncResource } from 'node:async_hooks';
49
+ import { InternalEventTargetEventProperties } from 'node:events';
50
+ // #region web types
35
51
  type EntryType =
36
52
  | "dns" // Node.js only
37
53
  | "function" // Node.js only
@@ -43,79 +59,291 @@ declare module "node:perf_hooks" {
43
59
  | "net" // Node.js only
44
60
  | "node" // Node.js only
45
61
  | "resource"; // available on the Web
46
- interface NodeGCPerformanceDetail {
47
- /**
48
- * When `performanceEntry.entryType` is equal to 'gc', the `performance.kind` property identifies
49
- * the type of garbage collection operation that occurred.
50
- * See perf_hooks.constants for valid values.
51
- */
52
- readonly kind?: number | undefined;
53
- /**
54
- * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
55
- * property contains additional information about garbage collection operation.
56
- * See perf_hooks.constants for valid values.
57
- */
58
- readonly flags?: number | undefined;
62
+ interface EventLoopUtilization {
63
+ idle: number;
64
+ active: number;
65
+ utilization: number;
59
66
  }
60
- /**
61
- * The constructor of this class is not exposed to users directly.
62
- * @since v8.5.0
63
- */
64
- class PerformanceEntry {
65
- protected constructor();
66
- /**
67
- * The total number of milliseconds elapsed for this entry. This value will not
68
- * be meaningful for all Performance Entry types.
69
- * @since v8.5.0
70
- */
71
- readonly duration: number;
72
- /**
73
- * The name of the performance entry.
74
- * @since v8.5.0
75
- */
76
- readonly name: string;
67
+ interface ConnectionTimingInfo {
68
+ domainLookupStartTime: number;
69
+ domainLookupEndTime: number;
70
+ connectionStartTime: number;
71
+ connectionEndTime: number;
72
+ secureConnectionStartTime: number;
73
+ ALPNNegotiatedProtocol: string;
74
+ }
75
+ interface FetchTimingInfo {
76
+ startTime: number;
77
+ redirectStartTime: number;
78
+ redirectEndTime: number;
79
+ postRedirectStartTime: number;
80
+ finalServiceWorkerStartTime: number;
81
+ finalNetworkRequestStartTime: number;
82
+ finalNetworkResponseStartTime: number;
83
+ endTime: number;
84
+ finalConnectionTimingInfo: ConnectionTimingInfo | null;
85
+ encodedBodySize: number;
86
+ decodedBodySize: number;
87
+ }
88
+ type PerformanceEntryList = PerformanceEntry[];
89
+ interface PerformanceMarkOptions {
90
+ detail?: any;
91
+ startTime?: number;
92
+ }
93
+ interface PerformanceMeasureOptions {
94
+ detail?: any;
95
+ duration?: number;
96
+ end?: string | number;
97
+ start?: string | number;
98
+ }
99
+ interface PerformanceObserverCallback {
100
+ (entries: PerformanceObserverEntryList, observer: PerformanceObserver): void;
101
+ }
102
+ interface PerformanceObserverInit {
103
+ buffered?: boolean;
104
+ entryTypes?: EntryType[];
105
+ type?: EntryType;
106
+ }
107
+ interface PerformanceEventMap {
108
+ "resourcetimingbufferfull": Event;
109
+ }
110
+ interface Performance extends EventTarget, InternalEventTargetEventProperties<PerformanceEventMap> {
111
+ readonly nodeTiming: PerformanceNodeTiming;
112
+ readonly timeOrigin: number;
113
+ clearMarks(markName?: string): void;
114
+ clearMeasures(measureName?: string): void;
115
+ clearResourceTimings(resourceTimingName?: string): void;
116
+ getEntries(): PerformanceEntryList;
117
+ getEntriesByName(name: string, type?: EntryType): PerformanceEntryList;
118
+ getEntriesByType(type: EntryType): PerformanceEntryList;
119
+ mark(markName: string, markOptions?: PerformanceMarkOptions): PerformanceMark;
120
+ markResourceTiming(
121
+ timingInfo: FetchTimingInfo,
122
+ requestedUrl: string,
123
+ initiatorType: string,
124
+ global: unknown,
125
+ cacheMode: string,
126
+ bodyInfo: unknown,
127
+ responseStatus: number,
128
+ deliveryType?: string,
129
+ ): PerformanceResourceTiming;
130
+ measure(measureName: string, startMark?: string, endMark?: string): PerformanceMeasure;
131
+ measure(measureName: string, options: PerformanceMeasureOptions, endMark?: string): PerformanceMeasure;
132
+ now(): number;
133
+ setResourceTimingBufferSize(maxSize: number): void;
134
+ toJSON(): any;
135
+ addEventListener<K extends keyof PerformanceEventMap>(
136
+ type: K,
137
+ listener: (ev: PerformanceEventMap[K]) => void,
138
+ options?: AddEventListenerOptions | boolean,
139
+ ): void;
140
+ addEventListener(
141
+ type: string,
142
+ listener: EventListener | EventListenerObject,
143
+ options?: AddEventListenerOptions | boolean,
144
+ ): void;
145
+ removeEventListener<K extends keyof PerformanceEventMap>(
146
+ type: K,
147
+ listener: (ev: PerformanceEventMap[K]) => void,
148
+ options?: EventListenerOptions | boolean,
149
+ ): void;
150
+ removeEventListener(
151
+ type: string,
152
+ listener: EventListener | EventListenerObject,
153
+ options?: EventListenerOptions | boolean,
154
+ ): void;
77
155
  /**
78
- * The high resolution millisecond timestamp marking the starting time of the
79
- * Performance Entry.
80
- * @since v8.5.0
156
+ * The `eventLoopUtilization()` method returns an object that contains the
157
+ * cumulative duration of time the event loop has been both idle and active as a
158
+ * high resolution milliseconds timer. The `utilization` value is the calculated
159
+ * Event Loop Utilization (ELU).
160
+ *
161
+ * If bootstrapping has not yet finished on the main thread the properties have
162
+ * the value of `0`. The ELU is immediately available on [Worker threads](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#worker-threads) since
163
+ * bootstrap happens within the event loop.
164
+ *
165
+ * Both `utilization1` and `utilization2` are optional parameters.
166
+ *
167
+ * If `utilization1` is passed, then the delta between the current call's `active`
168
+ * and `idle` times, as well as the corresponding `utilization` value are
169
+ * calculated and returned (similar to `process.hrtime()`).
170
+ *
171
+ * If `utilization1` and `utilization2` are both passed, then the delta is
172
+ * calculated between the two arguments. This is a convenience option because,
173
+ * unlike `process.hrtime()`, calculating the ELU is more complex than a
174
+ * single subtraction.
175
+ *
176
+ * ELU is similar to CPU utilization, except that it only measures event loop
177
+ * statistics and not CPU usage. It represents the percentage of time the event
178
+ * loop has spent outside the event loop's event provider (e.g. `epoll_wait`).
179
+ * No other CPU idle time is taken into consideration. The following is an example
180
+ * of how a mostly idle process will have a high ELU.
181
+ *
182
+ * ```js
183
+ * import { eventLoopUtilization } from 'node:perf_hooks';
184
+ * import { spawnSync } from 'node:child_process';
185
+ *
186
+ * setImmediate(() => {
187
+ * const elu = eventLoopUtilization();
188
+ * spawnSync('sleep', ['5']);
189
+ * console.log(eventLoopUtilization(elu).utilization);
190
+ * });
191
+ * ```
192
+ *
193
+ * Although the CPU is mostly idle while running this script, the value of
194
+ * `utilization` is `1`. This is because the call to
195
+ * `child_process.spawnSync()` blocks the event loop from proceeding.
196
+ *
197
+ * Passing in a user-defined object instead of the result of a previous call to
198
+ * `eventLoopUtilization()` will lead to undefined behavior. The return values
199
+ * are not guaranteed to reflect any correct state of the event loop.
200
+ * @since v14.10.0, v12.19.0
201
+ * @param utilization1 The result of a previous call to
202
+ * `eventLoopUtilization()`.
203
+ * @param utilization2 The result of a previous call to
204
+ * `eventLoopUtilization()` prior to `utilization1`.
81
205
  */
82
- readonly startTime: number;
206
+ eventLoopUtilization(
207
+ utilization1?: EventLoopUtilization,
208
+ utilization2?: EventLoopUtilization,
209
+ ): EventLoopUtilization;
83
210
  /**
84
- * The type of the performance entry. It may be one of:
211
+ * _This property is an extension by Node.js. It is not available in Web browsers._
212
+ *
213
+ * Wraps a function within a new function that measures the running time of the
214
+ * wrapped function. A `PerformanceObserver` must be subscribed to the `'function'`
215
+ * event type in order for the timing details to be accessed.
216
+ *
217
+ * ```js
218
+ * import { performance, PerformanceObserver } from 'node:perf_hooks';
219
+ *
220
+ * function someFunction() {
221
+ * console.log('hello world');
222
+ * }
223
+ *
224
+ * const wrapped = performance.timerify(someFunction);
225
+ *
226
+ * const obs = new PerformanceObserver((list) => {
227
+ * console.log(list.getEntries()[0].duration);
228
+ *
229
+ * performance.clearMarks();
230
+ * performance.clearMeasures();
231
+ * obs.disconnect();
232
+ * });
233
+ * obs.observe({ entryTypes: ['function'] });
234
+ *
235
+ * // A performance timeline entry will be created
236
+ * wrapped();
237
+ * ```
85
238
  *
86
- * * `'node'` (Node.js only)
87
- * * `'mark'` (available on the Web)
88
- * * `'measure'` (available on the Web)
89
- * * `'gc'` (Node.js only)
90
- * * `'function'` (Node.js only)
91
- * * `'http2'` (Node.js only)
92
- * * `'http'` (Node.js only)
239
+ * If the wrapped function returns a promise, a finally handler will be attached
240
+ * to the promise and the duration will be reported once the finally handler is
241
+ * invoked.
93
242
  * @since v8.5.0
94
243
  */
244
+ timerify<T extends (...args: any[]) => any>(fn: T, options?: PerformanceTimerifyOptions): T;
245
+ }
246
+ var Performance: {
247
+ prototype: Performance;
248
+ new(): Performance;
249
+ };
250
+ interface PerformanceEntry {
251
+ readonly duration: number;
95
252
  readonly entryType: EntryType;
96
- /**
97
- * Additional detail specific to the `entryType`.
98
- * @since v16.0.0
99
- */
100
- readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
253
+ readonly name: string;
254
+ readonly startTime: number;
101
255
  toJSON(): any;
102
256
  }
103
- /**
104
- * Exposes marks created via the `Performance.mark()` method.
105
- * @since v18.2.0, v16.17.0
106
- */
107
- class PerformanceMark extends PerformanceEntry {
108
- readonly duration: 0;
257
+ var PerformanceEntry: {
258
+ prototype: PerformanceEntry;
259
+ new(): PerformanceEntry;
260
+ };
261
+ interface PerformanceMark extends PerformanceEntry {
262
+ readonly detail: any;
109
263
  readonly entryType: "mark";
110
264
  }
265
+ var PerformanceMark: {
266
+ prototype: PerformanceMark;
267
+ new(markName: string, markOptions?: PerformanceMarkOptions): PerformanceMark;
268
+ };
269
+ interface PerformanceMeasure extends PerformanceEntry {
270
+ readonly detail: any;
271
+ readonly entryType: "measure";
272
+ }
273
+ var PerformanceMeasure: {
274
+ prototype: PerformanceMeasure;
275
+ new(): PerformanceMeasure;
276
+ };
277
+ interface PerformanceObserver {
278
+ disconnect(): void;
279
+ observe(options: PerformanceObserverInit): void;
280
+ takeRecords(): PerformanceEntryList;
281
+ }
282
+ var PerformanceObserver: {
283
+ prototype: PerformanceObserver;
284
+ new(callback: PerformanceObserverCallback): PerformanceObserver;
285
+ readonly supportedEntryTypes: readonly EntryType[];
286
+ };
287
+ interface PerformanceObserverEntryList {
288
+ getEntries(): PerformanceEntryList;
289
+ getEntriesByName(name: string, type?: EntryType): PerformanceEntryList;
290
+ getEntriesByType(type: EntryType): PerformanceEntryList;
291
+ }
292
+ var PerformanceObserverEntryList: {
293
+ prototype: PerformanceObserverEntryList;
294
+ new(): PerformanceObserverEntryList;
295
+ };
296
+ interface PerformanceResourceTiming extends PerformanceEntry {
297
+ readonly connectEnd: number;
298
+ readonly connectStart: number;
299
+ readonly decodedBodySize: number;
300
+ readonly domainLookupEnd: number;
301
+ readonly domainLookupStart: number;
302
+ readonly encodedBodySize: number;
303
+ readonly entryType: "resource";
304
+ readonly fetchStart: number;
305
+ readonly initiatorType: string;
306
+ readonly nextHopProtocol: string;
307
+ readonly redirectEnd: number;
308
+ readonly redirectStart: number;
309
+ readonly requestStart: number;
310
+ readonly responseEnd: number;
311
+ readonly responseStart: number;
312
+ readonly responseStatus: number;
313
+ readonly secureConnectionStart: number;
314
+ readonly transferSize: number;
315
+ readonly workerStart: number;
316
+ toJSON(): any;
317
+ }
318
+ var PerformanceResourceTiming: {
319
+ prototype: PerformanceResourceTiming;
320
+ new(): PerformanceResourceTiming;
321
+ };
322
+ var performance: Performance;
323
+ // #endregion
324
+ interface PerformanceTimerifyOptions {
325
+ /**
326
+ * A histogram object created using
327
+ * `perf_hooks.createHistogram()` that will record runtime durations in
328
+ * nanoseconds.
329
+ */
330
+ histogram?: RecordableHistogram | undefined;
331
+ }
111
332
  /**
112
- * Exposes measures created via the `Performance.measure()` method.
333
+ * _This class is an extension by Node.js. It is not available in Web browsers._
334
+ *
335
+ * Provides detailed Node.js timing data.
113
336
  *
114
337
  * The constructor of this class is not exposed to users directly.
115
- * @since v18.2.0, v16.17.0
338
+ * @since v19.0.0
116
339
  */
117
- class PerformanceMeasure extends PerformanceEntry {
118
- readonly entryType: "measure";
340
+ class PerformanceNodeEntry extends PerformanceEntry {
341
+ /**
342
+ * Additional detail specific to the `entryType`.
343
+ * @since v16.0.0
344
+ */
345
+ readonly detail: any;
346
+ readonly entryType: "dns" | "function" | "gc" | "http2" | "http" | "net" | "node";
119
347
  }
120
348
  interface UVMetrics {
121
349
  /**
@@ -138,8 +366,7 @@ declare module "node:perf_hooks" {
138
366
  * is not exposed to users.
139
367
  * @since v8.5.0
140
368
  */
141
- class PerformanceNodeTiming extends PerformanceEntry {
142
- readonly entryType: "node";
369
+ interface PerformanceNodeTiming extends PerformanceEntry {
143
370
  /**
144
371
  * The high resolution millisecond timestamp at which the Node.js process
145
372
  * completed bootstrapping. If bootstrapping has not yet finished, the property
@@ -147,6 +374,7 @@ declare module "node:perf_hooks" {
147
374
  * @since v8.5.0
148
375
  */
149
376
  readonly bootstrapComplete: number;
377
+ readonly entryType: "node";
150
378
  /**
151
379
  * The high resolution millisecond timestamp at which the Node.js environment was
152
380
  * initialized.
@@ -198,507 +426,6 @@ declare module "node:perf_hooks" {
198
426
  */
199
427
  readonly v8Start: number;
200
428
  }
201
- interface EventLoopUtilization {
202
- idle: number;
203
- active: number;
204
- utilization: number;
205
- }
206
- /**
207
- * @param utilization1 The result of a previous call to `eventLoopUtilization()`.
208
- * @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`.
209
- */
210
- type EventLoopUtilityFunction = (
211
- utilization1?: EventLoopUtilization,
212
- utilization2?: EventLoopUtilization,
213
- ) => EventLoopUtilization;
214
- interface MarkOptions {
215
- /**
216
- * Additional optional detail to include with the mark.
217
- */
218
- detail?: unknown | undefined;
219
- /**
220
- * An optional timestamp to be used as the mark time.
221
- * @default `performance.now()`
222
- */
223
- startTime?: number | undefined;
224
- }
225
- interface MeasureOptions {
226
- /**
227
- * Additional optional detail to include with the mark.
228
- */
229
- detail?: unknown | undefined;
230
- /**
231
- * Duration between start and end times.
232
- */
233
- duration?: number | undefined;
234
- /**
235
- * Timestamp to be used as the end time, or a string identifying a previously recorded mark.
236
- */
237
- end?: number | string | undefined;
238
- /**
239
- * Timestamp to be used as the start time, or a string identifying a previously recorded mark.
240
- */
241
- start?: number | string | undefined;
242
- }
243
- interface TimerifyOptions {
244
- /**
245
- * A histogram object created using `perf_hooks.createHistogram()` that will record runtime
246
- * durations in nanoseconds.
247
- */
248
- histogram?: RecordableHistogram | undefined;
249
- }
250
- interface Performance {
251
- /**
252
- * If `name` is not provided, removes all `PerformanceMark` objects from the Performance Timeline.
253
- * If `name` is provided, removes only the named mark.
254
- * @since v8.5.0
255
- */
256
- clearMarks(name?: string): void;
257
- /**
258
- * If `name` is not provided, removes all `PerformanceMeasure` objects from the Performance Timeline.
259
- * If `name` is provided, removes only the named measure.
260
- * @since v16.7.0
261
- */
262
- clearMeasures(name?: string): void;
263
- /**
264
- * If `name` is not provided, removes all `PerformanceResourceTiming` objects from the Resource Timeline.
265
- * If `name` is provided, removes only the named resource.
266
- * @since v18.2.0, v16.17.0
267
- */
268
- clearResourceTimings(name?: string): void;
269
- /**
270
- * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
271
- * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
272
- * No other CPU idle time is taken into consideration.
273
- */
274
- eventLoopUtilization: EventLoopUtilityFunction;
275
- /**
276
- * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
277
- * If you are only interested in performance entries of certain types or that have certain names, see
278
- * `performance.getEntriesByType()` and `performance.getEntriesByName()`.
279
- * @since v16.7.0
280
- */
281
- getEntries(): PerformanceEntry[];
282
- /**
283
- * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
284
- * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`.
285
- * @param name
286
- * @param type
287
- * @since v16.7.0
288
- */
289
- getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
290
- /**
291
- * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
292
- * whose `performanceEntry.entryType` is equal to `type`.
293
- * @param type
294
- * @since v16.7.0
295
- */
296
- getEntriesByType(type: EntryType): PerformanceEntry[];
297
- /**
298
- * Creates a new `PerformanceMark` entry in the Performance Timeline.
299
- * A `PerformanceMark` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'mark'`,
300
- * and whose `performanceEntry.duration` is always `0`.
301
- * Performance marks are used to mark specific significant moments in the Performance Timeline.
302
- *
303
- * The created `PerformanceMark` entry is put in the global Performance Timeline and can be queried with
304
- * `performance.getEntries`, `performance.getEntriesByName`, and `performance.getEntriesByType`. When the observation is
305
- * performed, the entries should be cleared from the global Performance Timeline manually with `performance.clearMarks`.
306
- * @param name
307
- */
308
- mark(name: string, options?: MarkOptions): PerformanceMark;
309
- /**
310
- * Creates a new `PerformanceResourceTiming` entry in the Resource Timeline.
311
- * A `PerformanceResourceTiming` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'resource'`.
312
- * Performance resources are used to mark moments in the Resource Timeline.
313
- * @param timingInfo [Fetch Timing Info](https://fetch.spec.whatwg.org/#fetch-timing-info)
314
- * @param requestedUrl The resource url
315
- * @param initiatorType The initiator name, e.g: 'fetch'
316
- * @param global
317
- * @param cacheMode The cache mode must be an empty string ('') or 'local'
318
- * @param bodyInfo [Fetch Response Body Info](https://fetch.spec.whatwg.org/#response-body-info)
319
- * @param responseStatus The response's status code
320
- * @param deliveryType The delivery type. Default: ''.
321
- * @since v18.2.0, v16.17.0
322
- */
323
- markResourceTiming(
324
- timingInfo: object,
325
- requestedUrl: string,
326
- initiatorType: string,
327
- global: object,
328
- cacheMode: "" | "local",
329
- bodyInfo: object,
330
- responseStatus: number,
331
- deliveryType?: string,
332
- ): PerformanceResourceTiming;
333
- /**
334
- * Creates a new PerformanceMeasure entry in the Performance Timeline.
335
- * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
336
- * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark.
337
- *
338
- * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify
339
- * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist,
340
- * then startMark is set to timeOrigin by default.
341
- *
342
- * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp
343
- * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown.
344
- * @param name
345
- * @param startMark
346
- * @param endMark
347
- * @return The PerformanceMeasure entry that was created
348
- */
349
- measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
350
- measure(name: string, options: MeasureOptions): PerformanceMeasure;
351
- /**
352
- * _This property is an extension by Node.js. It is not available in Web browsers._
353
- *
354
- * An instance of the `PerformanceNodeTiming` class that provides performance metrics for specific Node.js operational milestones.
355
- * @since v8.5.0
356
- */
357
- readonly nodeTiming: PerformanceNodeTiming;
358
- /**
359
- * Returns the current high resolution millisecond timestamp, where 0 represents the start of the current `node` process.
360
- * @since v8.5.0
361
- */
362
- now(): number;
363
- /**
364
- * Sets the global performance resource timing buffer size to the specified number of "resource" type performance entry objects.
365
- *
366
- * By default the max buffer size is set to 250.
367
- * @since v18.8.0
368
- */
369
- setResourceTimingBufferSize(maxSize: number): void;
370
- /**
371
- * The [`timeOrigin`](https://w3c.github.io/hr-time/#dom-performance-timeorigin) specifies the high resolution millisecond timestamp
372
- * at which the current `node` process began, measured in Unix time.
373
- * @since v8.5.0
374
- */
375
- readonly timeOrigin: number;
376
- /**
377
- * _This property is an extension by Node.js. It is not available in Web browsers._
378
- *
379
- * Wraps a function within a new function that measures the running time of the wrapped function.
380
- * A `PerformanceObserver` must be subscribed to the `'function'` event type in order for the timing details to be accessed.
381
- *
382
- * ```js
383
- * import {
384
- * performance,
385
- * PerformanceObserver,
386
- * } from 'node:perf_hooks';
387
- *
388
- * function someFunction() {
389
- * console.log('hello world');
390
- * }
391
- *
392
- * const wrapped = performance.timerify(someFunction);
393
- *
394
- * const obs = new PerformanceObserver((list) => {
395
- * console.log(list.getEntries()[0].duration);
396
- *
397
- * performance.clearMarks();
398
- * performance.clearMeasures();
399
- * obs.disconnect();
400
- * });
401
- * obs.observe({ entryTypes: ['function'] });
402
- *
403
- * // A performance timeline entry will be created
404
- * wrapped();
405
- * ```
406
- *
407
- * If the wrapped function returns a promise, a finally handler will be attached to the promise and the duration will be reported
408
- * once the finally handler is invoked.
409
- * @param fn
410
- */
411
- timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
412
- /**
413
- * An object which is JSON representation of the performance object. It is similar to
414
- * [`window.performance.toJSON`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON) in browsers.
415
- * @since v16.1.0
416
- */
417
- toJSON(): any;
418
- }
419
- class PerformanceObserverEntryList {
420
- /**
421
- * Returns a list of `PerformanceEntry` objects in chronological order
422
- * with respect to `performanceEntry.startTime`.
423
- *
424
- * ```js
425
- * import {
426
- * performance,
427
- * PerformanceObserver,
428
- * } from 'node:perf_hooks';
429
- *
430
- * const obs = new PerformanceObserver((perfObserverList, observer) => {
431
- * console.log(perfObserverList.getEntries());
432
- *
433
- * * [
434
- * * PerformanceEntry {
435
- * * name: 'test',
436
- * * entryType: 'mark',
437
- * * startTime: 81.465639,
438
- * * duration: 0,
439
- * * detail: null
440
- * * },
441
- * * PerformanceEntry {
442
- * * name: 'meow',
443
- * * entryType: 'mark',
444
- * * startTime: 81.860064,
445
- * * duration: 0,
446
- * * detail: null
447
- * * }
448
- * * ]
449
- *
450
- * performance.clearMarks();
451
- * performance.clearMeasures();
452
- * observer.disconnect();
453
- * });
454
- * obs.observe({ type: 'mark' });
455
- *
456
- * performance.mark('test');
457
- * performance.mark('meow');
458
- * ```
459
- * @since v8.5.0
460
- */
461
- getEntries(): PerformanceEntry[];
462
- /**
463
- * Returns a list of `PerformanceEntry` objects in chronological order
464
- * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is
465
- * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
466
- *
467
- * ```js
468
- * import {
469
- * performance,
470
- * PerformanceObserver,
471
- * } from 'node:perf_hooks';
472
- *
473
- * const obs = new PerformanceObserver((perfObserverList, observer) => {
474
- * console.log(perfObserverList.getEntriesByName('meow'));
475
- *
476
- * * [
477
- * * PerformanceEntry {
478
- * * name: 'meow',
479
- * * entryType: 'mark',
480
- * * startTime: 98.545991,
481
- * * duration: 0,
482
- * * detail: null
483
- * * }
484
- * * ]
485
- *
486
- * console.log(perfObserverList.getEntriesByName('nope')); // []
487
- *
488
- * console.log(perfObserverList.getEntriesByName('test', 'mark'));
489
- *
490
- * * [
491
- * * PerformanceEntry {
492
- * * name: 'test',
493
- * * entryType: 'mark',
494
- * * startTime: 63.518931,
495
- * * duration: 0,
496
- * * detail: null
497
- * * }
498
- * * ]
499
- *
500
- * console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
501
- *
502
- * performance.clearMarks();
503
- * performance.clearMeasures();
504
- * observer.disconnect();
505
- * });
506
- * obs.observe({ entryTypes: ['mark', 'measure'] });
507
- *
508
- * performance.mark('test');
509
- * performance.mark('meow');
510
- * ```
511
- * @since v8.5.0
512
- */
513
- getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
514
- /**
515
- * Returns a list of `PerformanceEntry` objects in chronological order
516
- * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` is equal to `type`.
517
- *
518
- * ```js
519
- * import {
520
- * performance,
521
- * PerformanceObserver,
522
- * } from 'node:perf_hooks';
523
- *
524
- * const obs = new PerformanceObserver((perfObserverList, observer) => {
525
- * console.log(perfObserverList.getEntriesByType('mark'));
526
- *
527
- * * [
528
- * * PerformanceEntry {
529
- * * name: 'test',
530
- * * entryType: 'mark',
531
- * * startTime: 55.897834,
532
- * * duration: 0,
533
- * * detail: null
534
- * * },
535
- * * PerformanceEntry {
536
- * * name: 'meow',
537
- * * entryType: 'mark',
538
- * * startTime: 56.350146,
539
- * * duration: 0,
540
- * * detail: null
541
- * * }
542
- * * ]
543
- *
544
- * performance.clearMarks();
545
- * performance.clearMeasures();
546
- * observer.disconnect();
547
- * });
548
- * obs.observe({ type: 'mark' });
549
- *
550
- * performance.mark('test');
551
- * performance.mark('meow');
552
- * ```
553
- * @since v8.5.0
554
- */
555
- getEntriesByType(type: EntryType): PerformanceEntry[];
556
- }
557
- type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
558
- /**
559
- * @since v8.5.0
560
- */
561
- class PerformanceObserver extends AsyncResource {
562
- constructor(callback: PerformanceObserverCallback);
563
- /**
564
- * Disconnects the `PerformanceObserver` instance from all notifications.
565
- * @since v8.5.0
566
- */
567
- disconnect(): void;
568
- /**
569
- * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`:
570
- *
571
- * ```js
572
- * import {
573
- * performance,
574
- * PerformanceObserver,
575
- * } from 'node:perf_hooks';
576
- *
577
- * const obs = new PerformanceObserver((list, observer) => {
578
- * // Called once asynchronously. `list` contains three items.
579
- * });
580
- * obs.observe({ type: 'mark' });
581
- *
582
- * for (let n = 0; n < 3; n++)
583
- * performance.mark(`test${n}`);
584
- * ```
585
- * @since v8.5.0
586
- */
587
- observe(
588
- options:
589
- | {
590
- entryTypes: readonly EntryType[];
591
- buffered?: boolean | undefined;
592
- }
593
- | {
594
- type: EntryType;
595
- buffered?: boolean | undefined;
596
- },
597
- ): void;
598
- /**
599
- * @since v16.0.0
600
- * @returns Current list of entries stored in the performance observer, emptying it out.
601
- */
602
- takeRecords(): PerformanceEntry[];
603
- }
604
- /**
605
- * Provides detailed network timing data regarding the loading of an application's resources.
606
- *
607
- * The constructor of this class is not exposed to users directly.
608
- * @since v18.2.0, v16.17.0
609
- */
610
- class PerformanceResourceTiming extends PerformanceEntry {
611
- readonly entryType: "resource";
612
- protected constructor();
613
- /**
614
- * The high resolution millisecond timestamp at immediately before dispatching the `fetch`
615
- * request. If the resource is not intercepted by a worker the property will always return 0.
616
- * @since v18.2.0, v16.17.0
617
- */
618
- readonly workerStart: number;
619
- /**
620
- * The high resolution millisecond timestamp that represents the start time of the fetch which
621
- * initiates the redirect.
622
- * @since v18.2.0, v16.17.0
623
- */
624
- readonly redirectStart: number;
625
- /**
626
- * The high resolution millisecond timestamp that will be created immediately after receiving
627
- * the last byte of the response of the last redirect.
628
- * @since v18.2.0, v16.17.0
629
- */
630
- readonly redirectEnd: number;
631
- /**
632
- * The high resolution millisecond timestamp immediately before the Node.js starts to fetch the resource.
633
- * @since v18.2.0, v16.17.0
634
- */
635
- readonly fetchStart: number;
636
- /**
637
- * The high resolution millisecond timestamp immediately before the Node.js starts the domain name lookup
638
- * for the resource.
639
- * @since v18.2.0, v16.17.0
640
- */
641
- readonly domainLookupStart: number;
642
- /**
643
- * The high resolution millisecond timestamp representing the time immediately after the Node.js finished
644
- * the domain name lookup for the resource.
645
- * @since v18.2.0, v16.17.0
646
- */
647
- readonly domainLookupEnd: number;
648
- /**
649
- * The high resolution millisecond timestamp representing the time immediately before Node.js starts to
650
- * establish the connection to the server to retrieve the resource.
651
- * @since v18.2.0, v16.17.0
652
- */
653
- readonly connectStart: number;
654
- /**
655
- * The high resolution millisecond timestamp representing the time immediately after Node.js finishes
656
- * establishing the connection to the server to retrieve the resource.
657
- * @since v18.2.0, v16.17.0
658
- */
659
- readonly connectEnd: number;
660
- /**
661
- * The high resolution millisecond timestamp representing the time immediately before Node.js starts the
662
- * handshake process to secure the current connection.
663
- * @since v18.2.0, v16.17.0
664
- */
665
- readonly secureConnectionStart: number;
666
- /**
667
- * The high resolution millisecond timestamp representing the time immediately before Node.js receives the
668
- * first byte of the response from the server.
669
- * @since v18.2.0, v16.17.0
670
- */
671
- readonly requestStart: number;
672
- /**
673
- * The high resolution millisecond timestamp representing the time immediately after Node.js receives the
674
- * last byte of the resource or immediately before the transport connection is closed, whichever comes first.
675
- * @since v18.2.0, v16.17.0
676
- */
677
- readonly responseEnd: number;
678
- /**
679
- * A number representing the size (in octets) of the fetched resource. The size includes the response header
680
- * fields plus the response payload body.
681
- * @since v18.2.0, v16.17.0
682
- */
683
- readonly transferSize: number;
684
- /**
685
- * A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before
686
- * removing any applied content-codings.
687
- * @since v18.2.0, v16.17.0
688
- */
689
- readonly encodedBodySize: number;
690
- /**
691
- * A number representing the size (in octets) received from the fetch (HTTP or cache), of the message body, after
692
- * removing any applied content-codings.
693
- * @since v18.2.0, v16.17.0
694
- */
695
- readonly decodedBodySize: number;
696
- /**
697
- * Returns a `object` that is the JSON representation of the `PerformanceResourceTiming` object
698
- * @since v18.2.0, v16.17.0
699
- */
700
- toJSON(): any;
701
- }
702
429
  namespace constants {
703
430
  const NODE_PERFORMANCE_GC_MAJOR: number;
704
431
  const NODE_PERFORMANCE_GC_MINOR: number;
@@ -712,7 +439,6 @@ declare module "node:perf_hooks" {
712
439
  const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
713
440
  const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
714
441
  }
715
- const performance: Performance;
716
442
  interface EventLoopMonitorOptions {
717
443
  /**
718
444
  * The sampling rate in milliseconds.
@@ -814,6 +540,20 @@ declare module "node:perf_hooks" {
814
540
  * @since v11.10.0
815
541
  */
816
542
  disable(): boolean;
543
+ /**
544
+ * Disables the update interval timer when the histogram is disposed.
545
+ *
546
+ * ```js
547
+ * const { monitorEventLoopDelay } = require('node:perf_hooks');
548
+ * {
549
+ * using hist = monitorEventLoopDelay({ resolution: 20 });
550
+ * hist.enable();
551
+ * // The histogram will be disabled when the block is exited.
552
+ * }
553
+ * ```
554
+ * @since v24.2.0
555
+ */
556
+ [Symbol.dispose](): void;
817
557
  }
818
558
  interface RecordableHistogram extends Histogram {
819
559
  /**
@@ -884,85 +624,11 @@ declare module "node:perf_hooks" {
884
624
  * @since v15.9.0, v14.18.0
885
625
  */
886
626
  function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
887
- import {
888
- performance as _performance,
889
- PerformanceEntry as _PerformanceEntry,
890
- PerformanceMark as _PerformanceMark,
891
- PerformanceMeasure as _PerformanceMeasure,
892
- PerformanceObserver as _PerformanceObserver,
893
- PerformanceObserverEntryList as _PerformanceObserverEntryList,
894
- PerformanceResourceTiming as _PerformanceResourceTiming,
895
- } from 'node:perf_hooks';
896
- global {
897
- /**
898
- * `PerformanceEntry` is a global reference for `import { PerformanceEntry } from 'node:perf_hooks'`
899
- * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceentry
900
- * @since v19.0.0
901
- */
902
- var PerformanceEntry: typeof globalThis extends {
903
- onmessage: any;
904
- PerformanceEntry: infer T;
905
- } ? T
906
- : typeof _PerformanceEntry;
907
- /**
908
- * `PerformanceMark` is a global reference for `import { PerformanceMark } from 'node:perf_hooks'`
909
- * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performancemark
910
- * @since v19.0.0
911
- */
912
- var PerformanceMark: typeof globalThis extends {
913
- onmessage: any;
914
- PerformanceMark: infer T;
915
- } ? T
916
- : typeof _PerformanceMark;
917
- /**
918
- * `PerformanceMeasure` is a global reference for `import { PerformanceMeasure } from 'node:perf_hooks'`
919
- * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performancemeasure
920
- * @since v19.0.0
921
- */
922
- var PerformanceMeasure: typeof globalThis extends {
923
- onmessage: any;
924
- PerformanceMeasure: infer T;
925
- } ? T
926
- : typeof _PerformanceMeasure;
927
- /**
928
- * `PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:perf_hooks'`
929
- * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceobserver
930
- * @since v19.0.0
931
- */
932
- var PerformanceObserver: typeof globalThis extends {
933
- onmessage: any;
934
- PerformanceObserver: infer T;
935
- } ? T
936
- : typeof _PerformanceObserver;
937
- /**
938
- * `PerformanceObserverEntryList` is a global reference for `import { PerformanceObserverEntryList } from 'node:perf_hooks'`
939
- * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceobserverentrylist
940
- * @since v19.0.0
941
- */
942
- var PerformanceObserverEntryList: typeof globalThis extends {
943
- onmessage: any;
944
- PerformanceObserverEntryList: infer T;
945
- } ? T
946
- : typeof _PerformanceObserverEntryList;
947
- /**
948
- * `PerformanceResourceTiming` is a global reference for `import { PerformanceResourceTiming } from 'node:perf_hooks'`
949
- * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceresourcetiming
950
- * @since v19.0.0
951
- */
952
- var PerformanceResourceTiming: typeof globalThis extends {
953
- onmessage: any;
954
- PerformanceResourceTiming: infer T;
955
- } ? T
956
- : typeof _PerformanceResourceTiming;
957
- /**
958
- * `performance` is a global reference for `import { performance } from 'node:perf_hooks'`
959
- * @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performance
960
- * @since v16.0.0
961
- */
962
- var performance: typeof globalThis extends {
963
- onmessage: any;
964
- performance: infer T;
965
- } ? T
966
- : typeof _performance;
967
- }
627
+ // TODO: remove these in a future major
628
+ /** @deprecated Use the canonical `PerformanceMarkOptions` instead. */
629
+ interface MarkOptions extends PerformanceMarkOptions {}
630
+ /** @deprecated Use the canonical `PerformanceMeasureOptions` instead. */
631
+ interface MeasureOptions extends PerformanceMeasureOptions {}
632
+ /** @deprecated Use `PerformanceTimerifyOptions` instead. */
633
+ interface TimerifyOptions extends PerformanceTimerifyOptions {}
968
634
  }