undici-types 7.15.0 → 7.17.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/agent.d.ts +2 -1
- package/api.d.ts +2 -2
- package/balanced-pool.d.ts +2 -1
- package/cache-interceptor.d.ts +1 -0
- package/client.d.ts +1 -1
- package/connector.d.ts +2 -2
- package/diagnostics-channel.d.ts +2 -2
- package/dispatcher.d.ts +12 -12
- package/errors.d.ts +5 -15
- package/fetch.d.ts +4 -4
- package/formdata.d.ts +1 -1
- package/h2c-client.d.ts +1 -1
- package/index.d.ts +9 -1
- package/interceptors.d.ts +36 -2
- package/package.json +1 -1
- package/pool.d.ts +1 -1
- package/readable.d.ts +2 -2
- package/round-robin-pool.d.ts +41 -0
- package/webidl.d.ts +82 -21
- package/websocket.d.ts +9 -9
package/agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { URL } from 'url'
|
|
1
|
+
import { URL } from 'node:url'
|
|
2
2
|
import Pool from './pool'
|
|
3
3
|
import Dispatcher from './dispatcher'
|
|
4
4
|
import TClientStats from './client-stats'
|
|
@@ -24,6 +24,7 @@ declare namespace Agent {
|
|
|
24
24
|
factory?(origin: string | URL, opts: Object): Dispatcher;
|
|
25
25
|
|
|
26
26
|
interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options['interceptors']
|
|
27
|
+
maxOrigins?: number
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export interface DispatchOptions extends Dispatcher.DispatchOptions {
|
package/api.d.ts
CHANGED
package/balanced-pool.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Pool from './pool'
|
|
2
2
|
import Dispatcher from './dispatcher'
|
|
3
|
-
import { URL } from 'url'
|
|
3
|
+
import { URL } from 'node:url'
|
|
4
4
|
|
|
5
5
|
export default BalancedPool
|
|
6
6
|
|
|
@@ -11,6 +11,7 @@ declare class BalancedPool extends Dispatcher {
|
|
|
11
11
|
|
|
12
12
|
addUpstream (upstream: string | URL): BalancedPool
|
|
13
13
|
removeUpstream (upstream: string | URL): BalancedPool
|
|
14
|
+
getUpstream (upstream: string | URL): Pool | undefined
|
|
14
15
|
upstreams: Array<string>
|
|
15
16
|
|
|
16
17
|
/** `true` after `pool.close()` has been called. */
|
package/cache-interceptor.d.ts
CHANGED
package/client.d.ts
CHANGED
package/connector.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TLSSocket, ConnectionOptions } from 'tls'
|
|
2
|
-
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'net'
|
|
1
|
+
import { TLSSocket, ConnectionOptions } from 'node:tls'
|
|
2
|
+
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'node:net'
|
|
3
3
|
|
|
4
4
|
export default buildConnector
|
|
5
5
|
declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector
|
package/diagnostics-channel.d.ts
CHANGED
package/dispatcher.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { URL } from 'url'
|
|
2
|
-
import { Duplex, Readable, Writable } from 'stream'
|
|
3
|
-
import { EventEmitter } from 'events'
|
|
4
|
-
import { Blob } from 'buffer'
|
|
1
|
+
import { URL } from 'node:url'
|
|
2
|
+
import { Duplex, Readable, Writable } from 'node:stream'
|
|
3
|
+
import { EventEmitter } from 'node:events'
|
|
4
|
+
import { Blob } from 'node:buffer'
|
|
5
5
|
import { IncomingHttpHeaders } from './header'
|
|
6
6
|
import BodyReadable from './readable'
|
|
7
7
|
import { FormData } from './formdata'
|
|
@@ -19,30 +19,30 @@ declare class Dispatcher extends EventEmitter {
|
|
|
19
19
|
/** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
|
|
20
20
|
dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
|
|
21
21
|
/** Starts two-way communications with the requested resource. */
|
|
22
|
-
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>
|
|
23
22
|
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void
|
|
23
|
+
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>
|
|
24
24
|
/** Compose a chain of dispatchers */
|
|
25
25
|
compose (dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
|
|
26
26
|
compose (...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
|
|
27
27
|
/** Performs an HTTP request. */
|
|
28
|
-
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>
|
|
29
28
|
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void
|
|
29
|
+
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>
|
|
30
30
|
/** For easy use with `stream.pipeline`. */
|
|
31
31
|
pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex
|
|
32
32
|
/** A faster version of `Dispatcher.request`. */
|
|
33
|
-
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>
|
|
34
33
|
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void
|
|
34
|
+
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>
|
|
35
35
|
/** Upgrade to a different protocol. */
|
|
36
|
-
upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>
|
|
37
36
|
upgrade (options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void
|
|
37
|
+
upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>
|
|
38
38
|
/** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
|
|
39
|
-
close (): Promise<void>
|
|
40
39
|
close (callback: () => void): void
|
|
40
|
+
close (): Promise<void>
|
|
41
41
|
/** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
|
|
42
|
-
destroy (): Promise<void>
|
|
43
|
-
destroy (err: Error | null): Promise<void>
|
|
44
|
-
destroy (callback: () => void): void
|
|
45
42
|
destroy (err: Error | null, callback: () => void): void
|
|
43
|
+
destroy (callback: () => void): void
|
|
44
|
+
destroy (err: Error | null): Promise<void>
|
|
45
|
+
destroy (): Promise<void>
|
|
46
46
|
|
|
47
47
|
on (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
|
48
48
|
on (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
package/errors.d.ts
CHANGED
|
@@ -49,21 +49,6 @@ declare namespace Errors {
|
|
|
49
49
|
headers: IncomingHttpHeaders | string[] | null
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export class ResponseStatusCodeError extends UndiciError {
|
|
53
|
-
constructor (
|
|
54
|
-
message?: string,
|
|
55
|
-
statusCode?: number,
|
|
56
|
-
headers?: IncomingHttpHeaders | string[] | null,
|
|
57
|
-
body?: null | Record<string, any> | string
|
|
58
|
-
)
|
|
59
|
-
name: 'ResponseStatusCodeError'
|
|
60
|
-
code: 'UND_ERR_RESPONSE_STATUS_CODE'
|
|
61
|
-
body: null | Record<string, any> | string
|
|
62
|
-
status: number
|
|
63
|
-
statusCode: number
|
|
64
|
-
headers: IncomingHttpHeaders | string[] | null
|
|
65
|
-
}
|
|
66
|
-
|
|
67
52
|
/** Passed an invalid argument. */
|
|
68
53
|
export class InvalidArgumentError extends UndiciError {
|
|
69
54
|
name: 'InvalidArgumentError'
|
|
@@ -168,4 +153,9 @@ declare namespace Errors {
|
|
|
168
153
|
name: 'SecureProxyConnectionError'
|
|
169
154
|
code: 'UND_ERR_PRX_TLS'
|
|
170
155
|
}
|
|
156
|
+
|
|
157
|
+
class MaxOriginsReachedError extends UndiciError {
|
|
158
|
+
name: 'MaxOriginsReachedError'
|
|
159
|
+
code: 'UND_ERR_MAX_ORIGINS_REACHED'
|
|
160
|
+
}
|
|
171
161
|
}
|
package/fetch.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// and https://github.com/node-fetch/node-fetch/blob/914ce6be5ec67a8bab63d68510aabf07cb818b6d/index.d.ts (MIT license)
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
|
|
5
|
-
import { Blob } from 'buffer'
|
|
6
|
-
import { URL, URLSearchParams } from 'url'
|
|
7
|
-
import { ReadableStream } from 'stream/web'
|
|
5
|
+
import { Blob } from 'node:buffer'
|
|
6
|
+
import { URL, URLSearchParams } from 'node:url'
|
|
7
|
+
import { ReadableStream } from 'node:stream/web'
|
|
8
8
|
import { FormData } from './formdata'
|
|
9
9
|
import { HeaderRecord } from './header'
|
|
10
10
|
import Dispatcher from './dispatcher'
|
|
@@ -207,5 +207,5 @@ export declare class Response extends BodyMixin {
|
|
|
207
207
|
|
|
208
208
|
static error (): Response
|
|
209
209
|
static json (data: any, init?: ResponseInit): Response
|
|
210
|
-
static redirect (url: string | URL, status
|
|
210
|
+
static redirect (url: string | URL, status?: ResponseRedirectStatus): Response
|
|
211
211
|
}
|
package/formdata.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Based on https://github.com/octet-stream/form-data/blob/2d0f0dc371517444ce1f22cdde13f51995d0953a/lib/FormData.ts (MIT)
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
|
|
4
|
-
import { File } from 'buffer'
|
|
4
|
+
import { File } from 'node:buffer'
|
|
5
5
|
import { SpecIterableIterator } from './fetch'
|
|
6
6
|
|
|
7
7
|
/**
|
package/h2c-client.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import Pool from './pool'
|
|
|
5
5
|
import { RedirectHandler, DecoratorHandler } from './handlers'
|
|
6
6
|
|
|
7
7
|
import BalancedPool from './balanced-pool'
|
|
8
|
+
import RoundRobinPool from './round-robin-pool'
|
|
8
9
|
import Client from './client'
|
|
9
10
|
import H2CClient from './h2c-client'
|
|
10
11
|
import buildConnector from './connector'
|
|
@@ -23,6 +24,12 @@ import RetryAgent from './retry-agent'
|
|
|
23
24
|
import { request, pipeline, stream, connect, upgrade } from './api'
|
|
24
25
|
import interceptors from './interceptors'
|
|
25
26
|
|
|
27
|
+
import CacheInterceptor from './cache-interceptor'
|
|
28
|
+
declare const cacheStores: {
|
|
29
|
+
MemoryCacheStore: typeof CacheInterceptor.MemoryCacheStore;
|
|
30
|
+
SqliteCacheStore: typeof CacheInterceptor.SqliteCacheStore;
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
export * from './util'
|
|
27
34
|
export * from './cookies'
|
|
28
35
|
export * from './eventsource'
|
|
@@ -36,7 +43,7 @@ export { Interceptable } from './mock-interceptor'
|
|
|
36
43
|
|
|
37
44
|
declare function globalThisInstall (): void
|
|
38
45
|
|
|
39
|
-
export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
|
|
46
|
+
export { Dispatcher, BalancedPool, RoundRobinPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, cacheStores, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
|
|
40
47
|
export default Undici
|
|
41
48
|
|
|
42
49
|
declare namespace Undici {
|
|
@@ -46,6 +53,7 @@ declare namespace Undici {
|
|
|
46
53
|
const DecoratorHandler: typeof import ('./handlers').DecoratorHandler
|
|
47
54
|
const RetryHandler: typeof import ('./retry-handler').default
|
|
48
55
|
const BalancedPool: typeof import('./balanced-pool').default
|
|
56
|
+
const RoundRobinPool: typeof import('./round-robin-pool').default
|
|
49
57
|
const Client: typeof import('./client').default
|
|
50
58
|
const H2CClient: typeof import('./h2c-client').default
|
|
51
59
|
const buildConnector: typeof import('./connector').default
|
package/interceptors.d.ts
CHANGED
|
@@ -19,14 +19,47 @@ declare namespace Interceptors {
|
|
|
19
19
|
|
|
20
20
|
// DNS interceptor
|
|
21
21
|
export type DNSInterceptorRecord = { address: string, ttl: number, family: 4 | 6 }
|
|
22
|
-
export type DNSInterceptorOriginRecords = { 4: { ips: DNSInterceptorRecord[] } | null, 6: { ips: DNSInterceptorRecord[] } | null }
|
|
22
|
+
export type DNSInterceptorOriginRecords = { records: { 4: { ips: DNSInterceptorRecord[] } | null, 6: { ips: DNSInterceptorRecord[] } | null } }
|
|
23
|
+
export type DNSStorage = {
|
|
24
|
+
size: number
|
|
25
|
+
get(origin: string): DNSInterceptorOriginRecords | null
|
|
26
|
+
set(origin: string, records: DNSInterceptorOriginRecords | null, options: { ttl: number }): void
|
|
27
|
+
delete(origin: string): void
|
|
28
|
+
full(): boolean
|
|
29
|
+
}
|
|
23
30
|
export type DNSInterceptorOpts = {
|
|
24
31
|
maxTTL?: number
|
|
25
32
|
maxItems?: number
|
|
26
|
-
lookup?: (
|
|
33
|
+
lookup?: (origin: URL, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void
|
|
27
34
|
pick?: (origin: URL, records: DNSInterceptorOriginRecords, affinity: 4 | 6) => DNSInterceptorRecord
|
|
28
35
|
dualStack?: boolean
|
|
29
36
|
affinity?: 4 | 6
|
|
37
|
+
storage?: DNSStorage
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Deduplicate interceptor
|
|
41
|
+
export type DeduplicateMethods = 'GET' | 'HEAD' | 'OPTIONS' | 'TRACE'
|
|
42
|
+
export type DeduplicateInterceptorOpts = {
|
|
43
|
+
/**
|
|
44
|
+
* The HTTP methods to deduplicate.
|
|
45
|
+
* Note: Only safe HTTP methods can be deduplicated.
|
|
46
|
+
* @default ['GET']
|
|
47
|
+
*/
|
|
48
|
+
methods?: DeduplicateMethods[]
|
|
49
|
+
/**
|
|
50
|
+
* Header names that, if present in a request, will cause the request to skip deduplication.
|
|
51
|
+
* Header name matching is case-insensitive.
|
|
52
|
+
* @default []
|
|
53
|
+
*/
|
|
54
|
+
skipHeaderNames?: string[]
|
|
55
|
+
/**
|
|
56
|
+
* Header names to exclude from the deduplication key.
|
|
57
|
+
* Requests with different values for these headers will still be deduplicated together.
|
|
58
|
+
* Useful for headers like `x-request-id` that vary per request but shouldn't affect deduplication.
|
|
59
|
+
* Header name matching is case-insensitive.
|
|
60
|
+
* @default []
|
|
61
|
+
*/
|
|
62
|
+
excludeHeaderNames?: string[]
|
|
30
63
|
}
|
|
31
64
|
|
|
32
65
|
export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
|
@@ -36,4 +69,5 @@ declare namespace Interceptors {
|
|
|
36
69
|
export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
|
37
70
|
export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
|
38
71
|
export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
|
72
|
+
export function deduplicate (opts?: DeduplicateInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
|
39
73
|
}
|
package/package.json
CHANGED
package/pool.d.ts
CHANGED
package/readable.d.ts
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Client from './client'
|
|
2
|
+
import TPoolStats from './pool-stats'
|
|
3
|
+
import { URL } from 'node:url'
|
|
4
|
+
import Dispatcher from './dispatcher'
|
|
5
|
+
|
|
6
|
+
export default RoundRobinPool
|
|
7
|
+
|
|
8
|
+
type RoundRobinPoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
|
|
9
|
+
|
|
10
|
+
declare class RoundRobinPool extends Dispatcher {
|
|
11
|
+
constructor (url: string | URL, options?: RoundRobinPool.Options)
|
|
12
|
+
/** `true` after `pool.close()` has been called. */
|
|
13
|
+
closed: boolean
|
|
14
|
+
/** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
|
|
15
|
+
destroyed: boolean
|
|
16
|
+
/** Aggregate stats for a RoundRobinPool. */
|
|
17
|
+
readonly stats: TPoolStats
|
|
18
|
+
|
|
19
|
+
// Override dispatcher APIs.
|
|
20
|
+
override connect (
|
|
21
|
+
options: RoundRobinPoolConnectOptions
|
|
22
|
+
): Promise<Dispatcher.ConnectData>
|
|
23
|
+
override connect (
|
|
24
|
+
options: RoundRobinPoolConnectOptions,
|
|
25
|
+
callback: (err: Error | null, data: Dispatcher.ConnectData) => void
|
|
26
|
+
): void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare namespace RoundRobinPool {
|
|
30
|
+
export type RoundRobinPoolStats = TPoolStats
|
|
31
|
+
export interface Options extends Client.Options {
|
|
32
|
+
/** Default: `(origin, opts) => new Client(origin, opts)`. */
|
|
33
|
+
factory?(origin: URL, opts: object): Dispatcher;
|
|
34
|
+
/** The max number of clients to create. `null` if no limit. Default `null`. */
|
|
35
|
+
connections?: number | null;
|
|
36
|
+
/** The amount of time before a client is removed from the pool and closed. `null` if no time limit. Default `null` */
|
|
37
|
+
clientTtl?: number | null;
|
|
38
|
+
|
|
39
|
+
interceptors?: { RoundRobinPool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options['interceptors']
|
|
40
|
+
}
|
|
41
|
+
}
|
package/webidl.d.ts
CHANGED
|
@@ -10,11 +10,6 @@ type SequenceConverter<T> = (object: unknown, iterable?: IterableIterator<T>) =>
|
|
|
10
10
|
|
|
11
11
|
type RecordConverter<K extends string, V> = (object: unknown) => Record<K, V>
|
|
12
12
|
|
|
13
|
-
interface ConvertToIntOpts {
|
|
14
|
-
clamp?: boolean
|
|
15
|
-
enforceRange?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
13
|
interface WebidlErrors {
|
|
19
14
|
/**
|
|
20
15
|
* @description Instantiate an error
|
|
@@ -74,7 +69,7 @@ interface WebidlUtil {
|
|
|
74
69
|
V: unknown,
|
|
75
70
|
bitLength: number,
|
|
76
71
|
signedness: 'signed' | 'unsigned',
|
|
77
|
-
|
|
72
|
+
flags?: number
|
|
78
73
|
): number
|
|
79
74
|
|
|
80
75
|
/**
|
|
@@ -94,15 +89,17 @@ interface WebidlUtil {
|
|
|
94
89
|
* This is only effective in some newer Node.js versions.
|
|
95
90
|
*/
|
|
96
91
|
markAsUncloneable (V: any): void
|
|
92
|
+
|
|
93
|
+
IsResizableArrayBuffer (V: ArrayBufferLike): boolean
|
|
94
|
+
|
|
95
|
+
HasFlag (flag: number, attributes: number): boolean
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
interface WebidlConverters {
|
|
100
99
|
/**
|
|
101
100
|
* @see https://webidl.spec.whatwg.org/#es-DOMString
|
|
102
101
|
*/
|
|
103
|
-
DOMString (V: unknown, prefix: string, argument: string,
|
|
104
|
-
legacyNullToEmptyString: boolean
|
|
105
|
-
}): string
|
|
102
|
+
DOMString (V: unknown, prefix: string, argument: string, flags?: number): string
|
|
106
103
|
|
|
107
104
|
/**
|
|
108
105
|
* @see https://webidl.spec.whatwg.org/#es-ByteString
|
|
@@ -142,39 +139,78 @@ interface WebidlConverters {
|
|
|
142
139
|
/**
|
|
143
140
|
* @see https://webidl.spec.whatwg.org/#es-unsigned-short
|
|
144
141
|
*/
|
|
145
|
-
['unsigned short'] (V: unknown,
|
|
142
|
+
['unsigned short'] (V: unknown, flags?: number): number
|
|
146
143
|
|
|
147
144
|
/**
|
|
148
145
|
* @see https://webidl.spec.whatwg.org/#idl-ArrayBuffer
|
|
149
146
|
*/
|
|
150
|
-
ArrayBuffer (
|
|
151
|
-
|
|
147
|
+
ArrayBuffer (
|
|
148
|
+
V: unknown,
|
|
149
|
+
prefix: string,
|
|
150
|
+
argument: string,
|
|
151
|
+
options?: { allowResizable: boolean }
|
|
152
|
+
): ArrayBuffer
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @see https://webidl.spec.whatwg.org/#idl-SharedArrayBuffer
|
|
156
|
+
*/
|
|
157
|
+
SharedArrayBuffer (
|
|
158
|
+
V: unknown,
|
|
159
|
+
prefix: string,
|
|
160
|
+
argument: string,
|
|
161
|
+
options?: { allowResizable: boolean }
|
|
162
|
+
): SharedArrayBuffer
|
|
152
163
|
|
|
153
164
|
/**
|
|
154
165
|
* @see https://webidl.spec.whatwg.org/#es-buffer-source-types
|
|
155
166
|
*/
|
|
156
167
|
TypedArray (
|
|
157
168
|
V: unknown,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
169
|
+
T: new () => NodeJS.TypedArray,
|
|
170
|
+
prefix: string,
|
|
171
|
+
argument: string,
|
|
172
|
+
flags?: number
|
|
173
|
+
): NodeJS.TypedArray
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @see https://webidl.spec.whatwg.org/#es-buffer-source-types
|
|
177
|
+
*/
|
|
178
|
+
DataView (
|
|
161
179
|
V: unknown,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
180
|
+
prefix: string,
|
|
181
|
+
argument: string,
|
|
182
|
+
flags?: number
|
|
183
|
+
): DataView
|
|
165
184
|
|
|
166
185
|
/**
|
|
167
186
|
* @see https://webidl.spec.whatwg.org/#es-buffer-source-types
|
|
168
187
|
*/
|
|
169
|
-
|
|
188
|
+
ArrayBufferView (
|
|
189
|
+
V: unknown,
|
|
190
|
+
prefix: string,
|
|
191
|
+
argument: string,
|
|
192
|
+
flags?: number
|
|
193
|
+
): NodeJS.ArrayBufferView
|
|
170
194
|
|
|
171
195
|
/**
|
|
172
196
|
* @see https://webidl.spec.whatwg.org/#BufferSource
|
|
173
197
|
*/
|
|
174
198
|
BufferSource (
|
|
175
199
|
V: unknown,
|
|
176
|
-
|
|
177
|
-
|
|
200
|
+
prefix: string,
|
|
201
|
+
argument: string,
|
|
202
|
+
flags?: number
|
|
203
|
+
): ArrayBuffer | NodeJS.ArrayBufferView
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @see https://webidl.spec.whatwg.org/#AllowSharedBufferSource
|
|
207
|
+
*/
|
|
208
|
+
AllowSharedBufferSource (
|
|
209
|
+
V: unknown,
|
|
210
|
+
prefix: string,
|
|
211
|
+
argument: string,
|
|
212
|
+
flags?: number
|
|
213
|
+
): ArrayBuffer | SharedArrayBuffer | NodeJS.ArrayBufferView
|
|
178
214
|
|
|
179
215
|
['sequence<ByteString>']: SequenceConverter<string>
|
|
180
216
|
|
|
@@ -192,6 +228,13 @@ interface WebidlConverters {
|
|
|
192
228
|
*/
|
|
193
229
|
RequestInit (V: unknown): undici.RequestInit
|
|
194
230
|
|
|
231
|
+
/**
|
|
232
|
+
* @see https://html.spec.whatwg.org/multipage/webappapis.html#eventhandlernonnull
|
|
233
|
+
*/
|
|
234
|
+
EventHandlerNonNull (V: unknown): Function | null
|
|
235
|
+
|
|
236
|
+
WebSocketStreamWrite (V: unknown): ArrayBuffer | NodeJS.TypedArray | string
|
|
237
|
+
|
|
195
238
|
[Key: string]: (...args: any[]) => unknown
|
|
196
239
|
}
|
|
197
240
|
|
|
@@ -210,6 +253,10 @@ interface WebidlIs {
|
|
|
210
253
|
AbortSignal: WebidlIsFunction<AbortSignal>
|
|
211
254
|
MessagePort: WebidlIsFunction<MessagePort>
|
|
212
255
|
USVString: WebidlIsFunction<string>
|
|
256
|
+
/**
|
|
257
|
+
* @see https://webidl.spec.whatwg.org/#BufferSource
|
|
258
|
+
*/
|
|
259
|
+
BufferSource: WebidlIsFunction<ArrayBuffer | NodeJS.TypedArray>
|
|
213
260
|
}
|
|
214
261
|
|
|
215
262
|
export interface Webidl {
|
|
@@ -217,6 +264,7 @@ export interface Webidl {
|
|
|
217
264
|
util: WebidlUtil
|
|
218
265
|
converters: WebidlConverters
|
|
219
266
|
is: WebidlIs
|
|
267
|
+
attributes: WebIDLExtendedAttributes
|
|
220
268
|
|
|
221
269
|
/**
|
|
222
270
|
* @description Performs a brand-check on {@param V} to ensure it is a
|
|
@@ -278,3 +326,16 @@ export interface Webidl {
|
|
|
278
326
|
|
|
279
327
|
argumentLengthCheck (args: { length: number }, min: number, context: string): void
|
|
280
328
|
}
|
|
329
|
+
|
|
330
|
+
interface WebIDLExtendedAttributes {
|
|
331
|
+
/** https://webidl.spec.whatwg.org/#Clamp */
|
|
332
|
+
Clamp: number
|
|
333
|
+
/** https://webidl.spec.whatwg.org/#EnforceRange */
|
|
334
|
+
EnforceRange: number
|
|
335
|
+
/** https://webidl.spec.whatwg.org/#AllowShared */
|
|
336
|
+
AllowShared: number
|
|
337
|
+
/** https://webidl.spec.whatwg.org/#AllowResizable */
|
|
338
|
+
AllowResizable: number
|
|
339
|
+
/** https://webidl.spec.whatwg.org/#LegacyNullToEmptyString */
|
|
340
|
+
LegacyNullToEmptyString: number
|
|
341
|
+
}
|
package/websocket.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
|
-
import type { Blob } from 'buffer'
|
|
4
|
-
import type { ReadableStream, WritableStream } from 'stream/web'
|
|
5
|
-
import type { MessagePort } from 'worker_threads'
|
|
3
|
+
import type { Blob } from 'node:buffer'
|
|
4
|
+
import type { ReadableStream, WritableStream } from 'node:stream/web'
|
|
5
|
+
import type { MessagePort } from 'node:worker_threads'
|
|
6
6
|
import {
|
|
7
7
|
EventInit,
|
|
8
8
|
EventListenerOptions,
|
|
@@ -96,16 +96,16 @@ interface MessageEventInit<T = any> extends EventInit {
|
|
|
96
96
|
data?: T
|
|
97
97
|
lastEventId?: string
|
|
98
98
|
origin?: string
|
|
99
|
-
ports?:
|
|
100
|
-
source?:
|
|
99
|
+
ports?: MessagePort[]
|
|
100
|
+
source?: MessagePort | null
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
interface MessageEvent<T = any> extends Event {
|
|
104
104
|
readonly data: T
|
|
105
105
|
readonly lastEventId: string
|
|
106
106
|
readonly origin: string
|
|
107
|
-
readonly ports:
|
|
108
|
-
readonly source:
|
|
107
|
+
readonly ports: readonly MessagePort[]
|
|
108
|
+
readonly source: MessagePort | null
|
|
109
109
|
initMessageEvent(
|
|
110
110
|
type: string,
|
|
111
111
|
bubbles?: boolean,
|
|
@@ -113,8 +113,8 @@ interface MessageEvent<T = any> extends Event {
|
|
|
113
113
|
data?: any,
|
|
114
114
|
origin?: string,
|
|
115
115
|
lastEventId?: string,
|
|
116
|
-
source?:
|
|
117
|
-
ports?:
|
|
116
|
+
source?: MessagePort | null,
|
|
117
|
+
ports?: MessagePort[]
|
|
118
118
|
): void;
|
|
119
119
|
}
|
|
120
120
|
|