@contrast/agent-bundle 5.45.1 → 5.47.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 (189) hide show
  1. package/README.md +1 -1
  2. package/node_modules/@contrast/agent/README.md +1 -1
  3. package/node_modules/@contrast/agent/package.json +12 -12
  4. package/node_modules/@contrast/agentify/package.json +15 -15
  5. package/node_modules/@contrast/architecture-components/package.json +5 -5
  6. package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/common.js +1 -1
  7. package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/handlers.js +24 -11
  8. package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/index.js +6 -4
  9. package/node_modules/@contrast/assess/lib/configuration-analysis/install/apollo-server.js +92 -0
  10. package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/express-session.js +2 -2
  11. package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/fastify-cookie.js +2 -2
  12. package/node_modules/@contrast/assess/lib/configuration-analysis/install/graphql-yoga.js +90 -0
  13. package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/hapi.js +2 -2
  14. package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/koa.js +3 -3
  15. package/node_modules/@contrast/assess/lib/dataflow/propagation/install/string/substring.js +1 -1
  16. package/node_modules/@contrast/assess/lib/dataflow/sources/handler.js +30 -26
  17. package/node_modules/@contrast/assess/lib/dataflow/sources/index.js +2 -0
  18. package/node_modules/@contrast/assess/lib/dataflow/sources/install/fastify-websocket.js +63 -0
  19. package/node_modules/@contrast/assess/lib/dataflow/sources/install/http.js +42 -38
  20. package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/index.js +1 -1
  21. package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-bodyparsers.js +76 -48
  22. package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-multer.js +1 -1
  23. package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-routers.js +2 -2
  24. package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/{koa2.js → koa.js} +3 -3
  25. package/node_modules/@contrast/assess/lib/dataflow/sources/install/socket.io.js +80 -0
  26. package/node_modules/@contrast/assess/lib/get-source-context.js +10 -21
  27. package/node_modules/@contrast/assess/lib/index.d.ts +4 -3
  28. package/node_modules/@contrast/assess/lib/index.js +2 -2
  29. package/node_modules/@contrast/assess/lib/make-source-context.js +5 -10
  30. package/node_modules/@contrast/assess/lib/policy.js +400 -0
  31. package/node_modules/@contrast/assess/lib/response-scanning/handlers/index.js +10 -14
  32. package/node_modules/@contrast/assess/package.json +12 -12
  33. package/node_modules/@contrast/common/lib/constants.d.ts +12 -4
  34. package/node_modules/@contrast/common/lib/constants.js +16 -7
  35. package/node_modules/@contrast/common/lib/types.d.ts +5 -1
  36. package/node_modules/@contrast/common/package.json +1 -1
  37. package/node_modules/@contrast/config/lib/common.js +1 -0
  38. package/node_modules/@contrast/config/lib/options.js +14 -0
  39. package/node_modules/@contrast/config/package.json +3 -3
  40. package/node_modules/@contrast/core/package.json +5 -5
  41. package/node_modules/@contrast/deadzones/package.json +5 -5
  42. package/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +2 -2
  43. package/node_modules/@contrast/dep-hooks/lib/package-finder.js +3 -2
  44. package/node_modules/@contrast/dep-hooks/package.json +4 -4
  45. package/node_modules/@contrast/esm-hooks/README.md +2 -2
  46. package/node_modules/@contrast/esm-hooks/package.json +6 -6
  47. package/node_modules/@contrast/instrumentation/package.json +5 -5
  48. package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +149 -149
  49. package/node_modules/@contrast/library-analysis/lib/install/library-reporting/index.js +2 -11
  50. package/node_modules/@contrast/library-analysis/lib/install/library-reporting/utils.js +2 -0
  51. package/node_modules/@contrast/library-analysis/lib/install/library-usage/index.js +3 -1
  52. package/node_modules/@contrast/library-analysis/lib/util.js +0 -2
  53. package/node_modules/@contrast/library-analysis/package.json +4 -4
  54. package/node_modules/@contrast/logger/package.json +3 -3
  55. package/node_modules/@contrast/metrics/package.json +6 -6
  56. package/node_modules/@contrast/patcher/package.json +2 -2
  57. package/node_modules/@contrast/protect/lib/error-handlers/index.js +1 -1
  58. package/node_modules/@contrast/protect/lib/error-handlers/install/{koa2.js → koa.js} +4 -4
  59. package/node_modules/@contrast/protect/lib/index.d.ts +1 -1
  60. package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +1 -12
  61. package/node_modules/@contrast/protect/lib/input-analysis/index.js +2 -3
  62. package/node_modules/@contrast/protect/lib/input-analysis/install/koa-bodyparsers.js +92 -0
  63. package/node_modules/@contrast/protect/lib/input-analysis/install/{koa2.js → koa.js} +5 -5
  64. package/node_modules/@contrast/protect/package.json +11 -11
  65. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +6 -10
  66. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/routes-observed.js +4 -0
  67. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.d.ts +1 -1
  68. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +1 -1
  69. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.d.ts +1 -1
  70. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +22 -9
  71. package/node_modules/@contrast/reporter/lib/reporters/file.js +1 -1
  72. package/node_modules/@contrast/reporter/package.json +6 -6
  73. package/node_modules/@contrast/rewriter/package.json +5 -5
  74. package/node_modules/@contrast/route-coverage/lib/index.d.ts +0 -2
  75. package/node_modules/@contrast/route-coverage/lib/index.js +10 -1
  76. package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +16 -1
  77. package/node_modules/@contrast/route-coverage/lib/install/fastify.js +25 -15
  78. package/node_modules/@contrast/route-coverage/lib/install/graphql.js +6 -1
  79. package/node_modules/@contrast/route-coverage/lib/install/koa.js +1 -1
  80. package/node_modules/@contrast/route-coverage/lib/install/socket.io.js +127 -0
  81. package/node_modules/@contrast/route-coverage/package.json +8 -8
  82. package/node_modules/@contrast/scopes/package.json +5 -5
  83. package/node_modules/@contrast/sec-obs/package.json +9 -9
  84. package/node_modules/@contrast/sources/lib/index.js +65 -22
  85. package/node_modules/@contrast/sources/lib/index.test.js +78 -33
  86. package/node_modules/@contrast/sources/lib/source-info.js +1 -10
  87. package/node_modules/@contrast/sources/package.json +3 -3
  88. package/node_modules/@contrast/telemetry/package.json +5 -5
  89. package/node_modules/@types/node/README.md +1 -1
  90. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  91. package/node_modules/@types/node/assert.d.ts +154 -95
  92. package/node_modules/@types/node/buffer.buffer.d.ts +9 -0
  93. package/node_modules/@types/node/buffer.d.ts +8 -4
  94. package/node_modules/@types/node/child_process.d.ts +65 -42
  95. package/node_modules/@types/node/cluster.d.ts +4 -5
  96. package/node_modules/@types/node/crypto.d.ts +1173 -322
  97. package/node_modules/@types/node/dgram.d.ts +9 -8
  98. package/node_modules/@types/node/diagnostics_channel.d.ts +0 -2
  99. package/node_modules/@types/node/dns.d.ts +1 -1
  100. package/node_modules/@types/node/events.d.ts +80 -34
  101. package/node_modules/@types/node/fs/promises.d.ts +39 -21
  102. package/node_modules/@types/node/fs.d.ts +328 -87
  103. package/node_modules/@types/node/globals.d.ts +2 -0
  104. package/node_modules/@types/node/globals.typedarray.d.ts +19 -0
  105. package/node_modules/@types/node/http.d.ts +94 -30
  106. package/node_modules/@types/node/http2.d.ts +178 -52
  107. package/node_modules/@types/node/https.d.ts +91 -62
  108. package/node_modules/@types/node/index.d.ts +2 -0
  109. package/node_modules/@types/node/inspector.d.ts +24 -0
  110. package/node_modules/@types/node/inspector.generated.d.ts +181 -0
  111. package/node_modules/@types/node/net.d.ts +12 -11
  112. package/node_modules/@types/node/os.d.ts +14 -3
  113. package/node_modules/@types/node/package.json +3 -3
  114. package/node_modules/@types/node/perf_hooks.d.ts +6 -8
  115. package/node_modules/@types/node/process.d.ts +12 -23
  116. package/node_modules/@types/node/readline/promises.d.ts +1 -1
  117. package/node_modules/@types/node/sea.d.ts +9 -0
  118. package/node_modules/@types/node/sqlite.d.ts +119 -10
  119. package/node_modules/@types/node/stream/consumers.d.ts +2 -2
  120. package/node_modules/@types/node/stream/web.d.ts +6 -55
  121. package/node_modules/@types/node/stream.d.ts +38 -23
  122. package/node_modules/@types/node/string_decoder.d.ts +2 -2
  123. package/node_modules/@types/node/test.d.ts +31 -26
  124. package/node_modules/@types/node/tls.d.ts +90 -66
  125. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +10 -2
  126. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +16 -0
  127. package/node_modules/@types/node/ts5.6/index.d.ts +2 -0
  128. package/node_modules/@types/node/ts5.7/index.d.ts +2 -0
  129. package/node_modules/@types/node/url.d.ts +8 -3
  130. package/node_modules/@types/node/util.d.ts +17 -3
  131. package/node_modules/@types/node/v8.d.ts +38 -5
  132. package/node_modules/@types/node/vm.d.ts +169 -88
  133. package/node_modules/@types/node/wasi.d.ts +1 -1
  134. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  135. package/node_modules/@types/node/web-globals/events.d.ts +3 -0
  136. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  137. package/node_modules/@types/node/worker_threads.d.ts +109 -48
  138. package/node_modules/@types/node/zlib.d.ts +31 -24
  139. package/node_modules/axios/CHANGELOG.md +403 -357
  140. package/node_modules/axios/README.md +80 -49
  141. package/node_modules/axios/dist/axios.js +121 -46
  142. package/node_modules/axios/dist/axios.js.map +1 -1
  143. package/node_modules/axios/dist/axios.min.js +2 -2
  144. package/node_modules/axios/dist/axios.min.js.map +1 -1
  145. package/node_modules/axios/dist/browser/axios.cjs +126 -57
  146. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  147. package/node_modules/axios/dist/esm/axios.js +126 -57
  148. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  149. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  150. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  151. package/node_modules/axios/dist/node/axios.cjs +346 -97
  152. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  153. package/node_modules/axios/index.d.cts +4 -0
  154. package/node_modules/axios/index.d.ts +4 -0
  155. package/node_modules/axios/lib/adapters/adapters.js +85 -40
  156. package/node_modules/axios/lib/adapters/fetch.js +1 -1
  157. package/node_modules/axios/lib/adapters/http.js +220 -42
  158. package/node_modules/axios/lib/core/InterceptorManager.js +1 -1
  159. package/node_modules/axios/lib/core/mergeConfig.js +4 -4
  160. package/node_modules/axios/lib/env/data.js +1 -1
  161. package/node_modules/axios/lib/helpers/HttpStatusCode.js +6 -0
  162. package/node_modules/axios/lib/helpers/bind.js +7 -0
  163. package/node_modules/axios/lib/helpers/cookies.js +24 -13
  164. package/node_modules/axios/package.json +9 -4
  165. package/node_modules/detect-libc/lib/filesystem.js +1 -1
  166. package/node_modules/detect-libc/package.json +3 -1
  167. package/node_modules/node-abi/abi_registry.json +12 -2
  168. package/node_modules/node-abi/package.json +3 -6
  169. package/node_modules/semver/classes/range.js +1 -0
  170. package/node_modules/semver/classes/semver.js +19 -5
  171. package/node_modules/semver/internal/identifiers.js +4 -0
  172. package/node_modules/semver/package.json +3 -3
  173. package/node_modules/undici-types/agent.d.ts +1 -4
  174. package/node_modules/undici-types/client.d.ts +0 -2
  175. package/node_modules/undici-types/diagnostics-channel.d.ts +0 -1
  176. package/node_modules/undici-types/dispatcher.d.ts +0 -6
  177. package/node_modules/undici-types/errors.d.ts +5 -15
  178. package/node_modules/undici-types/eventsource.d.ts +6 -1
  179. package/node_modules/undici-types/h2c-client.d.ts +0 -2
  180. package/node_modules/undici-types/index.d.ts +6 -1
  181. package/node_modules/undici-types/interceptors.d.ts +5 -0
  182. package/node_modules/undici-types/mock-interceptor.d.ts +0 -1
  183. package/node_modules/undici-types/package.json +1 -1
  184. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  185. package/node_modules/undici-types/webidl.d.ts +82 -21
  186. package/package.json +3 -3
  187. package/node_modules/@contrast/assess/lib/get-policy.js +0 -336
  188. package/node_modules/@contrast/protect/lib/input-analysis/install/koa-body5.js +0 -63
  189. package/node_modules/@contrast/protect/lib/input-analysis/install/koa-bodyparser4.js +0 -64
@@ -0,0 +1,22 @@
1
+ export {};
2
+
3
+ import * as webstreams from "stream/web";
4
+
5
+ type _CompressionStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.CompressionStream;
6
+ type _DecompressionStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.DecompressionStream;
7
+
8
+ declare global {
9
+ interface CompressionStream extends _CompressionStream {}
10
+ var CompressionStream: typeof globalThis extends {
11
+ onmessage: any;
12
+ CompressionStream: infer T;
13
+ } ? T
14
+ : typeof webstreams.CompressionStream;
15
+
16
+ interface DecompressionStream extends _DecompressionStream {}
17
+ var DecompressionStream: typeof globalThis extends {
18
+ onmessage: any;
19
+ DecompressionStream: infer T;
20
+ } ? T
21
+ : typeof webstreams.DecompressionStream;
22
+ }
@@ -56,13 +56,13 @@
56
56
  */
57
57
  declare module "worker_threads" {
58
58
  import { Context } from "node:vm";
59
- import { EventEmitter } from "node:events";
59
+ import { EventEmitter, NodeEventTarget } from "node:events";
60
60
  import { EventLoopUtilityFunction } from "node:perf_hooks";
61
61
  import { FileHandle } from "node:fs/promises";
62
62
  import { Readable, Writable } from "node:stream";
63
63
  import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
64
64
  import { URL } from "node:url";
65
- import { HeapInfo } from "node:v8";
65
+ import { CPUProfileHandle, HeapInfo, HeapProfileHandle } from "node:v8";
66
66
  import { MessageEvent } from "undici-types";
67
67
  const isInternalThread: boolean;
68
68
  const isMainThread: boolean;
@@ -70,6 +70,7 @@ declare module "worker_threads" {
70
70
  const resourceLimits: ResourceLimits;
71
71
  const SHARE_ENV: unique symbol;
72
72
  const threadId: number;
73
+ const threadName: string | null;
73
74
  const workerData: any;
74
75
  /**
75
76
  * Instances of the `worker.MessageChannel` class represent an asynchronous,
@@ -112,7 +113,7 @@ declare module "worker_threads" {
112
113
  * This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
113
114
  * @since v10.5.0
114
115
  */
115
- class MessagePort extends EventEmitter {
116
+ class MessagePort implements EventTarget {
116
117
  /**
117
118
  * Disables further sending of messages on either side of the connection.
118
119
  * This method can be called when no further communication will happen over this `MessagePort`.
@@ -225,42 +226,32 @@ declare module "worker_threads" {
225
226
  * @since v10.5.0
226
227
  */
227
228
  start(): void;
228
- addListener(event: "close", listener: () => void): this;
229
+ addListener(event: "close", listener: (ev: Event) => void): this;
229
230
  addListener(event: "message", listener: (value: any) => void): this;
230
231
  addListener(event: "messageerror", listener: (error: Error) => void): this;
231
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
232
- emit(event: "close"): boolean;
232
+ addListener(event: string, listener: (arg: any) => void): this;
233
+ emit(event: "close", ev: Event): boolean;
233
234
  emit(event: "message", value: any): boolean;
234
235
  emit(event: "messageerror", error: Error): boolean;
235
- emit(event: string | symbol, ...args: any[]): boolean;
236
- on(event: "close", listener: () => void): this;
236
+ emit(event: string, arg: any): boolean;
237
+ off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
238
+ off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
239
+ off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
240
+ off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
241
+ on(event: "close", listener: (ev: Event) => void): this;
237
242
  on(event: "message", listener: (value: any) => void): this;
238
243
  on(event: "messageerror", listener: (error: Error) => void): this;
239
- on(event: string | symbol, listener: (...args: any[]) => void): this;
240
- once(event: "close", listener: () => void): this;
244
+ on(event: string, listener: (arg: any) => void): this;
245
+ once(event: "close", listener: (ev: Event) => void): this;
241
246
  once(event: "message", listener: (value: any) => void): this;
242
247
  once(event: "messageerror", listener: (error: Error) => void): this;
243
- once(event: string | symbol, listener: (...args: any[]) => void): this;
244
- prependListener(event: "close", listener: () => void): this;
245
- prependListener(event: "message", listener: (value: any) => void): this;
246
- prependListener(event: "messageerror", listener: (error: Error) => void): this;
247
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
248
- prependOnceListener(event: "close", listener: () => void): this;
249
- prependOnceListener(event: "message", listener: (value: any) => void): this;
250
- prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
251
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
252
- removeListener(event: "close", listener: () => void): this;
253
- removeListener(event: "message", listener: (value: any) => void): this;
254
- removeListener(event: "messageerror", listener: (error: Error) => void): this;
255
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
256
- off(event: "close", listener: () => void): this;
257
- off(event: "message", listener: (value: any) => void): this;
258
- off(event: "messageerror", listener: (error: Error) => void): this;
259
- off(event: string | symbol, listener: (...args: any[]) => void): this;
260
- addEventListener: EventTarget["addEventListener"];
261
- dispatchEvent: EventTarget["dispatchEvent"];
262
- removeEventListener: EventTarget["removeEventListener"];
248
+ once(event: string, listener: (arg: any) => void): this;
249
+ removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
250
+ removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
251
+ removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
252
+ removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
263
253
  }
254
+ interface MessagePort extends NodeEventTarget {}
264
255
  interface WorkerOptions {
265
256
  /**
266
257
  * List of arguments which would be stringified and appended to
@@ -402,6 +393,12 @@ declare module "worker_threads" {
402
393
  * @since v10.5.0
403
394
  */
404
395
  readonly threadId: number;
396
+ /**
397
+ * A string identifier for the referenced thread or null if the thread is not running.
398
+ * Inside the worker thread, it is available as `require('node:worker_threads').threadName`.
399
+ * @since v24.6.0
400
+ */
401
+ readonly threadName: string | null;
405
402
  /**
406
403
  * Provides the set of JS engine resource constraints for this Worker thread.
407
404
  * If the `resourceLimits` option was passed to the `Worker` constructor,
@@ -429,24 +426,6 @@ declare module "worker_threads" {
429
426
  * @since v10.5.0
430
427
  */
431
428
  postMessage(value: any, transferList?: readonly Transferable[]): void;
432
- /**
433
- * Sends a value to another worker, identified by its thread ID.
434
- * @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
435
- * If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
436
- * @param value The value to send.
437
- * @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
438
- * or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
439
- * @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
440
- * If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
441
- * @since v22.5.0
442
- */
443
- postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
444
- postMessageToThread(
445
- threadId: number,
446
- value: any,
447
- transferList: readonly Transferable[],
448
- timeout?: number,
449
- ): Promise<void>;
450
429
  /**
451
430
  * Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
452
431
  * behavior). If the worker is `ref()`ed, calling `ref()` again has
@@ -466,6 +445,13 @@ declare module "worker_threads" {
466
445
  * @since v10.5.0
467
446
  */
468
447
  terminate(): Promise<number>;
448
+ /**
449
+ * This method returns a `Promise` that will resolve to an object identical to `process.threadCpuUsage()`,
450
+ * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
451
+ * This methods allows the statistics to be observed from outside the actual thread.
452
+ * @since v24.6.0
453
+ */
454
+ cpuUsage(prev?: NodeJS.CpuUsage): Promise<NodeJS.CpuUsage>;
469
455
  /**
470
456
  * Returns a readable stream for a V8 snapshot of the current state of the Worker.
471
457
  * See `v8.getHeapSnapshot()` for more details.
@@ -483,6 +469,81 @@ declare module "worker_threads" {
483
469
  * @since v24.0.0
484
470
  */
485
471
  getHeapStatistics(): Promise<HeapInfo>;
472
+ /**
473
+ * Starting a CPU profile then return a Promise that fulfills with an error
474
+ * or an `CPUProfileHandle` object. This API supports `await using` syntax.
475
+ *
476
+ * ```js
477
+ * const { Worker } = require('node:worker_threads');
478
+ *
479
+ * const worker = new Worker(`
480
+ * const { parentPort } = require('worker_threads');
481
+ * parentPort.on('message', () => {});
482
+ * `, { eval: true });
483
+ *
484
+ * worker.on('online', async () => {
485
+ * const handle = await worker.startCpuProfile();
486
+ * const profile = await handle.stop();
487
+ * console.log(profile);
488
+ * worker.terminate();
489
+ * });
490
+ * ```
491
+ *
492
+ * `await using` example.
493
+ *
494
+ * ```js
495
+ * const { Worker } = require('node:worker_threads');
496
+ *
497
+ * const w = new Worker(`
498
+ * const { parentPort } = require('node:worker_threads');
499
+ * parentPort.on('message', () => {});
500
+ * `, { eval: true });
501
+ *
502
+ * w.on('online', async () => {
503
+ * // Stop profile automatically when return and profile will be discarded
504
+ * await using handle = await w.startCpuProfile();
505
+ * });
506
+ * ```
507
+ * @since v24.8.0
508
+ */
509
+ startCpuProfile(): Promise<CPUProfileHandle>;
510
+ /**
511
+ * Starting a Heap profile then return a Promise that fulfills with an error
512
+ * or an `HeapProfileHandle` object. This API supports `await using` syntax.
513
+ *
514
+ * ```js
515
+ * const { Worker } = require('node:worker_threads');
516
+ *
517
+ * const worker = new Worker(`
518
+ * const { parentPort } = require('worker_threads');
519
+ * parentPort.on('message', () => {});
520
+ * `, { eval: true });
521
+ *
522
+ * worker.on('online', async () => {
523
+ * const handle = await worker.startHeapProfile();
524
+ * const profile = await handle.stop();
525
+ * console.log(profile);
526
+ * worker.terminate();
527
+ * });
528
+ * ```
529
+ *
530
+ * `await using` example.
531
+ *
532
+ * ```js
533
+ * const { Worker } = require('node:worker_threads');
534
+ *
535
+ * const w = new Worker(`
536
+ * const { parentPort } = require('node:worker_threads');
537
+ * parentPort.on('message', () => {});
538
+ * `, { eval: true });
539
+ *
540
+ * w.on('online', async () => {
541
+ * // Stop profile automatically when return and profile will be discarded
542
+ * await using handle = await w.startHeapProfile();
543
+ * });
544
+ * ```
545
+ */
546
+ startHeapProfile(): Promise<HeapProfileHandle>;
486
547
  /**
487
548
  * Calls `worker.terminate()` when the dispose scope is exited.
488
549
  *
@@ -92,6 +92,7 @@
92
92
  * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/zlib.js)
93
93
  */
94
94
  declare module "zlib" {
95
+ import { NonSharedBuffer } from "node:buffer";
95
96
  import * as stream from "node:stream";
96
97
  interface ZlibOptions {
97
98
  /**
@@ -180,6 +181,12 @@ declare module "zlib" {
180
181
  * If `true`, returns an object with `buffer` and `engine`.
181
182
  */
182
183
  info?: boolean | undefined;
184
+ /**
185
+ * Optional dictionary used to improve compression efficiency when compressing or decompressing data that
186
+ * shares common patterns with the dictionary.
187
+ * @since v24.6.0
188
+ */
189
+ dictionary?: NodeJS.ArrayBufferView | undefined;
183
190
  }
184
191
  interface Zlib {
185
192
  readonly bytesWritten: number;
@@ -221,7 +228,7 @@ declare module "zlib" {
221
228
  * @returns A 32-bit unsigned integer containing the checksum.
222
229
  * @since v22.2.0
223
230
  */
224
- function crc32(data: string | Buffer | NodeJS.ArrayBufferView, value?: number): number;
231
+ function crc32(data: string | NodeJS.ArrayBufferView, value?: number): number;
225
232
  /**
226
233
  * Creates and returns a new `BrotliCompress` object.
227
234
  * @since v11.7.0, v10.16.0
@@ -285,124 +292,124 @@ declare module "zlib" {
285
292
  */
286
293
  function createZstdDecompress(options?: ZstdOptions): ZstdDecompress;
287
294
  type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
288
- type CompressCallback = (error: Error | null, result: Buffer) => void;
295
+ type CompressCallback = (error: Error | null, result: NonSharedBuffer) => void;
289
296
  /**
290
297
  * @since v11.7.0, v10.16.0
291
298
  */
292
299
  function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
293
300
  function brotliCompress(buf: InputType, callback: CompressCallback): void;
294
301
  namespace brotliCompress {
295
- function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
302
+ function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
296
303
  }
297
304
  /**
298
305
  * Compress a chunk of data with `BrotliCompress`.
299
306
  * @since v11.7.0, v10.16.0
300
307
  */
301
- function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer;
308
+ function brotliCompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
302
309
  /**
303
310
  * @since v11.7.0, v10.16.0
304
311
  */
305
312
  function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
306
313
  function brotliDecompress(buf: InputType, callback: CompressCallback): void;
307
314
  namespace brotliDecompress {
308
- function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
315
+ function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
309
316
  }
310
317
  /**
311
318
  * Decompress a chunk of data with `BrotliDecompress`.
312
319
  * @since v11.7.0, v10.16.0
313
320
  */
314
- function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer;
321
+ function brotliDecompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
315
322
  /**
316
323
  * @since v0.6.0
317
324
  */
318
325
  function deflate(buf: InputType, callback: CompressCallback): void;
319
326
  function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
320
327
  namespace deflate {
321
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
328
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
322
329
  }
323
330
  /**
324
331
  * Compress a chunk of data with `Deflate`.
325
332
  * @since v0.11.12
326
333
  */
327
- function deflateSync(buf: InputType, options?: ZlibOptions): Buffer;
334
+ function deflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
328
335
  /**
329
336
  * @since v0.6.0
330
337
  */
331
338
  function deflateRaw(buf: InputType, callback: CompressCallback): void;
332
339
  function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
333
340
  namespace deflateRaw {
334
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
341
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
335
342
  }
336
343
  /**
337
344
  * Compress a chunk of data with `DeflateRaw`.
338
345
  * @since v0.11.12
339
346
  */
340
- function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
347
+ function deflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
341
348
  /**
342
349
  * @since v0.6.0
343
350
  */
344
351
  function gzip(buf: InputType, callback: CompressCallback): void;
345
352
  function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
346
353
  namespace gzip {
347
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
354
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
348
355
  }
349
356
  /**
350
357
  * Compress a chunk of data with `Gzip`.
351
358
  * @since v0.11.12
352
359
  */
353
- function gzipSync(buf: InputType, options?: ZlibOptions): Buffer;
360
+ function gzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
354
361
  /**
355
362
  * @since v0.6.0
356
363
  */
357
364
  function gunzip(buf: InputType, callback: CompressCallback): void;
358
365
  function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
359
366
  namespace gunzip {
360
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
367
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
361
368
  }
362
369
  /**
363
370
  * Decompress a chunk of data with `Gunzip`.
364
371
  * @since v0.11.12
365
372
  */
366
- function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer;
373
+ function gunzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
367
374
  /**
368
375
  * @since v0.6.0
369
376
  */
370
377
  function inflate(buf: InputType, callback: CompressCallback): void;
371
378
  function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
372
379
  namespace inflate {
373
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
380
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
374
381
  }
375
382
  /**
376
383
  * Decompress a chunk of data with `Inflate`.
377
384
  * @since v0.11.12
378
385
  */
379
- function inflateSync(buf: InputType, options?: ZlibOptions): Buffer;
386
+ function inflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
380
387
  /**
381
388
  * @since v0.6.0
382
389
  */
383
390
  function inflateRaw(buf: InputType, callback: CompressCallback): void;
384
391
  function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
385
392
  namespace inflateRaw {
386
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
393
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
387
394
  }
388
395
  /**
389
396
  * Decompress a chunk of data with `InflateRaw`.
390
397
  * @since v0.11.12
391
398
  */
392
- function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
399
+ function inflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
393
400
  /**
394
401
  * @since v0.6.0
395
402
  */
396
403
  function unzip(buf: InputType, callback: CompressCallback): void;
397
404
  function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
398
405
  namespace unzip {
399
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
406
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
400
407
  }
401
408
  /**
402
409
  * Decompress a chunk of data with `Unzip`.
403
410
  * @since v0.11.12
404
411
  */
405
- function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
412
+ function unzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
406
413
  /**
407
414
  * @since v22.15.0
408
415
  * @experimental
@@ -410,14 +417,14 @@ declare module "zlib" {
410
417
  function zstdCompress(buf: InputType, callback: CompressCallback): void;
411
418
  function zstdCompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
412
419
  namespace zstdCompress {
413
- function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
420
+ function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
414
421
  }
415
422
  /**
416
423
  * Compress a chunk of data with `ZstdCompress`.
417
424
  * @since v22.15.0
418
425
  * @experimental
419
426
  */
420
- function zstdCompressSync(buf: InputType, options?: ZstdOptions): Buffer;
427
+ function zstdCompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
421
428
  /**
422
429
  * @since v22.15.0
423
430
  * @experimental
@@ -425,14 +432,14 @@ declare module "zlib" {
425
432
  function zstdDecompress(buf: InputType, callback: CompressCallback): void;
426
433
  function zstdDecompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
427
434
  namespace zstdDecompress {
428
- function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
435
+ function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
429
436
  }
430
437
  /**
431
438
  * Decompress a chunk of data with `ZstdDecompress`.
432
439
  * @since v22.15.0
433
440
  * @experimental
434
441
  */
435
- function zstdDecompressSync(buf: InputType, options?: ZstdOptions): Buffer;
442
+ function zstdDecompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
436
443
  namespace constants {
437
444
  const BROTLI_DECODE: number;
438
445
  const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;