This commit is contained in:
2026-03-15 12:22:42 +01:00
parent cd99275933
commit 311ba5e7f3
558 changed files with 55182 additions and 22981 deletions

View File

@@ -22,14 +22,11 @@ declare namespace Agent {
export interface Options extends Pool.Options {
/** Default: `(origin, opts) => new Pool(origin, opts)`. */
factory?(origin: string | URL, opts: Object): Dispatcher;
/** Integer. Default: `0` */
maxRedirections?: number;
interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options['interceptors']
maxOrigins?: number
}
export interface DispatchOptions extends Dispatcher.DispatchOptions {
/** Integer. */
maxRedirections?: number;
}
}

View File

@@ -71,8 +71,6 @@ export declare namespace Client {
/** TODO */
maxCachedSessions?: number;
/** TODO */
maxRedirections?: number;
/** TODO */
connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
/** TODO */
maxRequestsPerClient?: number;

View File

@@ -16,7 +16,6 @@ declare namespace DiagnosticsChannel {
statusText: string;
headers: Array<Buffer>;
}
type Error = unknown
interface ConnectParams {
host: URL['host'];
hostname: URL['hostname'];

View File

@@ -135,8 +135,6 @@ declare namespace Dispatcher {
signal?: AbortSignal | EventEmitter | null;
/** This argument parameter is passed through to `ConnectData` */
opaque?: TOpaque;
/** Default: 0 */
maxRedirections?: number;
/** Default: false */
redirectionLimitReached?: boolean;
/** Default: `null` */
@@ -147,8 +145,6 @@ declare namespace Dispatcher {
opaque?: TOpaque;
/** Default: `null` */
signal?: AbortSignal | EventEmitter | null;
/** Default: 0 */
maxRedirections?: number;
/** Default: false */
redirectionLimitReached?: boolean;
/** Default: `null` */
@@ -172,8 +168,6 @@ declare namespace Dispatcher {
protocol?: string;
/** Default: `null` */
signal?: AbortSignal | EventEmitter | null;
/** Default: 0 */
maxRedirections?: number;
/** Default: false */
redirectionLimitReached?: boolean;
/** Default: `null` */

View File

@@ -49,21 +49,6 @@ declare namespace Errors {
headers: IncomingHttpHeaders | string[] | null
}
export class ResponseStatusCodeError extends UndiciError {
constructor (
message?: string,
statusCode?: number,
headers?: IncomingHttpHeaders | string[] | null,
body?: null | Record<string, any> | string
)
name: 'ResponseStatusCodeError'
code: 'UND_ERR_RESPONSE_STATUS_CODE'
body: null | Record<string, any> | string
status: number
statusCode: number
headers: IncomingHttpHeaders | string[] | null
}
/** Passed an invalid argument. */
export class InvalidArgumentError extends UndiciError {
name: 'InvalidArgumentError'
@@ -168,4 +153,9 @@ declare namespace Errors {
name: 'SecureProxyConnectionError'
code: 'UND_ERR_PRX_TLS'
}
class MaxOriginsReachedError extends UndiciError {
name: 'MaxOriginsReachedError'
code: 'UND_ERR_MAX_ORIGINS_REACHED'
}
}

View File

@@ -56,6 +56,11 @@ export declare const EventSource: {
}
interface EventSourceInit {
withCredentials?: boolean,
withCredentials?: boolean
// @deprecated use `node.dispatcher` instead
dispatcher?: Dispatcher
node?: {
dispatcher?: Dispatcher
reconnectionTime?: number
}
}

View File

@@ -51,8 +51,6 @@ export declare namespace H2CClient {
/** TODO */
maxCachedSessions?: number;
/** TODO */
maxRedirections?: number;
/** TODO */
connect?: Omit<Partial<buildConnector.BuildOptions>, 'allowH2'> | buildConnector.connector;
/** TODO */
maxRequestsPerClient?: number;

View File

@@ -13,6 +13,7 @@ import Agent from './agent'
import MockClient from './mock-client'
import MockPool from './mock-pool'
import MockAgent from './mock-agent'
import { SnapshotAgent } from './snapshot-agent'
import { MockCallHistory, MockCallHistoryLog } from './mock-call-history'
import mockErrors from './mock-errors'
import ProxyAgent from './proxy-agent'
@@ -33,7 +34,9 @@ export * from './content-type'
export * from './cache'
export { Interceptable } from './mock-interceptor'
export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient }
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 default Undici
declare namespace Undici {
@@ -58,6 +61,7 @@ declare namespace Undici {
const MockClient: typeof import('./mock-client').default
const MockPool: typeof import('./mock-pool').default
const MockAgent: typeof import('./mock-agent').default
const SnapshotAgent: typeof import('./snapshot-agent').SnapshotAgent
const MockCallHistory: typeof import('./mock-call-history').MockCallHistory
const MockCallHistoryLog: typeof import('./mock-call-history').MockCallHistoryLog
const mockErrors: typeof import('./mock-errors').default
@@ -72,4 +76,5 @@ declare namespace Undici {
MemoryCacheStore: typeof import('./cache-interceptor').default.MemoryCacheStore,
SqliteCacheStore: typeof import('./cache-interceptor').default.SqliteCacheStore
}
const install: typeof globalThisInstall
}

View File

@@ -9,6 +9,10 @@ declare namespace Interceptors {
export type DumpInterceptorOpts = { maxSize?: number }
export type RetryInterceptorOpts = RetryHandler.RetryOptions
export type RedirectInterceptorOpts = { maxRedirections?: number }
export type DecompressInterceptorOpts = {
skipErrorResponses?: boolean
skipStatusCodes?: number[]
}
export type ResponseErrorInterceptorOpts = { throwOnError: boolean }
export type CacheInterceptorOpts = CacheHandler.CacheOptions
@@ -28,6 +32,7 @@ declare namespace Interceptors {
export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function retry (opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function redirect (opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function decompress (opts?: DecompressInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor

View File

@@ -69,7 +69,6 @@ declare namespace MockInterceptor {
headers?: Headers | Record<string, string>;
origin?: string;
body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
maxRedirections?: number;
}
export type MockResponseDataHandler<TData extends object = object> = (

View File

@@ -1,6 +1,6 @@
{
"name": "undici-types",
"version": "7.12.0",
"version": "7.16.0",
"description": "A stand-alone types package for Undici",
"homepage": "https://undici.nodejs.org",
"bugs": {

105
node_modules/undici-types/webidl.d.ts generated vendored
View File

@@ -10,11 +10,6 @@ type SequenceConverter<T> = (object: unknown, iterable?: IterableIterator<T>) =>
type RecordConverter<K extends string, V> = (object: unknown) => Record<K, V>
interface ConvertToIntOpts {
clamp?: boolean
enforceRange?: boolean
}
interface WebidlErrors {
/**
* @description Instantiate an error
@@ -74,7 +69,7 @@ interface WebidlUtil {
V: unknown,
bitLength: number,
signedness: 'signed' | 'unsigned',
opts?: ConvertToIntOpts
flags?: number
): number
/**
@@ -94,15 +89,17 @@ interface WebidlUtil {
* This is only effective in some newer Node.js versions.
*/
markAsUncloneable (V: any): void
IsResizableArrayBuffer (V: ArrayBufferLike): boolean
HasFlag (flag: number, attributes: number): boolean
}
interface WebidlConverters {
/**
* @see https://webidl.spec.whatwg.org/#es-DOMString
*/
DOMString (V: unknown, prefix: string, argument: string, opts?: {
legacyNullToEmptyString: boolean
}): string
DOMString (V: unknown, prefix: string, argument: string, flags?: number): string
/**
* @see https://webidl.spec.whatwg.org/#es-ByteString
@@ -142,39 +139,78 @@ interface WebidlConverters {
/**
* @see https://webidl.spec.whatwg.org/#es-unsigned-short
*/
['unsigned short'] (V: unknown, opts?: ConvertToIntOpts): number
['unsigned short'] (V: unknown, flags?: number): number
/**
* @see https://webidl.spec.whatwg.org/#idl-ArrayBuffer
*/
ArrayBuffer (V: unknown): ArrayBufferLike
ArrayBuffer (V: unknown, opts: { allowShared: false }): ArrayBuffer
ArrayBuffer (
V: unknown,
prefix: string,
argument: string,
options?: { allowResizable: boolean }
): ArrayBuffer
/**
* @see https://webidl.spec.whatwg.org/#idl-SharedArrayBuffer
*/
SharedArrayBuffer (
V: unknown,
prefix: string,
argument: string,
options?: { allowResizable: boolean }
): SharedArrayBuffer
/**
* @see https://webidl.spec.whatwg.org/#es-buffer-source-types
*/
TypedArray (
V: unknown,
TypedArray: NodeJS.TypedArray | ArrayBufferLike
): NodeJS.TypedArray | ArrayBufferLike
TypedArray (
V: unknown,
TypedArray: NodeJS.TypedArray | ArrayBufferLike,
opts?: { allowShared: false }
): NodeJS.TypedArray | ArrayBuffer
T: new () => NodeJS.TypedArray,
prefix: string,
argument: string,
flags?: number
): NodeJS.TypedArray
/**
* @see https://webidl.spec.whatwg.org/#es-buffer-source-types
*/
DataView (V: unknown, opts?: { allowShared: boolean }): DataView
DataView (
V: unknown,
prefix: string,
argument: string,
flags?: number
): DataView
/**
* @see https://webidl.spec.whatwg.org/#es-buffer-source-types
*/
ArrayBufferView (
V: unknown,
prefix: string,
argument: string,
flags?: number
): NodeJS.ArrayBufferView
/**
* @see https://webidl.spec.whatwg.org/#BufferSource
*/
BufferSource (
V: unknown,
opts?: { allowShared: boolean }
): NodeJS.TypedArray | ArrayBufferLike | DataView
prefix: string,
argument: string,
flags?: number
): ArrayBuffer | NodeJS.ArrayBufferView
/**
* @see https://webidl.spec.whatwg.org/#AllowSharedBufferSource
*/
AllowSharedBufferSource (
V: unknown,
prefix: string,
argument: string,
flags?: number
): ArrayBuffer | SharedArrayBuffer | NodeJS.ArrayBufferView
['sequence<ByteString>']: SequenceConverter<string>
@@ -192,6 +228,13 @@ interface WebidlConverters {
*/
RequestInit (V: unknown): undici.RequestInit
/**
* @see https://html.spec.whatwg.org/multipage/webappapis.html#eventhandlernonnull
*/
EventHandlerNonNull (V: unknown): Function | null
WebSocketStreamWrite (V: unknown): ArrayBuffer | NodeJS.TypedArray | string
[Key: string]: (...args: any[]) => unknown
}
@@ -210,6 +253,10 @@ interface WebidlIs {
AbortSignal: WebidlIsFunction<AbortSignal>
MessagePort: WebidlIsFunction<MessagePort>
USVString: WebidlIsFunction<string>
/**
* @see https://webidl.spec.whatwg.org/#BufferSource
*/
BufferSource: WebidlIsFunction<ArrayBuffer | NodeJS.TypedArray>
}
export interface Webidl {
@@ -217,6 +264,7 @@ export interface Webidl {
util: WebidlUtil
converters: WebidlConverters
is: WebidlIs
attributes: WebIDLExtendedAttributes
/**
* @description Performs a brand-check on {@param V} to ensure it is a
@@ -278,3 +326,16 @@ export interface Webidl {
argumentLengthCheck (args: { length: number }, min: number, context: string): void
}
interface WebIDLExtendedAttributes {
/** https://webidl.spec.whatwg.org/#Clamp */
Clamp: number
/** https://webidl.spec.whatwg.org/#EnforceRange */
EnforceRange: number
/** https://webidl.spec.whatwg.org/#AllowShared */
AllowShared: number
/** https://webidl.spec.whatwg.org/#AllowResizable */
AllowResizable: number
/** https://webidl.spec.whatwg.org/#LegacyNullToEmptyString */
LegacyNullToEmptyString: number
}