avancement planning
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { URL } from 'url'
|
||||
import { URL } from 'node:url'
|
||||
import Pool from './pool'
|
||||
import Dispatcher from './dispatcher'
|
||||
import TClientStats from './client-stats'
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { URL, UrlObject } from 'url'
|
||||
import { Duplex } from 'stream'
|
||||
import { URL, UrlObject } from 'node:url'
|
||||
import { Duplex } from 'node:stream'
|
||||
import Dispatcher from './dispatcher'
|
||||
|
||||
/** Performs an HTTP request. */
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
import Pool from './pool'
|
||||
import Dispatcher from './dispatcher'
|
||||
import { URL } from 'url'
|
||||
import { URL } from 'node:url'
|
||||
|
||||
export default BalancedPool
|
||||
|
||||
@@ -11,6 +11,7 @@ declare class BalancedPool extends Dispatcher {
|
||||
|
||||
addUpstream (upstream: string | URL): BalancedPool
|
||||
removeUpstream (upstream: string | URL): BalancedPool
|
||||
getUpstream (upstream: string | URL): Pool | undefined
|
||||
upstreams: Array<string>
|
||||
|
||||
/** `true` after `pool.close()` has been called. */
|
||||
|
||||
+7
@@ -38,6 +38,13 @@ declare namespace CacheHandler {
|
||||
* @default 'shared'
|
||||
*/
|
||||
type?: 'shared' | 'private'
|
||||
|
||||
/**
|
||||
* Array of origins to cache. Only requests to these origins will be cached.
|
||||
* Supports strings (case insensitive) and RegExp patterns.
|
||||
* @default undefined (cache all origins)
|
||||
*/
|
||||
origins?: (string | RegExp)[]
|
||||
}
|
||||
|
||||
export interface CacheControlDirectives {
|
||||
|
||||
+16
-1
@@ -1,4 +1,4 @@
|
||||
import { URL } from 'url'
|
||||
import { URL } from 'node:url'
|
||||
import Dispatcher from './dispatcher'
|
||||
import buildConnector from './connector'
|
||||
import TClientStats from './client-stats'
|
||||
@@ -92,6 +92,21 @@ export declare namespace Client {
|
||||
* @default 100
|
||||
*/
|
||||
maxConcurrentStreams?: number;
|
||||
/**
|
||||
* @description Sets the HTTP/2 stream-level flow-control window size (SETTINGS_INITIAL_WINDOW_SIZE).
|
||||
* @default 262144
|
||||
*/
|
||||
initialWindowSize?: number;
|
||||
/**
|
||||
* @description Sets the HTTP/2 connection-level flow-control window size (ClientHttp2Session.setLocalWindowSize).
|
||||
* @default 524288
|
||||
*/
|
||||
connectionWindowSize?: number;
|
||||
/**
|
||||
* @description Time interval between PING frames dispatch
|
||||
* @default 60000
|
||||
*/
|
||||
pingInterval?: number;
|
||||
}
|
||||
export interface SocketInfo {
|
||||
localAddress?: string
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
import { TLSSocket, ConnectionOptions } from 'tls'
|
||||
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'net'
|
||||
import { TLSSocket, ConnectionOptions } from 'node:tls'
|
||||
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'node:net'
|
||||
|
||||
export default buildConnector
|
||||
declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector
|
||||
@@ -13,6 +13,7 @@ declare namespace buildConnector {
|
||||
port?: number;
|
||||
keepAlive?: boolean | null;
|
||||
keepAliveInitialDelay?: number | null;
|
||||
typeOfService?: number | null;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
@@ -22,6 +23,7 @@ declare namespace buildConnector {
|
||||
port: string
|
||||
servername?: string
|
||||
localAddress?: string | null
|
||||
socketPath?: string | null
|
||||
httpSocket?: Socket
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { Socket } from 'net'
|
||||
import { URL } from 'url'
|
||||
import { Socket } from 'node:net'
|
||||
import { URL } from 'node:url'
|
||||
import buildConnector from './connector'
|
||||
import Dispatcher from './dispatcher'
|
||||
|
||||
|
||||
+20
-17
@@ -1,7 +1,7 @@
|
||||
import { URL } from 'url'
|
||||
import { Duplex, Readable, Writable } from 'stream'
|
||||
import { EventEmitter } from 'events'
|
||||
import { Blob } from 'buffer'
|
||||
import { URL } from 'node:url'
|
||||
import { Duplex, Readable, Writable } from 'node:stream'
|
||||
import { EventEmitter } from 'node:events'
|
||||
import { Blob } from 'node:buffer'
|
||||
import { IncomingHttpHeaders } from './header'
|
||||
import BodyReadable from './readable'
|
||||
import { FormData } from './formdata'
|
||||
@@ -19,30 +19,30 @@ declare class Dispatcher extends EventEmitter {
|
||||
/** 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. */
|
||||
dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
|
||||
/** Starts two-way communications with the requested resource. */
|
||||
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>
|
||||
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void
|
||||
connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>
|
||||
/** Compose a chain of dispatchers */
|
||||
compose (dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
|
||||
compose (...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
|
||||
/** Performs an HTTP request. */
|
||||
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>
|
||||
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void
|
||||
request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>
|
||||
/** For easy use with `stream.pipeline`. */
|
||||
pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex
|
||||
/** A faster version of `Dispatcher.request`. */
|
||||
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>
|
||||
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void
|
||||
stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>
|
||||
/** Upgrade to a different protocol. */
|
||||
upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>
|
||||
upgrade (options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void
|
||||
upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>
|
||||
/** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
|
||||
close (): Promise<void>
|
||||
close (callback: () => void): void
|
||||
close (): Promise<void>
|
||||
/** 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. */
|
||||
destroy (): Promise<void>
|
||||
destroy (err: Error | null): Promise<void>
|
||||
destroy (callback: () => void): void
|
||||
destroy (err: Error | null, callback: () => void): void
|
||||
destroy (callback: () => void): void
|
||||
destroy (err: Error | null): Promise<void>
|
||||
destroy (): Promise<void>
|
||||
|
||||
on (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
|
||||
on (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
|
||||
@@ -96,7 +96,7 @@ declare class Dispatcher extends EventEmitter {
|
||||
}
|
||||
|
||||
declare namespace Dispatcher {
|
||||
export interface ComposedDispatcher extends Dispatcher {}
|
||||
export interface ComposedDispatcher extends Dispatcher { }
|
||||
export type Dispatch = Dispatcher['dispatch']
|
||||
export type DispatcherComposeInterceptor = (dispatch: Dispatch) => Dispatch
|
||||
export interface DispatchOptions {
|
||||
@@ -113,6 +113,8 @@ declare namespace Dispatcher {
|
||||
idempotent?: boolean;
|
||||
/** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. Defaults to `method !== 'HEAD'`. */
|
||||
blocking?: boolean;
|
||||
/** The IP Type of Service (ToS) value for the request socket. Must be an integer between 0 and 255. Default: `0` */
|
||||
typeOfService?: number | null;
|
||||
/** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
|
||||
upgrade?: boolean | string | null;
|
||||
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
|
||||
@@ -181,6 +183,7 @@ declare namespace Dispatcher {
|
||||
}
|
||||
export interface ResponseData<TOpaque = null> {
|
||||
statusCode: number;
|
||||
statusText: string;
|
||||
headers: IncomingHttpHeaders;
|
||||
body: BodyReadable & BodyMixin;
|
||||
trailers: Record<string, string>;
|
||||
@@ -212,10 +215,10 @@ declare namespace Dispatcher {
|
||||
export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable
|
||||
|
||||
export interface DispatchController {
|
||||
get aborted () : boolean
|
||||
get paused () : boolean
|
||||
get reason () : Error | null
|
||||
abort (reason: Error): void
|
||||
get aborted(): boolean
|
||||
get paused(): boolean
|
||||
get reason(): Error | null
|
||||
abort(reason: Error): void
|
||||
pause(): void
|
||||
resume(): void
|
||||
}
|
||||
|
||||
+17
-1
@@ -154,8 +154,24 @@ declare namespace Errors {
|
||||
code: 'UND_ERR_PRX_TLS'
|
||||
}
|
||||
|
||||
class MaxOriginsReachedError extends UndiciError {
|
||||
export class MaxOriginsReachedError extends UndiciError {
|
||||
name: 'MaxOriginsReachedError'
|
||||
code: 'UND_ERR_MAX_ORIGINS_REACHED'
|
||||
}
|
||||
|
||||
/** SOCKS5 proxy related error. */
|
||||
export class Socks5ProxyError extends UndiciError {
|
||||
constructor (
|
||||
message?: string,
|
||||
code?: string
|
||||
)
|
||||
name: 'Socks5ProxyError'
|
||||
code: string
|
||||
}
|
||||
|
||||
/** WebSocket decompressed message exceeded maximum size. */
|
||||
export class MessageSizeExceededError extends UndiciError {
|
||||
name: 'MessageSizeExceededError'
|
||||
code: 'UND_ERR_WS_MESSAGE_SIZE_EXCEEDED'
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -2,9 +2,9 @@
|
||||
// and https://github.com/node-fetch/node-fetch/blob/914ce6be5ec67a8bab63d68510aabf07cb818b6d/index.d.ts (MIT license)
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Blob } from 'buffer'
|
||||
import { URL, URLSearchParams } from 'url'
|
||||
import { ReadableStream } from 'stream/web'
|
||||
import { Blob } from 'node:buffer'
|
||||
import { URL, URLSearchParams } from 'node:url'
|
||||
import { ReadableStream } from 'node:stream/web'
|
||||
import { FormData } from './formdata'
|
||||
import { HeaderRecord } from './header'
|
||||
import Dispatcher from './dispatcher'
|
||||
@@ -207,5 +207,5 @@ export declare class Response extends BodyMixin {
|
||||
|
||||
static error (): Response
|
||||
static json (data: any, init?: ResponseInit): Response
|
||||
static redirect (url: string | URL, status: ResponseRedirectStatus): Response
|
||||
static redirect (url: string | URL, status?: ResponseRedirectStatus): Response
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// Based on https://github.com/octet-stream/form-data/blob/2d0f0dc371517444ce1f22cdde13f51995d0953a/lib/FormData.ts (MIT)
|
||||
/// <reference types="node" />
|
||||
|
||||
import { File } from 'buffer'
|
||||
import { File } from 'node:buffer'
|
||||
import { SpecIterableIterator } from './fetch'
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { URL } from 'url'
|
||||
import { URL } from 'node:url'
|
||||
import Dispatcher from './dispatcher'
|
||||
import buildConnector from './connector'
|
||||
|
||||
|
||||
+12
-1
@@ -5,6 +5,7 @@ import Pool from './pool'
|
||||
import { RedirectHandler, DecoratorHandler } from './handlers'
|
||||
|
||||
import BalancedPool from './balanced-pool'
|
||||
import RoundRobinPool from './round-robin-pool'
|
||||
import Client from './client'
|
||||
import H2CClient from './h2c-client'
|
||||
import buildConnector from './connector'
|
||||
@@ -17,12 +18,19 @@ import { SnapshotAgent } from './snapshot-agent'
|
||||
import { MockCallHistory, MockCallHistoryLog } from './mock-call-history'
|
||||
import mockErrors from './mock-errors'
|
||||
import ProxyAgent from './proxy-agent'
|
||||
import Socks5ProxyAgent from './socks5-proxy-agent'
|
||||
import EnvHttpProxyAgent from './env-http-proxy-agent'
|
||||
import RetryHandler from './retry-handler'
|
||||
import RetryAgent from './retry-agent'
|
||||
import { request, pipeline, stream, connect, upgrade } from './api'
|
||||
import interceptors from './interceptors'
|
||||
|
||||
import CacheInterceptor from './cache-interceptor'
|
||||
declare const cacheStores: {
|
||||
MemoryCacheStore: typeof CacheInterceptor.MemoryCacheStore;
|
||||
SqliteCacheStore: typeof CacheInterceptor.SqliteCacheStore;
|
||||
}
|
||||
|
||||
export * from './util'
|
||||
export * from './cookies'
|
||||
export * from './eventsource'
|
||||
@@ -36,7 +44,7 @@ export { Interceptable } from './mock-interceptor'
|
||||
|
||||
declare function globalThisInstall (): void
|
||||
|
||||
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 }
|
||||
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, Socks5ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
|
||||
export default Undici
|
||||
|
||||
declare namespace Undici {
|
||||
@@ -46,6 +54,7 @@ declare namespace Undici {
|
||||
const DecoratorHandler: typeof import ('./handlers').DecoratorHandler
|
||||
const RetryHandler: typeof import ('./retry-handler').default
|
||||
const BalancedPool: typeof import('./balanced-pool').default
|
||||
const RoundRobinPool: typeof import('./round-robin-pool').default
|
||||
const Client: typeof import('./client').default
|
||||
const H2CClient: typeof import('./h2c-client').default
|
||||
const buildConnector: typeof import('./connector').default
|
||||
@@ -65,6 +74,8 @@ declare namespace Undici {
|
||||
const MockCallHistory: typeof import('./mock-call-history').MockCallHistory
|
||||
const MockCallHistoryLog: typeof import('./mock-call-history').MockCallHistoryLog
|
||||
const mockErrors: typeof import('./mock-errors').default
|
||||
const ProxyAgent: typeof import('./proxy-agent').default
|
||||
const Socks5ProxyAgent: typeof import('./socks5-proxy-agent').default
|
||||
const fetch: typeof import('./fetch').fetch
|
||||
const Headers: typeof import('./fetch').Headers
|
||||
const Response: typeof import('./fetch').Response
|
||||
|
||||
+43
-2
@@ -19,14 +19,54 @@ declare namespace Interceptors {
|
||||
|
||||
// DNS interceptor
|
||||
export type DNSInterceptorRecord = { address: string, ttl: number, family: 4 | 6 }
|
||||
export type DNSInterceptorOriginRecords = { 4: { ips: DNSInterceptorRecord[] } | null, 6: { ips: DNSInterceptorRecord[] } | null }
|
||||
export type DNSInterceptorOriginRecords = { records: { 4: { ips: DNSInterceptorRecord[] } | null, 6: { ips: DNSInterceptorRecord[] } | null } }
|
||||
export type DNSStorage = {
|
||||
size: number
|
||||
get(origin: string): DNSInterceptorOriginRecords | null
|
||||
set(origin: string, records: DNSInterceptorOriginRecords | null, options: { ttl: number }): void
|
||||
delete(origin: string): void
|
||||
full(): boolean
|
||||
}
|
||||
export type DNSInterceptorOpts = {
|
||||
maxTTL?: number
|
||||
maxItems?: number
|
||||
lookup?: (hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void
|
||||
lookup?: (origin: URL, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void
|
||||
pick?: (origin: URL, records: DNSInterceptorOriginRecords, affinity: 4 | 6) => DNSInterceptorRecord
|
||||
dualStack?: boolean
|
||||
affinity?: 4 | 6
|
||||
storage?: DNSStorage
|
||||
}
|
||||
|
||||
// Deduplicate interceptor
|
||||
export type DeduplicateMethods = 'GET' | 'HEAD' | 'OPTIONS' | 'TRACE'
|
||||
export type DeduplicateInterceptorOpts = {
|
||||
/**
|
||||
* The HTTP methods to deduplicate.
|
||||
* Note: Only safe HTTP methods can be deduplicated.
|
||||
* @default ['GET']
|
||||
*/
|
||||
methods?: DeduplicateMethods[]
|
||||
/**
|
||||
* Header names that, if present in a request, will cause the request to skip deduplication.
|
||||
* Header name matching is case-insensitive.
|
||||
* @default []
|
||||
*/
|
||||
skipHeaderNames?: string[]
|
||||
/**
|
||||
* Header names to exclude from the deduplication key.
|
||||
* Requests with different values for these headers will still be deduplicated together.
|
||||
* Useful for headers like `x-request-id` that vary per request but shouldn't affect deduplication.
|
||||
* Header name matching is case-insensitive.
|
||||
* @default []
|
||||
*/
|
||||
excludeHeaderNames?: string[]
|
||||
/**
|
||||
* Maximum bytes buffered per paused waiting deduplicated handler.
|
||||
* If a waiting handler remains paused and exceeds this threshold,
|
||||
* it is failed with an abort error to prevent unbounded memory growth.
|
||||
* @default 5 * 1024 * 1024
|
||||
*/
|
||||
maxBufferSize?: number
|
||||
}
|
||||
|
||||
export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
||||
@@ -36,4 +76,5 @@ declare namespace Interceptors {
|
||||
export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
||||
export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
||||
export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
||||
export function deduplicate (opts?: DeduplicateInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "undici-types",
|
||||
"version": "7.16.0",
|
||||
"version": "7.24.6",
|
||||
"description": "A stand-alone types package for Undici",
|
||||
"homepage": "https://undici.nodejs.org",
|
||||
"bugs": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import Client from './client'
|
||||
import TPoolStats from './pool-stats'
|
||||
import { URL } from 'url'
|
||||
import { URL } from 'node:url'
|
||||
import Dispatcher from './dispatcher'
|
||||
|
||||
export default Pool
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { Readable } from 'stream'
|
||||
import { Blob } from 'buffer'
|
||||
import { Readable } from 'node:stream'
|
||||
import { Blob } from 'node:buffer'
|
||||
|
||||
export default BodyReadable
|
||||
|
||||
|
||||
+6
@@ -1,4 +1,5 @@
|
||||
// These types are not exported, and are only used internally
|
||||
import { BufferSource } from 'node:stream/web'
|
||||
import * as undici from './index'
|
||||
|
||||
/**
|
||||
@@ -93,6 +94,11 @@ interface WebidlUtil {
|
||||
IsResizableArrayBuffer (V: ArrayBufferLike): boolean
|
||||
|
||||
HasFlag (flag: number, attributes: number): boolean
|
||||
|
||||
/**
|
||||
* @see https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy
|
||||
*/
|
||||
getCopyOfBytesHeldByBufferSource (bufferSource: BufferSource): Uint8Array
|
||||
}
|
||||
|
||||
interface WebidlConverters {
|
||||
|
||||
+11
-9
@@ -1,8 +1,8 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import type { Blob } from 'buffer'
|
||||
import type { ReadableStream, WritableStream } from 'stream/web'
|
||||
import type { MessagePort } from 'worker_threads'
|
||||
import type { Blob } from 'node:buffer'
|
||||
import type { ReadableStream, WritableStream } from 'node:stream/web'
|
||||
import type { MessagePort } from 'node:worker_threads'
|
||||
import {
|
||||
EventInit,
|
||||
EventListenerOptions,
|
||||
@@ -96,16 +96,16 @@ interface MessageEventInit<T = any> extends EventInit {
|
||||
data?: T
|
||||
lastEventId?: string
|
||||
origin?: string
|
||||
ports?: (typeof MessagePort)[]
|
||||
source?: typeof MessagePort | null
|
||||
ports?: MessagePort[]
|
||||
source?: MessagePort | null
|
||||
}
|
||||
|
||||
interface MessageEvent<T = any> extends Event {
|
||||
readonly data: T
|
||||
readonly lastEventId: string
|
||||
readonly origin: string
|
||||
readonly ports: ReadonlyArray<typeof MessagePort>
|
||||
readonly source: typeof MessagePort | null
|
||||
readonly ports: readonly MessagePort[]
|
||||
readonly source: MessagePort | null
|
||||
initMessageEvent(
|
||||
type: string,
|
||||
bubbles?: boolean,
|
||||
@@ -113,8 +113,8 @@ interface MessageEvent<T = any> extends Event {
|
||||
data?: any,
|
||||
origin?: string,
|
||||
lastEventId?: string,
|
||||
source?: typeof MessagePort | null,
|
||||
ports?: (typeof MessagePort)[]
|
||||
source?: MessagePort | null,
|
||||
ports?: MessagePort[]
|
||||
): void;
|
||||
}
|
||||
|
||||
@@ -169,6 +169,8 @@ interface WebSocketStream {
|
||||
writable: WritableStream
|
||||
}>
|
||||
url: string
|
||||
|
||||
close(options?: Partial<WebSocketCloseInfo>): void
|
||||
}
|
||||
|
||||
export declare const WebSocketStream: {
|
||||
|
||||
Reference in New Issue
Block a user