Update Fix

This commit is contained in:
2026-03-15 12:30:40 +01:00
parent 311ba5e7f3
commit 50be8e25f3
176 changed files with 4075 additions and 3013 deletions

View File

@@ -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'

4
node_modules/undici-types/api.d.ts generated vendored
View File

@@ -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. */

View File

@@ -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. */

View File

@@ -38,6 +38,7 @@ declare namespace CacheHandler {
* @default 'shared'
*/
type?: 'shared' | 'private'
}
export interface CacheControlDirectives {

View File

@@ -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'

View File

@@ -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

View File

@@ -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'

View File

@@ -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

View File

@@ -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
}

View File

@@ -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'
/**

View File

@@ -1,4 +1,4 @@
import { URL } from 'url'
import { URL } from 'node:url'
import Dispatcher from './dispatcher'
import buildConnector from './connector'

10
node_modules/undici-types/index.d.ts generated vendored
View File

@@ -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'
@@ -23,6 +24,12 @@ 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 +43,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, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
export default Undici
declare namespace Undici {
@@ -46,6 +53,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

View File

@@ -19,14 +19,47 @@ 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[]
}
export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
@@ -36,4 +69,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
}

View File

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

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}