@chainlink/external-adapter-framework 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/adapter/basic.js +21 -4
- package/adapter/basic.js.map +1 -1
- package/adapter/endpoint.js +13 -0
- package/adapter/endpoint.js.map +1 -1
- package/adapter/por.js +6 -6
- package/adapter/por.js.map +1 -1
- package/adapter/price.js +1 -0
- package/adapter/price.js.map +1 -1
- package/cache/local.js +5 -1
- package/cache/local.js.map +1 -1
- package/cache/redis.js +3 -1
- package/cache/redis.js.map +1 -1
- package/cache/response.js +5 -0
- package/cache/response.js.map +1 -1
- package/config/index.js +9 -6
- package/config/index.js.map +1 -1
- package/generator-adapter/node_modules/.yarn-integrity +4 -4
- package/generator-adapter/node_modules/@types/node/README.md +3 -3
- package/generator-adapter/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/generator-adapter/node_modules/@types/node/assert.d.ts +162 -101
- package/generator-adapter/node_modules/@types/node/async_hooks.d.ts +25 -5
- package/generator-adapter/node_modules/@types/node/buffer.buffer.d.ts +9 -0
- package/generator-adapter/node_modules/@types/node/buffer.d.ts +9 -5
- package/generator-adapter/node_modules/@types/node/child_process.d.ts +67 -44
- package/generator-adapter/node_modules/@types/node/cluster.d.ts +19 -20
- package/generator-adapter/node_modules/@types/node/compatibility/iterators.d.ts +1 -0
- package/generator-adapter/node_modules/@types/node/console.d.ts +19 -18
- package/generator-adapter/node_modules/@types/node/crypto.d.ts +1247 -355
- package/generator-adapter/node_modules/@types/node/dgram.d.ts +10 -9
- package/generator-adapter/node_modules/@types/node/diagnostics_channel.d.ts +1 -3
- package/generator-adapter/node_modules/@types/node/dns/promises.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/dns.d.ts +23 -18
- package/generator-adapter/node_modules/@types/node/domain.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/events.d.ts +81 -35
- package/generator-adapter/node_modules/@types/node/fs/promises.d.ts +62 -22
- package/generator-adapter/node_modules/@types/node/fs.d.ts +364 -98
- package/generator-adapter/node_modules/@types/node/globals.d.ts +4 -4
- package/generator-adapter/node_modules/@types/node/globals.typedarray.d.ts +20 -0
- package/generator-adapter/node_modules/@types/node/http.d.ts +120 -32
- package/generator-adapter/node_modules/@types/node/http2.d.ts +185 -65
- package/generator-adapter/node_modules/@types/node/https.d.ts +92 -63
- package/generator-adapter/node_modules/@types/node/index.d.ts +10 -5
- package/generator-adapter/node_modules/@types/node/inspector.d.ts +277 -0
- package/generator-adapter/node_modules/@types/node/inspector.generated.d.ts +908 -886
- package/generator-adapter/node_modules/@types/node/module.d.ts +21 -18
- package/generator-adapter/node_modules/@types/node/net.d.ts +35 -16
- package/generator-adapter/node_modules/@types/node/os.d.ts +22 -10
- package/generator-adapter/node_modules/@types/node/package.json +13 -3
- package/generator-adapter/node_modules/@types/node/path.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/perf_hooks.d.ts +28 -16
- package/generator-adapter/node_modules/@types/node/process.d.ts +30 -30
- package/generator-adapter/node_modules/@types/node/punycode.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/querystring.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/readline.d.ts +13 -13
- package/generator-adapter/node_modules/@types/node/repl.d.ts +23 -13
- package/generator-adapter/node_modules/@types/node/sea.d.ts +10 -1
- package/generator-adapter/node_modules/@types/node/sqlite.d.ts +245 -23
- package/generator-adapter/node_modules/@types/node/stream/consumers.d.ts +2 -2
- package/generator-adapter/node_modules/@types/node/stream/web.d.ts +6 -55
- package/generator-adapter/node_modules/@types/node/stream.d.ts +63 -37
- package/generator-adapter/node_modules/@types/node/string_decoder.d.ts +3 -3
- package/generator-adapter/node_modules/@types/node/test.d.ts +196 -40
- package/generator-adapter/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/timers.d.ts +1 -3
- package/generator-adapter/node_modules/@types/node/tls.d.ts +124 -114
- package/generator-adapter/node_modules/@types/node/trace_events.d.ts +6 -6
- package/generator-adapter/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +10 -2
- package/generator-adapter/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/generator-adapter/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +17 -0
- package/generator-adapter/node_modules/@types/node/ts5.6/index.d.ts +12 -5
- package/generator-adapter/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/generator-adapter/node_modules/@types/node/ts5.7/index.d.ts +103 -0
- package/generator-adapter/node_modules/@types/node/tty.d.ts +1 -1
- package/generator-adapter/node_modules/@types/node/url.d.ts +109 -33
- package/generator-adapter/node_modules/@types/node/util.d.ts +31 -305
- package/generator-adapter/node_modules/@types/node/v8.d.ts +41 -8
- package/generator-adapter/node_modules/@types/node/vm.d.ts +258 -107
- package/generator-adapter/node_modules/@types/node/wasi.d.ts +23 -2
- package/generator-adapter/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
- package/generator-adapter/node_modules/@types/node/web-globals/events.d.ts +3 -0
- package/generator-adapter/node_modules/@types/node/web-globals/fetch.d.ts +4 -0
- package/generator-adapter/node_modules/@types/node/web-globals/navigator.d.ts +3 -0
- package/generator-adapter/node_modules/@types/node/web-globals/streams.d.ts +22 -0
- package/generator-adapter/node_modules/@types/node/worker_threads.d.ts +142 -51
- package/generator-adapter/node_modules/@types/node/zlib.d.ts +36 -31
- package/generator-adapter/node_modules/undici-types/agent.d.ts +12 -11
- package/generator-adapter/node_modules/undici-types/api.d.ts +24 -24
- package/generator-adapter/node_modules/undici-types/balanced-pool.d.ts +11 -11
- package/generator-adapter/node_modules/undici-types/cache-interceptor.d.ts +172 -0
- package/generator-adapter/node_modules/undici-types/client-stats.d.ts +15 -0
- package/generator-adapter/node_modules/undici-types/client.d.ts +18 -18
- package/generator-adapter/node_modules/undici-types/cookies.d.ts +2 -0
- package/generator-adapter/node_modules/undici-types/diagnostics-channel.d.ts +18 -10
- package/generator-adapter/node_modules/undici-types/dispatcher.d.ts +119 -99
- package/generator-adapter/node_modules/undici-types/env-http-proxy-agent.d.ts +4 -3
- package/generator-adapter/node_modules/undici-types/errors.d.ts +66 -54
- package/generator-adapter/node_modules/undici-types/eventsource.d.ts +9 -4
- package/generator-adapter/node_modules/undici-types/fetch.d.ts +18 -16
- package/generator-adapter/node_modules/undici-types/formdata.d.ts +7 -7
- package/generator-adapter/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/generator-adapter/node_modules/undici-types/global-origin.d.ts +5 -5
- package/generator-adapter/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/generator-adapter/node_modules/undici-types/handlers.d.ts +8 -8
- package/generator-adapter/node_modules/undici-types/header.d.ts +157 -1
- package/generator-adapter/node_modules/undici-types/index.d.ts +56 -47
- package/generator-adapter/node_modules/undici-types/interceptors.d.ts +30 -8
- package/generator-adapter/node_modules/undici-types/mock-agent.d.ts +36 -18
- package/generator-adapter/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/generator-adapter/node_modules/undici-types/mock-client.d.ts +6 -4
- package/generator-adapter/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/generator-adapter/node_modules/undici-types/mock-interceptor.d.ts +21 -20
- package/generator-adapter/node_modules/undici-types/mock-pool.d.ts +6 -4
- package/generator-adapter/node_modules/undici-types/package.json +1 -1
- package/generator-adapter/node_modules/undici-types/patch.d.ts +0 -4
- package/generator-adapter/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/generator-adapter/node_modules/undici-types/pool.d.ts +14 -12
- package/generator-adapter/node_modules/undici-types/proxy-agent.d.ts +5 -4
- package/generator-adapter/node_modules/undici-types/readable.d.ts +18 -15
- package/generator-adapter/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/generator-adapter/node_modules/undici-types/retry-handler.d.ts +19 -10
- package/generator-adapter/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/generator-adapter/node_modules/undici-types/util.d.ts +3 -3
- package/generator-adapter/node_modules/undici-types/utility.d.ts +7 -0
- package/generator-adapter/node_modules/undici-types/webidl.d.ts +142 -29
- package/generator-adapter/node_modules/undici-types/websocket.d.ts +38 -2
- package/generator-adapter/package.json +1 -1
- package/metrics/index.js +3 -0
- package/metrics/index.js.map +1 -1
- package/package.json +8 -8
- package/rate-limiting/burst.js +6 -6
- package/rate-limiting/burst.js.map +1 -1
- package/rate-limiting/fixed-interval.js +2 -3
- package/rate-limiting/fixed-interval.js.map +1 -1
- package/transports/abstract/streaming.js +7 -10
- package/transports/abstract/streaming.js.map +1 -1
- package/transports/abstract/subscription.js +4 -0
- package/transports/abstract/subscription.js.map +1 -1
- package/transports/http.js +5 -3
- package/transports/http.js.map +1 -1
- package/transports/index.js +1 -3
- package/transports/index.js.map +1 -1
- package/transports/sse.js +6 -2
- package/transports/sse.js.map +1 -1
- package/transports/websocket.d.ts +9 -1
- package/transports/websocket.js +25 -13
- package/transports/websocket.js.map +1 -1
- package/util/censor/censor-list.js +1 -1
- package/util/censor/censor-list.js.map +1 -1
- package/util/group-runner.js +3 -2
- package/util/group-runner.js.map +1 -1
- package/util/index.js +8 -1
- package/util/index.js.map +1 -1
- package/util/logger.js +8 -1
- package/util/logger.js.map +1 -1
- package/util/requester.js +11 -3
- package/util/requester.js.map +1 -1
- package/util/subscription-set/expiring-sorted-set.js +3 -0
- package/util/subscription-set/expiring-sorted-set.js.map +1 -1
- package/util/subscription-set/redis-sorted-set.js +3 -0
- package/util/subscription-set/redis-sorted-set.js.map +1 -1
- package/util/subscription-set/subscription-set.js +5 -0
- package/util/subscription-set/subscription-set.js.map +1 -1
- package/util/testing-utils.js +13 -6
- package/util/testing-utils.js.map +1 -1
- package/validation/error.js +13 -0
- package/validation/error.js.map +1 -1
- package/validation/input-params.js +14 -0
- package/validation/input-params.js.map +1 -1
- package/generator-adapter/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
- package/generator-adapter/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/generator-adapter/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
- package/generator-adapter/node_modules/undici-types/file.d.ts +0 -39
- package/generator-adapter/node_modules/undici-types/filereader.d.ts +0 -54
|
@@ -51,6 +51,7 @@ interface EventListenerObject {
|
|
|
51
51
|
handleEvent(object: Event): void;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
type _EventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : EventListenerOptions;
|
|
54
55
|
interface EventListenerOptions {
|
|
55
56
|
capture?: boolean;
|
|
56
57
|
}
|
|
@@ -85,6 +86,8 @@ declare global {
|
|
|
85
86
|
new(type: string, eventInitDict?: EventInit): Event;
|
|
86
87
|
};
|
|
87
88
|
|
|
89
|
+
interface EventListenerOptions extends _EventListenerOptions {}
|
|
90
|
+
|
|
88
91
|
interface EventTarget extends _EventTarget {}
|
|
89
92
|
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
|
|
90
93
|
: {
|
|
@@ -2,6 +2,7 @@ export {};
|
|
|
2
2
|
|
|
3
3
|
import * as undici from "undici-types";
|
|
4
4
|
|
|
5
|
+
type _CloseEvent = typeof globalThis extends { onmessage: any } ? {} : undici.CloseEvent;
|
|
5
6
|
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : undici.EventSource;
|
|
6
7
|
type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
|
|
7
8
|
type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
|
|
@@ -18,6 +19,9 @@ declare global {
|
|
|
18
19
|
init?: RequestInit,
|
|
19
20
|
): Promise<Response>;
|
|
20
21
|
|
|
22
|
+
interface CloseEvent extends _CloseEvent {}
|
|
23
|
+
var CloseEvent: typeof globalThis extends { onmessage: any; CloseEvent: infer T } ? T : typeof undici.CloseEvent;
|
|
24
|
+
|
|
21
25
|
interface EventSource extends _EventSource {}
|
|
22
26
|
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof undici.EventSource;
|
|
23
27
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export {};
|
|
2
2
|
|
|
3
|
+
import { LockManager } from "worker_threads";
|
|
4
|
+
|
|
3
5
|
// lib.webworker has `WorkerNavigator` rather than `Navigator`, so conditionals use `onabort` instead of `onmessage`
|
|
4
6
|
type _Navigator = typeof globalThis extends { onabort: any } ? {} : Navigator;
|
|
5
7
|
interface Navigator {
|
|
6
8
|
readonly hardwareConcurrency: number;
|
|
7
9
|
readonly language: string;
|
|
8
10
|
readonly languages: readonly string[];
|
|
11
|
+
readonly locks: LockManager;
|
|
9
12
|
readonly platform: string;
|
|
10
13
|
readonly userAgent: string;
|
|
11
14
|
}
|
|
@@ -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
|
+
}
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
*
|
|
53
53
|
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
|
|
54
54
|
* specifically `argv` and `execArgv` options.
|
|
55
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
55
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/worker_threads.js)
|
|
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,
|
|
@@ -102,6 +103,7 @@ declare module "worker_threads" {
|
|
|
102
103
|
| WritableStream
|
|
103
104
|
| TransformStream;
|
|
104
105
|
/** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
|
|
106
|
+
// TODO: remove in a future major @types/node version.
|
|
105
107
|
type TransferListItem = Transferable;
|
|
106
108
|
/**
|
|
107
109
|
* Instances of the `worker.MessagePort` class represent one end of an
|
|
@@ -111,7 +113,7 @@ declare module "worker_threads" {
|
|
|
111
113
|
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
|
|
112
114
|
* @since v10.5.0
|
|
113
115
|
*/
|
|
114
|
-
class MessagePort
|
|
116
|
+
class MessagePort implements EventTarget {
|
|
115
117
|
/**
|
|
116
118
|
* Disables further sending of messages on either side of the connection.
|
|
117
119
|
* This method can be called when no further communication will happen over this `MessagePort`.
|
|
@@ -224,42 +226,32 @@ declare module "worker_threads" {
|
|
|
224
226
|
* @since v10.5.0
|
|
225
227
|
*/
|
|
226
228
|
start(): void;
|
|
227
|
-
addListener(event: "close", listener: () => void): this;
|
|
229
|
+
addListener(event: "close", listener: (ev: Event) => void): this;
|
|
228
230
|
addListener(event: "message", listener: (value: any) => void): this;
|
|
229
231
|
addListener(event: "messageerror", listener: (error: Error) => void): this;
|
|
230
|
-
addListener(event: string
|
|
231
|
-
emit(event: "close"): boolean;
|
|
232
|
+
addListener(event: string, listener: (arg: any) => void): this;
|
|
233
|
+
emit(event: "close", ev: Event): boolean;
|
|
232
234
|
emit(event: "message", value: any): boolean;
|
|
233
235
|
emit(event: "messageerror", error: Error): boolean;
|
|
234
|
-
emit(event: string
|
|
235
|
-
|
|
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;
|
|
236
242
|
on(event: "message", listener: (value: any) => void): this;
|
|
237
243
|
on(event: "messageerror", listener: (error: Error) => void): this;
|
|
238
|
-
on(event: string
|
|
239
|
-
once(event: "close", listener: () => void): this;
|
|
244
|
+
on(event: string, listener: (arg: any) => void): this;
|
|
245
|
+
once(event: "close", listener: (ev: Event) => void): this;
|
|
240
246
|
once(event: "message", listener: (value: any) => void): this;
|
|
241
247
|
once(event: "messageerror", listener: (error: Error) => void): this;
|
|
242
|
-
once(event: string
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
prependOnceListener(event: "close", listener: () => void): this;
|
|
248
|
-
prependOnceListener(event: "message", listener: (value: any) => void): this;
|
|
249
|
-
prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
|
|
250
|
-
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
251
|
-
removeListener(event: "close", listener: () => void): this;
|
|
252
|
-
removeListener(event: "message", listener: (value: any) => void): this;
|
|
253
|
-
removeListener(event: "messageerror", listener: (error: Error) => void): this;
|
|
254
|
-
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
255
|
-
off(event: "close", listener: () => void): this;
|
|
256
|
-
off(event: "message", listener: (value: any) => void): this;
|
|
257
|
-
off(event: "messageerror", listener: (error: Error) => void): this;
|
|
258
|
-
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
259
|
-
addEventListener: EventTarget["addEventListener"];
|
|
260
|
-
dispatchEvent: EventTarget["dispatchEvent"];
|
|
261
|
-
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;
|
|
262
253
|
}
|
|
254
|
+
interface MessagePort extends NodeEventTarget {}
|
|
263
255
|
interface WorkerOptions {
|
|
264
256
|
/**
|
|
265
257
|
* List of arguments which would be stringified and appended to
|
|
@@ -401,6 +393,12 @@ declare module "worker_threads" {
|
|
|
401
393
|
* @since v10.5.0
|
|
402
394
|
*/
|
|
403
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;
|
|
404
402
|
/**
|
|
405
403
|
* Provides the set of JS engine resource constraints for this Worker thread.
|
|
406
404
|
* If the `resourceLimits` option was passed to the `Worker` constructor,
|
|
@@ -428,24 +426,6 @@ declare module "worker_threads" {
|
|
|
428
426
|
* @since v10.5.0
|
|
429
427
|
*/
|
|
430
428
|
postMessage(value: any, transferList?: readonly Transferable[]): void;
|
|
431
|
-
/**
|
|
432
|
-
* Sends a value to another worker, identified by its thread ID.
|
|
433
|
-
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
|
|
434
|
-
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
|
|
435
|
-
* @param value The value to send.
|
|
436
|
-
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
|
|
437
|
-
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
|
|
438
|
-
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
|
|
439
|
-
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
|
|
440
|
-
* @since v22.5.0
|
|
441
|
-
*/
|
|
442
|
-
postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
|
|
443
|
-
postMessageToThread(
|
|
444
|
-
threadId: number,
|
|
445
|
-
value: any,
|
|
446
|
-
transferList: readonly Transferable[],
|
|
447
|
-
timeout?: number,
|
|
448
|
-
): Promise<void>;
|
|
449
429
|
/**
|
|
450
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
|
|
451
431
|
* behavior). If the worker is `ref()`ed, calling `ref()` again has
|
|
@@ -465,6 +445,13 @@ declare module "worker_threads" {
|
|
|
465
445
|
* @since v10.5.0
|
|
466
446
|
*/
|
|
467
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>;
|
|
468
455
|
/**
|
|
469
456
|
* Returns a readable stream for a V8 snapshot of the current state of the Worker.
|
|
470
457
|
* See `v8.getHeapSnapshot()` for more details.
|
|
@@ -479,9 +466,84 @@ declare module "worker_threads" {
|
|
|
479
466
|
* This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
|
|
480
467
|
* or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
|
|
481
468
|
* This methods allows the statistics to be observed from outside the actual thread.
|
|
482
|
-
* @since
|
|
469
|
+
* @since v24.0.0
|
|
483
470
|
*/
|
|
484
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>;
|
|
485
547
|
/**
|
|
486
548
|
* Calls `worker.terminate()` when the dispose scope is exited.
|
|
487
549
|
*
|
|
@@ -491,7 +553,7 @@ declare module "worker_threads" {
|
|
|
491
553
|
* // Worker is automatically terminate when the scope is exited.
|
|
492
554
|
* }
|
|
493
555
|
* ```
|
|
494
|
-
* @since
|
|
556
|
+
* @since v24.2.0
|
|
495
557
|
*/
|
|
496
558
|
[Symbol.asyncDispose](): Promise<void>;
|
|
497
559
|
addListener(event: "error", listener: (err: Error) => void): this;
|
|
@@ -598,6 +660,35 @@ declare module "worker_threads" {
|
|
|
598
660
|
*/
|
|
599
661
|
postMessage(message: unknown): void;
|
|
600
662
|
}
|
|
663
|
+
interface Lock {
|
|
664
|
+
readonly mode: LockMode;
|
|
665
|
+
readonly name: string;
|
|
666
|
+
}
|
|
667
|
+
interface LockGrantedCallback<T> {
|
|
668
|
+
(lock: Lock | null): T;
|
|
669
|
+
}
|
|
670
|
+
interface LockInfo {
|
|
671
|
+
clientId: string;
|
|
672
|
+
mode: LockMode;
|
|
673
|
+
name: string;
|
|
674
|
+
}
|
|
675
|
+
interface LockManager {
|
|
676
|
+
query(): Promise<LockManagerSnapshot>;
|
|
677
|
+
request<T>(name: string, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
|
|
678
|
+
request<T>(name: string, options: LockOptions, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
|
|
679
|
+
}
|
|
680
|
+
interface LockManagerSnapshot {
|
|
681
|
+
held: LockInfo[];
|
|
682
|
+
pending: LockInfo[];
|
|
683
|
+
}
|
|
684
|
+
type LockMode = "exclusive" | "shared";
|
|
685
|
+
interface LockOptions {
|
|
686
|
+
ifAvailable?: boolean;
|
|
687
|
+
mode?: LockMode;
|
|
688
|
+
signal?: AbortSignal;
|
|
689
|
+
steal?: boolean;
|
|
690
|
+
}
|
|
691
|
+
var locks: LockManager;
|
|
601
692
|
/**
|
|
602
693
|
* Mark an object as not transferable. If `object` occurs in the transfer list of
|
|
603
694
|
* a `port.postMessage()` call, it is ignored.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
11
|
* Compression and decompression are built around the Node.js
|
|
12
|
-
* [Streams API](https://nodejs.org/docs/latest-
|
|
12
|
+
* [Streams API](https://nodejs.org/docs/latest-v24.x/api/stream.html).
|
|
13
13
|
*
|
|
14
14
|
* Compressing or decompressing a stream (such as a file) can be accomplished by
|
|
15
15
|
* piping the source stream through a `zlib` `Transform` stream into a destination
|
|
@@ -89,9 +89,10 @@
|
|
|
89
89
|
* });
|
|
90
90
|
* ```
|
|
91
91
|
* @since v0.5.8
|
|
92
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
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
|
/**
|
|
@@ -143,7 +144,7 @@ declare module "zlib" {
|
|
|
143
144
|
}
|
|
144
145
|
| undefined;
|
|
145
146
|
/**
|
|
146
|
-
* Limits output size when using [convenience methods](https://nodejs.org/docs/latest-
|
|
147
|
+
* Limits output size when using [convenience methods](https://nodejs.org/docs/latest-v24.x/api/zlib.html#convenience-methods).
|
|
147
148
|
* @default buffer.kMaxLength
|
|
148
149
|
*/
|
|
149
150
|
maxOutputLength?: number | undefined;
|
|
@@ -167,12 +168,12 @@ declare module "zlib" {
|
|
|
167
168
|
chunkSize?: number | undefined;
|
|
168
169
|
/**
|
|
169
170
|
* Key-value object containing indexed
|
|
170
|
-
* [Zstd parameters](https://nodejs.org/docs/latest-
|
|
171
|
+
* [Zstd parameters](https://nodejs.org/docs/latest-v24.x/api/zlib.html#zstd-constants).
|
|
171
172
|
*/
|
|
172
173
|
params?: { [key: number]: number | boolean } | undefined;
|
|
173
174
|
/**
|
|
174
175
|
* Limits output size when using
|
|
175
|
-
* [convenience methods](https://nodejs.org/docs/latest-
|
|
176
|
+
* [convenience methods](https://nodejs.org/docs/latest-v24.x/api/zlib.html#convenience-methods).
|
|
176
177
|
* @default buffer.kMaxLength
|
|
177
178
|
*/
|
|
178
179
|
maxOutputLength?: number | undefined;
|
|
@@ -180,10 +181,14 @@ 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
|
-
/** @deprecated Use bytesWritten instead. */
|
|
186
|
-
readonly bytesRead: number;
|
|
187
192
|
readonly bytesWritten: number;
|
|
188
193
|
shell?: boolean | string | undefined;
|
|
189
194
|
close(callback?: () => void): void;
|
|
@@ -223,7 +228,7 @@ declare module "zlib" {
|
|
|
223
228
|
* @returns A 32-bit unsigned integer containing the checksum.
|
|
224
229
|
* @since v22.2.0
|
|
225
230
|
*/
|
|
226
|
-
function crc32(data: string |
|
|
231
|
+
function crc32(data: string | NodeJS.ArrayBufferView, value?: number): number;
|
|
227
232
|
/**
|
|
228
233
|
* Creates and returns a new `BrotliCompress` object.
|
|
229
234
|
* @since v11.7.0, v10.16.0
|
|
@@ -287,124 +292,124 @@ declare module "zlib" {
|
|
|
287
292
|
*/
|
|
288
293
|
function createZstdDecompress(options?: ZstdOptions): ZstdDecompress;
|
|
289
294
|
type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
|
|
290
|
-
type CompressCallback = (error: Error | null, result:
|
|
295
|
+
type CompressCallback = (error: Error | null, result: NonSharedBuffer) => void;
|
|
291
296
|
/**
|
|
292
297
|
* @since v11.7.0, v10.16.0
|
|
293
298
|
*/
|
|
294
299
|
function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
|
295
300
|
function brotliCompress(buf: InputType, callback: CompressCallback): void;
|
|
296
301
|
namespace brotliCompress {
|
|
297
|
-
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<
|
|
302
|
+
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
|
|
298
303
|
}
|
|
299
304
|
/**
|
|
300
305
|
* Compress a chunk of data with `BrotliCompress`.
|
|
301
306
|
* @since v11.7.0, v10.16.0
|
|
302
307
|
*/
|
|
303
|
-
function brotliCompressSync(buf: InputType, options?: BrotliOptions):
|
|
308
|
+
function brotliCompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
|
|
304
309
|
/**
|
|
305
310
|
* @since v11.7.0, v10.16.0
|
|
306
311
|
*/
|
|
307
312
|
function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
|
308
313
|
function brotliDecompress(buf: InputType, callback: CompressCallback): void;
|
|
309
314
|
namespace brotliDecompress {
|
|
310
|
-
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<
|
|
315
|
+
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
|
|
311
316
|
}
|
|
312
317
|
/**
|
|
313
318
|
* Decompress a chunk of data with `BrotliDecompress`.
|
|
314
319
|
* @since v11.7.0, v10.16.0
|
|
315
320
|
*/
|
|
316
|
-
function brotliDecompressSync(buf: InputType, options?: BrotliOptions):
|
|
321
|
+
function brotliDecompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
|
|
317
322
|
/**
|
|
318
323
|
* @since v0.6.0
|
|
319
324
|
*/
|
|
320
325
|
function deflate(buf: InputType, callback: CompressCallback): void;
|
|
321
326
|
function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
|
322
327
|
namespace deflate {
|
|
323
|
-
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<
|
|
328
|
+
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
|
324
329
|
}
|
|
325
330
|
/**
|
|
326
331
|
* Compress a chunk of data with `Deflate`.
|
|
327
332
|
* @since v0.11.12
|
|
328
333
|
*/
|
|
329
|
-
function deflateSync(buf: InputType, options?: ZlibOptions):
|
|
334
|
+
function deflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
|
330
335
|
/**
|
|
331
336
|
* @since v0.6.0
|
|
332
337
|
*/
|
|
333
338
|
function deflateRaw(buf: InputType, callback: CompressCallback): void;
|
|
334
339
|
function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
|
335
340
|
namespace deflateRaw {
|
|
336
|
-
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<
|
|
341
|
+
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
|
337
342
|
}
|
|
338
343
|
/**
|
|
339
344
|
* Compress a chunk of data with `DeflateRaw`.
|
|
340
345
|
* @since v0.11.12
|
|
341
346
|
*/
|
|
342
|
-
function deflateRawSync(buf: InputType, options?: ZlibOptions):
|
|
347
|
+
function deflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
|
343
348
|
/**
|
|
344
349
|
* @since v0.6.0
|
|
345
350
|
*/
|
|
346
351
|
function gzip(buf: InputType, callback: CompressCallback): void;
|
|
347
352
|
function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
|
348
353
|
namespace gzip {
|
|
349
|
-
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<
|
|
354
|
+
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
|
350
355
|
}
|
|
351
356
|
/**
|
|
352
357
|
* Compress a chunk of data with `Gzip`.
|
|
353
358
|
* @since v0.11.12
|
|
354
359
|
*/
|
|
355
|
-
function gzipSync(buf: InputType, options?: ZlibOptions):
|
|
360
|
+
function gzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
|
356
361
|
/**
|
|
357
362
|
* @since v0.6.0
|
|
358
363
|
*/
|
|
359
364
|
function gunzip(buf: InputType, callback: CompressCallback): void;
|
|
360
365
|
function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
|
361
366
|
namespace gunzip {
|
|
362
|
-
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<
|
|
367
|
+
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
|
363
368
|
}
|
|
364
369
|
/**
|
|
365
370
|
* Decompress a chunk of data with `Gunzip`.
|
|
366
371
|
* @since v0.11.12
|
|
367
372
|
*/
|
|
368
|
-
function gunzipSync(buf: InputType, options?: ZlibOptions):
|
|
373
|
+
function gunzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
|
369
374
|
/**
|
|
370
375
|
* @since v0.6.0
|
|
371
376
|
*/
|
|
372
377
|
function inflate(buf: InputType, callback: CompressCallback): void;
|
|
373
378
|
function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
|
374
379
|
namespace inflate {
|
|
375
|
-
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<
|
|
380
|
+
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
|
376
381
|
}
|
|
377
382
|
/**
|
|
378
383
|
* Decompress a chunk of data with `Inflate`.
|
|
379
384
|
* @since v0.11.12
|
|
380
385
|
*/
|
|
381
|
-
function inflateSync(buf: InputType, options?: ZlibOptions):
|
|
386
|
+
function inflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
|
382
387
|
/**
|
|
383
388
|
* @since v0.6.0
|
|
384
389
|
*/
|
|
385
390
|
function inflateRaw(buf: InputType, callback: CompressCallback): void;
|
|
386
391
|
function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
|
387
392
|
namespace inflateRaw {
|
|
388
|
-
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<
|
|
393
|
+
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
|
389
394
|
}
|
|
390
395
|
/**
|
|
391
396
|
* Decompress a chunk of data with `InflateRaw`.
|
|
392
397
|
* @since v0.11.12
|
|
393
398
|
*/
|
|
394
|
-
function inflateRawSync(buf: InputType, options?: ZlibOptions):
|
|
399
|
+
function inflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
|
395
400
|
/**
|
|
396
401
|
* @since v0.6.0
|
|
397
402
|
*/
|
|
398
403
|
function unzip(buf: InputType, callback: CompressCallback): void;
|
|
399
404
|
function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
|
400
405
|
namespace unzip {
|
|
401
|
-
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<
|
|
406
|
+
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
|
402
407
|
}
|
|
403
408
|
/**
|
|
404
409
|
* Decompress a chunk of data with `Unzip`.
|
|
405
410
|
* @since v0.11.12
|
|
406
411
|
*/
|
|
407
|
-
function unzipSync(buf: InputType, options?: ZlibOptions):
|
|
412
|
+
function unzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
|
408
413
|
/**
|
|
409
414
|
* @since v22.15.0
|
|
410
415
|
* @experimental
|
|
@@ -412,14 +417,14 @@ declare module "zlib" {
|
|
|
412
417
|
function zstdCompress(buf: InputType, callback: CompressCallback): void;
|
|
413
418
|
function zstdCompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
|
|
414
419
|
namespace zstdCompress {
|
|
415
|
-
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<
|
|
420
|
+
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
|
|
416
421
|
}
|
|
417
422
|
/**
|
|
418
423
|
* Compress a chunk of data with `ZstdCompress`.
|
|
419
424
|
* @since v22.15.0
|
|
420
425
|
* @experimental
|
|
421
426
|
*/
|
|
422
|
-
function zstdCompressSync(buf: InputType, options?: ZstdOptions):
|
|
427
|
+
function zstdCompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
|
|
423
428
|
/**
|
|
424
429
|
* @since v22.15.0
|
|
425
430
|
* @experimental
|
|
@@ -427,14 +432,14 @@ declare module "zlib" {
|
|
|
427
432
|
function zstdDecompress(buf: InputType, callback: CompressCallback): void;
|
|
428
433
|
function zstdDecompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
|
|
429
434
|
namespace zstdDecompress {
|
|
430
|
-
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<
|
|
435
|
+
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
|
|
431
436
|
}
|
|
432
437
|
/**
|
|
433
438
|
* Decompress a chunk of data with `ZstdDecompress`.
|
|
434
439
|
* @since v22.15.0
|
|
435
440
|
* @experimental
|
|
436
441
|
*/
|
|
437
|
-
function zstdDecompressSync(buf: InputType, options?: ZstdOptions):
|
|
442
|
+
function zstdDecompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
|
|
438
443
|
namespace constants {
|
|
439
444
|
const BROTLI_DECODE: number;
|
|
440
445
|
const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { URL } from 'url'
|
|
2
2
|
import Pool from './pool'
|
|
3
|
-
import Dispatcher from
|
|
3
|
+
import Dispatcher from './dispatcher'
|
|
4
|
+
import TClientStats from './client-stats'
|
|
5
|
+
import TPoolStats from './pool-stats'
|
|
4
6
|
|
|
5
7
|
export default Agent
|
|
6
8
|
|
|
7
|
-
declare class Agent extends Dispatcher{
|
|
8
|
-
constructor(opts?: Agent.Options)
|
|
9
|
+
declare class Agent extends Dispatcher {
|
|
10
|
+
constructor (opts?: Agent.Options)
|
|
9
11
|
/** `true` after `dispatcher.close()` has been called. */
|
|
10
|
-
closed: boolean
|
|
12
|
+
closed: boolean
|
|
11
13
|
/** `true` after `dispatcher.destroyed()` has been called or `dispatcher.close()` has been called and the dispatcher shutdown has completed. */
|
|
12
|
-
destroyed: boolean
|
|
14
|
+
destroyed: boolean
|
|
13
15
|
/** Dispatches a request. */
|
|
14
|
-
dispatch(options: Agent.DispatchOptions, handler: Dispatcher.
|
|
16
|
+
dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
|
|
17
|
+
/** Aggregate stats for a Agent by origin. */
|
|
18
|
+
readonly stats: Record<string, TClientStats | TPoolStats>
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
declare namespace Agent {
|
|
18
22
|
export interface Options extends Pool.Options {
|
|
19
23
|
/** Default: `(origin, opts) => new Pool(origin, opts)`. */
|
|
20
24
|
factory?(origin: string | URL, opts: Object): Dispatcher;
|
|
21
|
-
/** Integer. Default: `0` */
|
|
22
|
-
maxRedirections?: number;
|
|
23
25
|
|
|
24
|
-
interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options[
|
|
26
|
+
interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options['interceptors']
|
|
27
|
+
maxOrigins?: number
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
export interface DispatchOptions extends Dispatcher.DispatchOptions {
|
|
28
|
-
/** Integer. */
|
|
29
|
-
maxRedirections?: number;
|
|
30
31
|
}
|
|
31
32
|
}
|