Bump dependencies (#424)

This commit is contained in:
Kevin Stillhammer
2025-05-23 09:57:11 +02:00
committed by GitHub
parent e3d2ea5ff3
commit f0ec1fc3b3
5 changed files with 1407 additions and 704 deletions

62
dist/save-cache/index.js generated vendored
View File

@@ -13417,7 +13417,7 @@ module.exports = {
const { parseSetCookie } = __nccwpck_require__(7803)
const { stringify, getHeadersList } = __nccwpck_require__(6338)
const { stringify } = __nccwpck_require__(6338)
const { webidl } = __nccwpck_require__(8134)
const { Headers } = __nccwpck_require__(9061)
@@ -13493,14 +13493,13 @@ function getSetCookies (headers) {
webidl.brandCheck(headers, Headers, { strict: false })
const cookies = getHeadersList(headers).cookies
const cookies = headers.getSetCookie()
if (!cookies) {
return []
}
// In older versions of undici, cookies is a list of name:value.
return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair))
return cookies.map((pair) => parseSetCookie(pair))
}
/**
@@ -13928,14 +13927,15 @@ module.exports = {
/***/ }),
/***/ 6338:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
/***/ ((module) => {
"use strict";
const assert = __nccwpck_require__(2613)
const { kHeadersList } = __nccwpck_require__(9411)
/**
* @param {string} value
* @returns {boolean}
*/
function isCTLExcludingHtab (value) {
if (value.length === 0) {
return false
@@ -14196,31 +14196,13 @@ function stringify (cookie) {
return out.join('; ')
}
let kHeadersListNode
function getHeadersList (headers) {
if (headers[kHeadersList]) {
return headers[kHeadersList]
}
if (!kHeadersListNode) {
kHeadersListNode = Object.getOwnPropertySymbols(headers).find(
(symbol) => symbol.description === 'headers list'
)
assert(kHeadersListNode, 'Headers cannot be parsed')
}
const headersList = headers[kHeadersListNode]
assert(headersList)
return headersList
}
module.exports = {
isCTLExcludingHtab,
stringify,
getHeadersList
validateCookieName,
validateCookiePath,
validateCookieValue,
toIMFDate,
stringify
}
@@ -18224,6 +18206,7 @@ const {
isValidHeaderName,
isValidHeaderValue
} = __nccwpck_require__(555)
const util = __nccwpck_require__(9023)
const { webidl } = __nccwpck_require__(8134)
const assert = __nccwpck_require__(2613)
@@ -18777,6 +18760,9 @@ Object.defineProperties(Headers.prototype, {
[Symbol.toStringTag]: {
value: 'Headers',
configurable: true
},
[util.inspect.custom]: {
enumerable: false
}
})
@@ -27953,6 +27939,20 @@ class Pool extends PoolBase {
? { ...options.interceptors }
: undefined
this[kFactory] = factory
this.on('connectionError', (origin, targets, error) => {
// If a connection error occurs, we remove the client from the pool,
// and emit a connectionError event. They will not be re-used.
// Fixes https://github.com/nodejs/undici/issues/3895
for (const target of targets) {
// Do not use kRemoveClient here, as it will close the client,
// but the client cannot be closed in this state.
const idx = this[kClients].indexOf(target)
if (idx !== -1) {
this[kClients].splice(idx, 1)
}
}
})
}
[kGetDispatcher] () {

858
dist/setup/index.js generated vendored
View File

@@ -13417,7 +13417,7 @@ module.exports = {
const { parseSetCookie } = __nccwpck_require__(17803)
const { stringify, getHeadersList } = __nccwpck_require__(46338)
const { stringify } = __nccwpck_require__(46338)
const { webidl } = __nccwpck_require__(8134)
const { Headers } = __nccwpck_require__(29061)
@@ -13493,14 +13493,13 @@ function getSetCookies (headers) {
webidl.brandCheck(headers, Headers, { strict: false })
const cookies = getHeadersList(headers).cookies
const cookies = headers.getSetCookie()
if (!cookies) {
return []
}
// In older versions of undici, cookies is a list of name:value.
return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair))
return cookies.map((pair) => parseSetCookie(pair))
}
/**
@@ -13928,14 +13927,15 @@ module.exports = {
/***/ }),
/***/ 46338:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
/***/ ((module) => {
"use strict";
const assert = __nccwpck_require__(42613)
const { kHeadersList } = __nccwpck_require__(99411)
/**
* @param {string} value
* @returns {boolean}
*/
function isCTLExcludingHtab (value) {
if (value.length === 0) {
return false
@@ -14196,31 +14196,13 @@ function stringify (cookie) {
return out.join('; ')
}
let kHeadersListNode
function getHeadersList (headers) {
if (headers[kHeadersList]) {
return headers[kHeadersList]
}
if (!kHeadersListNode) {
kHeadersListNode = Object.getOwnPropertySymbols(headers).find(
(symbol) => symbol.description === 'headers list'
)
assert(kHeadersListNode, 'Headers cannot be parsed')
}
const headersList = headers[kHeadersListNode]
assert(headersList)
return headersList
}
module.exports = {
isCTLExcludingHtab,
stringify,
getHeadersList
validateCookieName,
validateCookiePath,
validateCookieValue,
toIMFDate,
stringify
}
@@ -18224,6 +18206,7 @@ const {
isValidHeaderName,
isValidHeaderValue
} = __nccwpck_require__(30555)
const util = __nccwpck_require__(39023)
const { webidl } = __nccwpck_require__(8134)
const assert = __nccwpck_require__(42613)
@@ -18777,6 +18760,9 @@ Object.defineProperties(Headers.prototype, {
[Symbol.toStringTag]: {
value: 'Headers',
configurable: true
},
[util.inspect.custom]: {
enumerable: false
}
})
@@ -27953,6 +27939,20 @@ class Pool extends PoolBase {
? { ...options.interceptors }
: undefined
this[kFactory] = factory
this.on('connectionError', (origin, targets, error) => {
// If a connection error occurs, we remove the client from the pool,
// and emit a connectionError event. They will not be re-used.
// Fixes https://github.com/nodejs/undici/issues/3895
for (const target of targets) {
// Do not use kRemoveClient here, as it will close the client,
// but the client cannot be closed in this state.
const idx = this[kClients].indexOf(target)
if (idx !== -1) {
this[kClients].splice(idx, 1)
}
}
})
}
[kGetDispatcher] () {
@@ -83360,6 +83360,7 @@ const Agent = __nccwpck_require__(57405)
const ProxyAgent = __nccwpck_require__(76672)
const EnvHttpProxyAgent = __nccwpck_require__(53137)
const RetryAgent = __nccwpck_require__(30050)
const H2CClient = __nccwpck_require__(36815)
const errors = __nccwpck_require__(68707)
const util = __nccwpck_require__(3440)
const { InvalidArgumentError } = errors
@@ -83385,6 +83386,7 @@ module.exports.Agent = Agent
module.exports.ProxyAgent = ProxyAgent
module.exports.EnvHttpProxyAgent = EnvHttpProxyAgent
module.exports.RetryAgent = RetryAgent
module.exports.H2CClient = H2CClient
module.exports.RetryHandler = RetryHandler
module.exports.DecoratorHandler = DecoratorHandler
@@ -85110,6 +85112,7 @@ module.exports = {
const { Writable } = __nccwpck_require__(57075)
const { EventEmitter } = __nccwpck_require__(78474)
const { assertCacheKey, assertCacheValue } = __nccwpck_require__(47659)
/**
@@ -85121,8 +85124,9 @@ const { assertCacheKey, assertCacheValue } = __nccwpck_require__(47659)
/**
* @implements {CacheStore}
* @extends {EventEmitter}
*/
class MemoryCacheStore {
class MemoryCacheStore extends EventEmitter {
#maxCount = Infinity
#maxSize = Infinity
#maxEntrySize = Infinity
@@ -85130,11 +85134,13 @@ class MemoryCacheStore {
#size = 0
#count = 0
#entries = new Map()
#hasEmittedMaxSizeEvent = false
/**
* @param {import('../../types/cache-interceptor.d.ts').default.MemoryCacheStoreOpts | undefined} [opts]
*/
constructor (opts) {
super()
if (opts) {
if (typeof opts !== 'object') {
throw new TypeError('MemoryCacheStore options must be an object')
@@ -85175,6 +85181,22 @@ class MemoryCacheStore {
}
}
/**
* Get the current size of the cache in bytes
* @returns {number} The current size of the cache in bytes
*/
get size () {
return this.#size
}
/**
* Check if the cache is full (either max size or max count reached)
* @returns {boolean} True if the cache is full, false otherwise
*/
isFull () {
return this.#size >= this.#maxSize || this.#count >= this.#maxCount
}
/**
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} req
* @returns {import('../../types/cache-interceptor.d.ts').default.GetResult | undefined}
@@ -85185,17 +85207,9 @@ class MemoryCacheStore {
const topLevelKey = `${key.origin}:${key.path}`
const now = Date.now()
const entry = this.#entries.get(topLevelKey)?.find((entry) => (
entry.deleteAt > now &&
entry.method === key.method &&
(entry.vary == null || Object.keys(entry.vary).every(headerName => {
if (entry.vary[headerName] === null) {
return key.headers[headerName] === undefined
}
const entries = this.#entries.get(topLevelKey)
return entry.vary[headerName] === key.headers[headerName]
}))
))
const entry = entries ? findEntry(key, entries, now) : null
return entry == null
? undefined
@@ -85249,12 +85263,32 @@ class MemoryCacheStore {
entries = []
store.#entries.set(topLevelKey, entries)
}
entries.push(entry)
const previousEntry = findEntry(key, entries, Date.now())
if (previousEntry) {
const index = entries.indexOf(previousEntry)
entries.splice(index, 1, entry)
store.#size -= previousEntry.size
} else {
entries.push(entry)
store.#count += 1
}
store.#size += entry.size
store.#count += 1
// Check if cache is full and emit event if needed
if (store.#size > store.#maxSize || store.#count > store.#maxCount) {
// Emit maxSizeExceeded event if we haven't already
if (!store.#hasEmittedMaxSizeEvent) {
store.emit('maxSizeExceeded', {
size: store.#size,
maxSize: store.#maxSize,
count: store.#count,
maxCount: store.#maxCount
})
store.#hasEmittedMaxSizeEvent = true
}
// Perform eviction
for (const [key, entries] of store.#entries) {
for (const entry of entries.splice(0, entries.length / 2)) {
store.#size -= entry.size
@@ -85264,6 +85298,11 @@ class MemoryCacheStore {
store.#entries.delete(key)
}
}
// Reset the event flag after eviction
if (store.#size < store.#maxSize && store.#count < store.#maxCount) {
store.#hasEmittedMaxSizeEvent = false
}
}
callback(null)
@@ -85289,6 +85328,20 @@ class MemoryCacheStore {
}
}
function findEntry (key, entries, now) {
return entries.find((entry) => (
entry.deleteAt > now &&
entry.method === key.method &&
(entry.vary == null || Object.keys(entry.vary).every(headerName => {
if (entry.vary[headerName] === null) {
return key.headers[headerName] === undefined
}
return entry.vary[headerName] === key.headers[headerName]
}))
))
}
module.exports = MemoryCacheStore
@@ -85415,6 +85468,11 @@ module.exports = class SqliteCacheStore {
this.#db = new DatabaseSync(opts?.location ?? ':memory:')
this.#db.exec(`
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA temp_store = memory;
PRAGMA optimize;
CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION} (
-- Data specific to us
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -85434,9 +85492,8 @@ module.exports = class SqliteCacheStore {
staleAt INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_url ON cacheInterceptorV${VERSION}(url);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_method ON cacheInterceptorV${VERSION}(method);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_deleteAt ON cacheInterceptorV${VERSION}(deleteAt);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_getValuesQuery ON cacheInterceptorV${VERSION}(url, method, deleteAt);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_deleteByUrlQuery ON cacheInterceptorV${VERSION}(deleteAt);
`)
this.#getValuesQuery = this.#db.prepare(`
@@ -85646,7 +85703,7 @@ module.exports = class SqliteCacheStore {
}
#prune () {
if (this.size <= this.#maxCount) {
if (Number.isFinite(this.#maxCount) && this.size <= this.#maxCount) {
return 0
}
@@ -85768,10 +85825,7 @@ function headerValueEquals (lhs, rhs) {
const net = __nccwpck_require__(77030)
const assert = __nccwpck_require__(34589)
const util = __nccwpck_require__(3440)
const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(68707)
const timers = __nccwpck_require__(96603)
function noop () {}
const { InvalidArgumentError } = __nccwpck_require__(68707)
let tls // include tls conditionally since it is not always available
@@ -85871,7 +85925,6 @@ function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, sess
servername,
session,
localAddress,
// TODO(HTTP/2): Add support for h2c
ALPNProtocols: allowH2 ? ['http/1.1', 'h2'] : ['http/1.1'],
socket: httpSocket, // upgrade socket connection
port,
@@ -85903,7 +85956,7 @@ function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, sess
socket.setKeepAlive(true, keepAliveInitialDelay)
}
const clearConnectTimeout = setupConnectTimeout(new WeakRef(socket), { timeout, hostname, port })
const clearConnectTimeout = util.setupConnectTimeout(new WeakRef(socket), { timeout, hostname, port })
socket
.setNoDelay(true)
@@ -85930,78 +85983,6 @@ function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, sess
}
}
/**
* @param {WeakRef<net.Socket>} socketWeakRef
* @param {object} opts
* @param {number} opts.timeout
* @param {string} opts.hostname
* @param {number} opts.port
* @returns {() => void}
*/
const setupConnectTimeout = process.platform === 'win32'
? (socketWeakRef, opts) => {
if (!opts.timeout) {
return noop
}
let s1 = null
let s2 = null
const fastTimer = timers.setFastTimeout(() => {
// setImmediate is added to make sure that we prioritize socket error events over timeouts
s1 = setImmediate(() => {
// Windows needs an extra setImmediate probably due to implementation differences in the socket logic
s2 = setImmediate(() => onConnectTimeout(socketWeakRef.deref(), opts))
})
}, opts.timeout)
return () => {
timers.clearFastTimeout(fastTimer)
clearImmediate(s1)
clearImmediate(s2)
}
}
: (socketWeakRef, opts) => {
if (!opts.timeout) {
return noop
}
let s1 = null
const fastTimer = timers.setFastTimeout(() => {
// setImmediate is added to make sure that we prioritize socket error events over timeouts
s1 = setImmediate(() => {
onConnectTimeout(socketWeakRef.deref(), opts)
})
}, opts.timeout)
return () => {
timers.clearFastTimeout(fastTimer)
clearImmediate(s1)
}
}
/**
* @param {net.Socket} socket
* @param {object} opts
* @param {number} opts.timeout
* @param {string} opts.hostname
* @param {number} opts.port
*/
function onConnectTimeout (socket, opts) {
// The socket could be already garbage collected
if (socket == null) {
return
}
let message = 'Connect Timeout Error'
if (Array.isArray(socket.autoSelectFamilyAttemptedAddresses)) {
message += ` (attempted addresses: ${socket.autoSelectFamilyAttemptedAddresses.join(', ')},`
} else {
message += ` (attempted address: ${opts.hostname}:${opts.port},`
}
message += ` timeout: ${opts.timeout}ms)`
util.destroy(socket, new ConnectTimeoutError(message))
}
module.exports = buildConnector
@@ -87278,11 +87259,12 @@ const { Blob } = __nccwpck_require__(4573)
const nodeUtil = __nccwpck_require__(57975)
const { stringify } = __nccwpck_require__(41792)
const { EventEmitter: EE } = __nccwpck_require__(78474)
const { InvalidArgumentError } = __nccwpck_require__(68707)
const timers = __nccwpck_require__(96603)
const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(68707)
const { headerNameLowerCasedRecord } = __nccwpck_require__(10735)
const { tree } = __nccwpck_require__(67752)
const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
const [nodeMajor, nodeMinor] = process.versions.node.split('.', 2).map(v => Number(v))
class BodyAsyncIterable {
constructor (body) {
@@ -87297,6 +87279,8 @@ class BodyAsyncIterable {
}
}
function noop () {}
/**
* @param {*} body
* @returns {*}
@@ -88106,6 +88090,78 @@ function errorRequest (client, request, err) {
}
}
/**
* @param {WeakRef<net.Socket>} socketWeakRef
* @param {object} opts
* @param {number} opts.timeout
* @param {string} opts.hostname
* @param {number} opts.port
* @returns {() => void}
*/
const setupConnectTimeout = process.platform === 'win32'
? (socketWeakRef, opts) => {
if (!opts.timeout) {
return noop
}
let s1 = null
let s2 = null
const fastTimer = timers.setFastTimeout(() => {
// setImmediate is added to make sure that we prioritize socket error events over timeouts
s1 = setImmediate(() => {
// Windows needs an extra setImmediate probably due to implementation differences in the socket logic
s2 = setImmediate(() => onConnectTimeout(socketWeakRef.deref(), opts))
})
}, opts.timeout)
return () => {
timers.clearFastTimeout(fastTimer)
clearImmediate(s1)
clearImmediate(s2)
}
}
: (socketWeakRef, opts) => {
if (!opts.timeout) {
return noop
}
let s1 = null
const fastTimer = timers.setFastTimeout(() => {
// setImmediate is added to make sure that we prioritize socket error events over timeouts
s1 = setImmediate(() => {
onConnectTimeout(socketWeakRef.deref(), opts)
})
}, opts.timeout)
return () => {
timers.clearFastTimeout(fastTimer)
clearImmediate(s1)
}
}
/**
* @param {net.Socket} socket
* @param {object} opts
* @param {number} opts.timeout
* @param {string} opts.hostname
* @param {number} opts.port
*/
function onConnectTimeout (socket, opts) {
// The socket could be already garbage collected
if (socket == null) {
return
}
let message = 'Connect Timeout Error'
if (Array.isArray(socket.autoSelectFamilyAttemptedAddresses)) {
message += ` (attempted addresses: ${socket.autoSelectFamilyAttemptedAddresses.join(', ')},`
} else {
message += ` (attempted address: ${opts.hostname}:${opts.port},`
}
message += ` timeout: ${opts.timeout}ms)`
destroy(socket, new ConnectTimeoutError(message))
}
const kEnumerableProperty = Object.create(null)
kEnumerableProperty.enumerable = true
@@ -88177,7 +88233,8 @@ module.exports = {
nodeMajor,
nodeMinor,
safeHTTPMethods: Object.freeze(['GET', 'HEAD', 'OPTIONS', 'TRACE']),
wrapRequestBody
wrapRequestBody,
setupConnectTimeout
}
@@ -88190,7 +88247,7 @@ module.exports = {
const { InvalidArgumentError } = __nccwpck_require__(68707)
const { kClients, kRunning, kClose, kDestroy, kDispatch } = __nccwpck_require__(36443)
const { kClients, kRunning, kClose, kDestroy, kDispatch, kUrl } = __nccwpck_require__(36443)
const DispatcherBase = __nccwpck_require__(21841)
const Pool = __nccwpck_require__(30628)
const Client = __nccwpck_require__(23701)
@@ -88234,22 +88291,35 @@ class Agent extends DispatcherBase {
}
this[kOnConnect] = (origin, targets) => {
const result = this[kClients].get(origin)
if (result) {
result.count += 1
}
this.emit('connect', origin, [this, ...targets])
}
this[kOnDisconnect] = (origin, targets, err) => {
const result = this[kClients].get(origin)
if (result) {
result.count -= 1
if (result.count <= 0) {
this[kClients].delete(origin)
result.dispatcher.destroy()
}
}
this.emit('disconnect', origin, [this, ...targets], err)
}
this[kOnConnectionError] = (origin, targets, err) => {
// TODO: should this decrement result.count here?
this.emit('connectionError', origin, [this, ...targets], err)
}
}
get [kRunning] () {
let ret = 0
for (const client of this[kClients].values()) {
ret += client[kRunning]
for (const { dispatcher } of this[kClients].values()) {
ret += dispatcher[kRunning]
}
return ret
}
@@ -88262,8 +88332,8 @@ class Agent extends DispatcherBase {
throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.')
}
let dispatcher = this[kClients].get(key)
const result = this[kClients].get(key)
let dispatcher = result && result.dispatcher
if (!dispatcher) {
dispatcher = this[kFactory](opts.origin, this[kOptions])
.on('drain', this[kOnDrain])
@@ -88271,10 +88341,7 @@ class Agent extends DispatcherBase {
.on('disconnect', this[kOnDisconnect])
.on('connectionError', this[kOnConnectionError])
// This introduces a tiny memory leak, as dispatchers are never removed from the map.
// TODO(mcollina): remove te timer when the client/pool do not have any more
// active connections.
this[kClients].set(key, dispatcher)
this[kClients].set(key, { count: 0, dispatcher })
}
return dispatcher.dispatch(opts, handler)
@@ -88282,8 +88349,8 @@ class Agent extends DispatcherBase {
async [kClose] () {
const closePromises = []
for (const client of this[kClients].values()) {
closePromises.push(client.close())
for (const { dispatcher } of this[kClients].values()) {
closePromises.push(dispatcher.close())
}
this[kClients].clear()
@@ -88292,13 +88359,23 @@ class Agent extends DispatcherBase {
async [kDestroy] (err) {
const destroyPromises = []
for (const client of this[kClients].values()) {
destroyPromises.push(client.destroy(err))
for (const { dispatcher } of this[kClients].values()) {
destroyPromises.push(dispatcher.destroy(err))
}
this[kClients].clear()
await Promise.all(destroyPromises)
}
get stats () {
const allClientStats = {}
for (const { dispatcher } of this[kClients].values()) {
if (dispatcher.stats) {
allClientStats[dispatcher[kUrl].origin] = dispatcher.stats
}
}
return allClientStats
}
}
module.exports = Agent
@@ -90357,6 +90434,7 @@ function onHttp2SessionGoAway (errorCode) {
assert(client[kRunning] === 0)
client.emit('disconnect', client[kUrl], [client], err)
client.emit('connectionError', client[kUrl], [client], err)
client[kResume]()
}
@@ -90443,11 +90521,13 @@ function writeH2 (client, request) {
if (Array.isArray(val)) {
for (let i = 0; i < val.length; i++) {
if (headers[key]) {
headers[key] += `,${val[i]}`
headers[key] += `, ${val[i]}`
} else {
headers[key] = val[i]
}
}
} else if (headers[key]) {
headers[key] += `, ${val}`
} else {
headers[key] = val
}
@@ -90956,6 +91036,7 @@ const assert = __nccwpck_require__(34589)
const net = __nccwpck_require__(77030)
const http = __nccwpck_require__(37067)
const util = __nccwpck_require__(3440)
const { ClientStats } = __nccwpck_require__(46854)
const { channels } = __nccwpck_require__(42414)
const Request = __nccwpck_require__(44655)
const DispatcherBase = __nccwpck_require__(21841)
@@ -91212,6 +91293,10 @@ class Client extends DispatcherBase {
this[kResume](true)
}
get stats () {
return new ClientStats(this)
}
get [kPending] () {
return this[kQueue].length - this[kPendingIdx]
}
@@ -92112,6 +92197,136 @@ module.exports = class FixedQueue {
}
/***/ }),
/***/ 36815:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const { connect } = __nccwpck_require__(77030)
const { kClose, kDestroy } = __nccwpck_require__(36443)
const { InvalidArgumentError } = __nccwpck_require__(68707)
const util = __nccwpck_require__(3440)
const Client = __nccwpck_require__(23701)
const DispatcherBase = __nccwpck_require__(21841)
class H2CClient extends DispatcherBase {
#client = null
constructor (origin, clientOpts) {
super()
if (typeof origin === 'string') {
origin = new URL(origin)
}
if (origin.protocol !== 'http:') {
throw new InvalidArgumentError(
'h2c-client: Only h2c protocol is supported'
)
}
const { connect, maxConcurrentStreams, pipelining, ...opts } =
clientOpts ?? {}
let defaultMaxConcurrentStreams = 100
let defaultPipelining = 100
if (
maxConcurrentStreams != null &&
Number.isInteger(maxConcurrentStreams) &&
maxConcurrentStreams > 0
) {
defaultMaxConcurrentStreams = maxConcurrentStreams
}
if (pipelining != null && Number.isInteger(pipelining) && pipelining > 0) {
defaultPipelining = pipelining
}
if (defaultPipelining > defaultMaxConcurrentStreams) {
throw new InvalidArgumentError(
'h2c-client: pipelining cannot be greater than maxConcurrentStreams'
)
}
this.#client = new Client(origin, {
...opts,
connect: this.#buildConnector(connect),
maxConcurrentStreams: defaultMaxConcurrentStreams,
pipelining: defaultPipelining,
allowH2: true
})
}
#buildConnector (connectOpts) {
return (opts, callback) => {
const timeout = connectOpts?.connectOpts ?? 10e3
const { hostname, port, pathname } = opts
const socket = connect({
...opts,
host: hostname,
port,
pathname
})
// Set TCP keep alive options on the socket here instead of in connect() for the case of assigning the socket
if (opts.keepAlive == null || opts.keepAlive) {
const keepAliveInitialDelay =
opts.keepAliveInitialDelay == null ? 60e3 : opts.keepAliveInitialDelay
socket.setKeepAlive(true, keepAliveInitialDelay)
}
socket.alpnProtocol = 'h2'
const clearConnectTimeout = util.setupConnectTimeout(
new WeakRef(socket),
{ timeout, hostname, port }
)
socket
.setNoDelay(true)
.once('connect', function () {
queueMicrotask(clearConnectTimeout)
if (callback) {
const cb = callback
callback = null
cb(null, this)
}
})
.on('error', function (err) {
queueMicrotask(clearConnectTimeout)
if (callback) {
const cb = callback
callback = null
cb(err)
}
})
return socket
}
}
dispatch (opts, handler) {
return this.#client.dispatch(opts, handler)
}
async [kClose] () {
await this.#client.close()
}
async [kDestroy] () {
await this.#client.destroy()
}
}
module.exports = H2CClient
/***/ }),
/***/ 42128:
@@ -92120,10 +92335,10 @@ module.exports = class FixedQueue {
"use strict";
const { PoolStats } = __nccwpck_require__(46854)
const DispatcherBase = __nccwpck_require__(21841)
const FixedQueue = __nccwpck_require__(64660)
const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(36443)
const PoolStats = __nccwpck_require__(43246)
const kClients = Symbol('clients')
const kNeedDrain = Symbol('needDrain')
@@ -92136,7 +92351,6 @@ const kOnConnectionError = Symbol('onConnectionError')
const kGetDispatcher = Symbol('get dispatcher')
const kAddClient = Symbol('add client')
const kRemoveClient = Symbol('remove client')
const kStats = Symbol('stats')
class PoolBase extends DispatcherBase {
constructor () {
@@ -92187,8 +92401,6 @@ class PoolBase extends DispatcherBase {
this[kOnConnectionError] = (origin, targets, err) => {
pool.emit('connectionError', origin, [pool, ...targets], err)
}
this[kStats] = new PoolStats(this)
}
get [kBusy] () {
@@ -92228,7 +92440,7 @@ class PoolBase extends DispatcherBase {
}
get stats () {
return this[kStats]
return new PoolStats(this)
}
async [kClose] () {
@@ -92314,50 +92526,6 @@ module.exports = {
}
/***/ }),
/***/ 43246:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(36443)
const kPool = Symbol('pool')
class PoolStats {
constructor (pool) {
this[kPool] = pool
}
get connected () {
return this[kPool][kConnected]
}
get free () {
return this[kPool][kFree]
}
get pending () {
return this[kPool][kPending]
}
get queued () {
return this[kPool][kQueued]
}
get running () {
return this[kPool][kRunning]
}
get size () {
return this[kPool][kSize]
}
}
module.exports = PoolStats
/***/ }),
/***/ 30628:
@@ -92371,7 +92539,8 @@ const {
kClients,
kNeedDrain,
kAddClient,
kGetDispatcher
kGetDispatcher,
kRemoveClient
} = __nccwpck_require__(42128)
const Client = __nccwpck_require__(23701)
const {
@@ -92401,6 +92570,7 @@ class Pool extends PoolBase {
autoSelectFamily,
autoSelectFamilyAttemptTimeout,
allowH2,
clientTtl,
...options
} = {}) {
if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
@@ -92431,12 +92601,20 @@ class Pool extends PoolBase {
this[kConnections] = connections || null
this[kUrl] = util.parseOrigin(origin)
this[kOptions] = { ...util.deepClone(options), connect, allowH2 }
this[kOptions] = { ...util.deepClone(options), connect, allowH2, clientTtl }
this[kOptions].interceptors = options.interceptors
? { ...options.interceptors }
: undefined
this[kFactory] = factory
this.on('connect', (origin, targets) => {
if (clientTtl != null && clientTtl > 0) {
for (const target of targets) {
Object.assign(target, { ttl: Date.now() })
}
}
})
this.on('connectionError', (origin, targets, error) => {
// If a connection error occurs, we remove the client from the pool,
// and emit a connectionError event. They will not be re-used.
@@ -92453,8 +92631,12 @@ class Pool extends PoolBase {
}
[kGetDispatcher] () {
const clientTtlOption = this[kOptions].clientTtl
for (const client of this[kClients]) {
if (!client[kNeedDrain]) {
// check ttl of client and if it's stale, remove it from the pool
if (clientTtlOption != null && clientTtlOption > 0 && client.ttl && ((Date.now() - client.ttl) > clientTtlOption)) {
this[kRemoveClient](client)
} else if (!client[kNeedDrain]) {
return client
}
}
@@ -92478,13 +92660,14 @@ module.exports = Pool
"use strict";
const { kProxy, kClose, kDestroy } = __nccwpck_require__(36443)
const { kProxy, kClose, kDestroy, kDispatch, kConnector } = __nccwpck_require__(36443)
const { URL } = __nccwpck_require__(73136)
const Agent = __nccwpck_require__(57405)
const Pool = __nccwpck_require__(30628)
const DispatcherBase = __nccwpck_require__(21841)
const { InvalidArgumentError, RequestAbortedError, SecureProxyConnectionError } = __nccwpck_require__(68707)
const buildConnector = __nccwpck_require__(59136)
const Client = __nccwpck_require__(23701)
const kAgent = Symbol('proxy agent')
const kClient = Symbol('proxy client')
@@ -92492,6 +92675,7 @@ const kProxyHeaders = Symbol('proxy headers')
const kRequestTls = Symbol('request tls settings')
const kProxyTls = Symbol('proxy tls settings')
const kConnectEndpoint = Symbol('connect endpoint function')
const kTunnelProxy = Symbol('tunnel proxy')
function defaultProtocolPort (protocol) {
return protocol === 'https:' ? 443 : 80
@@ -92503,6 +92687,61 @@ function defaultFactory (origin, opts) {
const noop = () => {}
class ProxyClient extends DispatcherBase {
#client = null
constructor (origin, opts) {
if (typeof origin === 'string') {
origin = new URL(origin)
}
if (origin.protocol !== 'http:' && origin.protocol !== 'https:') {
throw new InvalidArgumentError('ProxyClient only supports http and https protocols')
}
super()
this.#client = new Client(origin, opts)
}
async [kClose] () {
await this.#client.close()
}
async [kDestroy] () {
await this.#client.destroy()
}
async [kDispatch] (opts, handler) {
const { method, origin } = opts
if (method === 'CONNECT') {
this.#client[kConnector]({
origin,
port: opts.port || defaultProtocolPort(opts.protocol),
path: opts.host,
signal: opts.signal,
headers: {
...this[kProxyHeaders],
host: opts.host
},
servername: this[kProxyTls]?.servername || opts.servername
},
(err, socket) => {
if (err) {
handler.callback(err)
} else {
handler.callback(null, { socket, statusCode: 200 })
}
}
)
return
}
if (typeof origin === 'string') {
opts.origin = new URL(origin)
}
return this.#client.dispatch(opts, handler)
}
}
class ProxyAgent extends DispatcherBase {
constructor (opts) {
if (!opts || (typeof opts === 'object' && !(opts instanceof URL) && !opts.uri)) {
@@ -92514,6 +92753,8 @@ class ProxyAgent extends DispatcherBase {
throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.')
}
const { proxyTunnel = true } = opts
super()
const url = this.#getUrl(opts)
@@ -92535,9 +92776,19 @@ class ProxyAgent extends DispatcherBase {
this[kProxyHeaders]['proxy-authorization'] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString('base64')}`
}
const factory = (!proxyTunnel && protocol === 'http:')
? (origin, options) => {
if (origin.protocol === 'http:') {
return new ProxyClient(origin, options)
}
return new Client(origin, options)
}
: undefined
const connect = buildConnector({ ...opts.proxyTls })
this[kConnectEndpoint] = buildConnector({ ...opts.requestTls })
this[kClient] = clientFactory(url, { connect })
this[kClient] = clientFactory(url, { connect, factory })
this[kTunnelProxy] = proxyTunnel
this[kAgent] = new Agent({
...opts,
connect: async (opts, callback) => {
@@ -92593,6 +92844,10 @@ class ProxyAgent extends DispatcherBase {
headers.host = host
}
if (!this.#shouldConnect(new URL(opts.origin))) {
opts.path = opts.origin + opts.path
}
return this[kAgent].dispatch(
{
...opts,
@@ -92625,6 +92880,19 @@ class ProxyAgent extends DispatcherBase {
await this[kAgent].destroy()
await this[kClient].destroy()
}
#shouldConnect (uri) {
if (typeof uri === 'string') {
uri = new URL(uri)
}
if (this[kTunnelProxy]) {
return true
}
if (uri.protocol !== 'http:' || this[kProxy].protocol !== 'http:') {
return true
}
return false
}
}
/**
@@ -93223,7 +93491,7 @@ const assert = __nccwpck_require__(34589)
* here, which we then just pass on to the next handler (most likely a
* CacheHandler). Note that this assumes the proper headers were already
* included in the request to tell the origin that we want to revalidate the
* response (i.e. if-modified-since).
* response (i.e. if-modified-since or if-none-match).
*
* @see https://www.rfc-editor.org/rfc/rfc9111.html#name-validation
*
@@ -94219,7 +94487,7 @@ const util = __nccwpck_require__(3440)
const CacheHandler = __nccwpck_require__(39976)
const MemoryCacheStore = __nccwpck_require__(74889)
const CacheRevalidationHandler = __nccwpck_require__(17133)
const { assertCacheStore, assertCacheMethods, makeCacheKey, parseCacheControlHeader } = __nccwpck_require__(47659)
const { assertCacheStore, assertCacheMethods, makeCacheKey, normaliseHeaders, parseCacheControlHeader } = __nccwpck_require__(47659)
const { AbortError } = __nccwpck_require__(68707)
/**
@@ -94233,7 +94501,12 @@ const { AbortError } = __nccwpck_require__(68707)
*/
function needsRevalidation (result, cacheControlDirectives) {
if (cacheControlDirectives?.['no-cache']) {
// Always revalidate requests with the no-cache directive
// Always revalidate requests with the no-cache request directive
return true
}
if (result.cacheControlDirectives?.['no-cache'] && !Array.isArray(result.cacheControlDirectives['no-cache'])) {
// Always revalidate requests with unqualified no-cache response directive
return true
}
@@ -94434,7 +94707,7 @@ function handleResult (
// Check if the response is stale
if (needsRevalidation(result, reqCacheControl)) {
if (util.isStream(opts.body) && util.bodyLength(opts.body) !== 0) {
// If body is is stream we can't revalidate...
// If body is a stream we can't revalidate...
// TODO (fix): This could be less strict...
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler))
}
@@ -94532,6 +94805,11 @@ module.exports = (opts = {}) => {
return dispatch(opts, handler)
}
opts = {
...opts,
headers: normaliseHeaders(opts)
}
const reqCacheControl = opts.headers?.['cache-control']
? parseCacheControlHeader(opts.headers['cache-control'])
: undefined
@@ -95892,11 +96170,12 @@ const {
kMockAgentIsCallHistoryEnabled,
kMockAgentAddCallHistoryLog,
kMockAgentMockCallHistoryInstance,
kMockAgentAcceptsNonStandardSearchParameters,
kMockCallHistoryAddLog
} = __nccwpck_require__(91117)
const MockClient = __nccwpck_require__(47365)
const MockPool = __nccwpck_require__(94004)
const { matchValue, buildAndValidateMockOptions } = __nccwpck_require__(53397)
const { matchValue, normalizeSearchParams, buildAndValidateMockOptions } = __nccwpck_require__(53397)
const { InvalidArgumentError, UndiciError } = __nccwpck_require__(68707)
const Dispatcher = __nccwpck_require__(30883)
const PendingInterceptorsFormatter = __nccwpck_require__(56142)
@@ -95911,6 +96190,7 @@ class MockAgent extends Dispatcher {
this[kNetConnect] = true
this[kIsMockActive] = true
this[kMockAgentIsCallHistoryEnabled] = mockOptions?.enableCallHistory ?? false
this[kMockAgentAcceptsNonStandardSearchParameters] = mockOptions?.acceptNonStandardSearchParameters ?? false
// Instantiate Agent and encapsulate
if (opts?.agent && typeof opts.agent.dispatch !== 'function') {
@@ -95943,7 +96223,17 @@ class MockAgent extends Dispatcher {
this[kMockAgentAddCallHistoryLog](opts)
return this[kAgent].dispatch(opts, handler)
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters]
const dispatchOpts = { ...opts }
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
const [path, searchParams] = dispatchOpts.path.split('?')
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)
dispatchOpts.path = `${path}?${normalizedSearchParams}`
}
return this[kAgent].dispatch(dispatchOpts, handler)
}
async close () {
@@ -96023,7 +96313,7 @@ class MockAgent extends Dispatcher {
}
[kMockAgentSet] (origin, dispatcher) {
this[kClients].set(origin, dispatcher)
this[kClients].set(origin, { count: 0, dispatcher })
}
[kFactory] (origin) {
@@ -96035,9 +96325,9 @@ class MockAgent extends Dispatcher {
[kMockAgentGet] (origin) {
// First check if we can immediately find it
const client = this[kClients].get(origin)
if (client) {
return client
const result = this[kClients].get(origin)
if (result?.dispatcher) {
return result.dispatcher
}
// If the origin is not a string create a dummy parent pool and return to user
@@ -96048,11 +96338,11 @@ class MockAgent extends Dispatcher {
}
// If we match, create a pool and assign the same dispatches
for (const [keyMatcher, nonExplicitDispatcher] of Array.from(this[kClients])) {
if (nonExplicitDispatcher && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) {
for (const [keyMatcher, result] of Array.from(this[kClients])) {
if (result && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) {
const dispatcher = this[kFactory](origin)
this[kMockAgentSet](origin, dispatcher)
dispatcher[kDispatches] = nonExplicitDispatcher[kDispatches]
dispatcher[kDispatches] = result.dispatcher[kDispatches]
return dispatcher
}
}
@@ -96066,7 +96356,7 @@ class MockAgent extends Dispatcher {
const mockAgentClients = this[kClients]
return Array.from(mockAgentClients.entries())
.flatMap(([origin, scope]) => scope[kDispatches].map(dispatch => ({ ...dispatch, origin })))
.flatMap(([origin, result]) => result.dispatcher[kDispatches].map(dispatch => ({ ...dispatch, origin })))
.filter(({ pending }) => pending)
}
@@ -96766,6 +97056,7 @@ module.exports = {
kMockAgentRegisterCallHistory: Symbol('mock agent register mock call history'),
kMockAgentAddCallHistoryLog: Symbol('mock agent add call history log'),
kMockAgentIsCallHistoryEnabled: Symbol('mock agent is call history enabled'),
kMockAgentAcceptsNonStandardSearchParameters: Symbol('mock agent accepts non standard search parameters'),
kMockCallHistoryAddLog: Symbol('mock call history add log')
}
@@ -96870,13 +97161,42 @@ function matchHeaders (mockDispatch, headers) {
return true
}
function normalizeSearchParams (query) {
if (typeof query !== 'string') {
return query
}
const originalQp = new URLSearchParams(query)
const normalizedQp = new URLSearchParams()
for (let [key, value] of originalQp.entries()) {
key = key.replace('[]', '')
const valueRepresentsString = /^(['"]).*\1$/.test(value)
if (valueRepresentsString) {
normalizedQp.append(key, value)
continue
}
if (value.includes(',')) {
const values = value.split(',')
for (const v of values) {
normalizedQp.append(key, v)
}
continue
}
normalizedQp.append(key, value)
}
return normalizedQp
}
function safeUrl (path) {
if (typeof path !== 'string') {
return path
}
const pathSegments = path.split('?')
const pathSegments = path.split('?', 3)
if (pathSegments.length !== 2) {
return path
}
@@ -97154,6 +97474,10 @@ function buildAndValidateMockOptions (opts) {
throw new InvalidArgumentError('options.enableCallHistory must to be a boolean')
}
if ('acceptNonStandardSearchParameters' in mockOptions && typeof mockOptions.acceptNonStandardSearchParameters !== 'boolean') {
throw new InvalidArgumentError('options.acceptNonStandardSearchParameters must to be a boolean')
}
return mockOptions
}
}
@@ -97173,7 +97497,8 @@ module.exports = {
checkNetConnect,
buildAndValidateMockOptions,
getHeaderByName,
buildHeadersFromArray
buildHeadersFromArray,
normalizeSearchParams
}
@@ -97248,7 +97573,19 @@ function makeCacheKey (opts) {
throw new Error('opts.origin is undefined')
}
/** @type {Record<string, string[] | string>} */
return {
origin: opts.origin.toString(),
method: opts.method,
path: opts.path,
headers: opts.headers
}
}
/**
* @param {Record<string, string[] | string>}
* @return {Record<string, string[] | string>}
*/
function normaliseHeaders (opts) {
let headers
if (opts.headers == null) {
headers = {}
@@ -97274,12 +97611,7 @@ function makeCacheKey (opts) {
throw new Error('opts.headers is not an object')
}
return {
origin: opts.origin.toString(),
method: opts.method,
path: opts.path,
headers
}
return headers
}
/**
@@ -97586,6 +97918,7 @@ function assertCacheMethods (methods, name = 'CacheMethods') {
module.exports = {
makeCacheKey,
normaliseHeaders,
assertCacheKey,
assertCacheValue,
parseCacheControlHeader,
@@ -97863,6 +98196,46 @@ module.exports = {
}
/***/ }),
/***/ 46854:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const {
kConnected,
kPending,
kRunning,
kSize,
kFree,
kQueued
} = __nccwpck_require__(36443)
class ClientStats {
constructor (client) {
this.connected = client[kConnected]
this.pending = client[kPending]
this.running = client[kRunning]
this.size = client[kSize]
}
}
class PoolStats {
constructor (pool) {
this.connected = pool[kConnected]
this.free = pool[kFree]
this.pending = pool[kPending]
this.queued = pool[kQueued]
this.running = pool[kRunning]
this.size = pool[kSize]
}
}
module.exports = { ClientStats, PoolStats }
/***/ }),
/***/ 96603:
@@ -104525,7 +104898,9 @@ function finalizeAndReportTiming (response, initiatorType = 'other') {
originalURL.href,
initiatorType,
globalThis,
cacheState
cacheState,
'', // bodyType
response.status
)
}
@@ -105210,7 +105585,7 @@ function fetchFinale (fetchParams, response) {
// 3. Set fetchParamss controllers report timing steps to the following steps given a global object global:
fetchParams.controller.reportTimingSteps = () => {
// 1. If fetchParamss requests URLs scheme is not an HTTP(S) scheme, then return.
if (fetchParams.request.url.protocol !== 'https:') {
if (!urlIsHttpHttpsScheme(fetchParams.request.url)) {
return
}
@@ -105252,7 +105627,6 @@ function fetchFinale (fetchParams, response) {
// fetchParamss requests URL, fetchParamss requests initiator type, global, cacheState, bodyInfo,
// and responseStatus.
if (fetchParams.request.initiatorType != null) {
// TODO: update markresourcetiming
markResourceTiming(timingInfo, fetchParams.request.url.href, fetchParams.request.initiatorType, globalThis, cacheState, bodyInfo, responseStatus)
}
}
@@ -113169,7 +113543,7 @@ function parseExtensions (extensions) {
while (position.position < extensions.length) {
const pair = collectASequenceOfCodePointsFast(';', extensions, position)
const [name, value = ''] = pair.split('=')
const [name, value = ''] = pair.split('=', 2)
extensionList.set(
removeHTTPWhitespace(name, true, false),
@@ -127210,15 +127584,15 @@ var __copyProps = (to, from, except, desc) => {
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// dist/index.js
var dist_exports = {};
__export(dist_exports, {
var index_exports = {};
__export(index_exports, {
TomlDate: () => TomlDate,
TomlError: () => TomlError,
default: () => dist_default,
default: () => index_default,
parse: () => parse,
stringify: () => stringify
});
module.exports = __toCommonJS(dist_exports);
module.exports = __toCommonJS(index_exports);
// dist/error.js
function getLineColFromPtr(string, ptr) {
@@ -127300,9 +127674,7 @@ function skipUntil(str, ptr, sep, end, banNewLines = false) {
i = indexOfNewline(str, i);
} else if (c === sep) {
return i + 1;
} else if (c === end) {
return i;
} else if (banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
} else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
return i;
}
}
@@ -127317,7 +127689,7 @@ function getStringEnd(str, seek) {
seek += target.length - 1;
do
seek = str.indexOf(target, ++seek);
while (seek > -1 && first !== "'" && str[seek - 1] === "\\" && str[seek - 2] !== "\\");
while (seek > -1 && first !== "'" && str[seek - 1] === "\\" && (str[seek - 2] !== "\\" || str[seek - 3] === "\\"));
if (seek > -1) {
seek += target.length;
if (target.length > 1) {
@@ -127348,6 +127720,7 @@ var TomlDate = class _TomlDate extends Date {
date = `0000-01-01T${date}`;
}
hasTime = !!match[2];
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
if (match[2] && +match[2] > 23) {
date = "";
} else {
@@ -127574,7 +127947,7 @@ function sliceAndTrimEndOf(str, startPtr, endPtr, allowNewLines) {
}
return [trimmed, commentIdx];
}
function extractValue(str, ptr, end, depth) {
function extractValue(str, ptr, end, depth = -1) {
if (depth === 0) {
throw new TomlError("document contains excessively nested structures. aborting.", {
toml: str,
@@ -127584,8 +127957,8 @@ function extractValue(str, ptr, end, depth) {
let c = str[ptr];
if (c === "[" || c === "{") {
let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth) : parseInlineTable(str, ptr, depth);
let newPtr = skipUntil(str, endPtr2, ",", end);
if (end === "}") {
let newPtr = end ? skipUntil(str, endPtr2, ",", end) : endPtr2;
if (endPtr2 - newPtr && end === "}") {
let nextNewLine = indexOfNewline(str, endPtr2, newPtr);
if (nextNewLine > -1) {
throw new TomlError("newlines are not allowed in inline tables", {
@@ -127699,7 +128072,7 @@ function parseKey(str, ptr, end = "=") {
} while (dot + 1 && dot < endPtr);
return [parsed, skipVoid(str, endPtr + 1, true, true)];
}
function parseInlineTable(str, ptr, depth) {
function parseInlineTable(str, ptr, depth = -1) {
let res = {};
let seen = /* @__PURE__ */ new Set();
let c;
@@ -127767,7 +128140,7 @@ function parseInlineTable(str, ptr, depth) {
}
return [res, ptr];
}
function parseArray(str, ptr, depth) {
function parseArray(str, ptr, depth = -1) {
let res = [];
let c;
ptr++;
@@ -128059,7 +128432,7 @@ function stringify(obj, opts) {
}
// dist/index.js
var dist_default = { parse, stringify, TomlDate, TomlError };
var index_default = { parse, stringify, TomlDate, TomlError };
// Annotate the CommonJS export names for ESM import in node:
0 && (0);
/*!
@@ -128893,7 +129266,8 @@ var NON_VARIABLE_OPTIONS = [
"headers",
"request",
"query",
"mediaType"
"mediaType",
"operationName"
];
var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
@@ -129031,7 +129405,7 @@ var createTokenAuth = function createTokenAuth2(token) {
;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/version.js
const version_VERSION = "6.1.4";
const version_VERSION = "7.0.2";
;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/index.js

831
dist/update-known-versions/index.js generated vendored
View File

@@ -8018,7 +8018,7 @@ module.exports = {
const { parseSetCookie } = __nccwpck_require__(7803)
const { stringify, getHeadersList } = __nccwpck_require__(6338)
const { stringify } = __nccwpck_require__(6338)
const { webidl } = __nccwpck_require__(8134)
const { Headers } = __nccwpck_require__(9061)
@@ -8094,14 +8094,13 @@ function getSetCookies (headers) {
webidl.brandCheck(headers, Headers, { strict: false })
const cookies = getHeadersList(headers).cookies
const cookies = headers.getSetCookie()
if (!cookies) {
return []
}
// In older versions of undici, cookies is a list of name:value.
return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair))
return cookies.map((pair) => parseSetCookie(pair))
}
/**
@@ -8529,14 +8528,15 @@ module.exports = {
/***/ }),
/***/ 6338:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
/***/ ((module) => {
"use strict";
const assert = __nccwpck_require__(2613)
const { kHeadersList } = __nccwpck_require__(9411)
/**
* @param {string} value
* @returns {boolean}
*/
function isCTLExcludingHtab (value) {
if (value.length === 0) {
return false
@@ -8797,31 +8797,13 @@ function stringify (cookie) {
return out.join('; ')
}
let kHeadersListNode
function getHeadersList (headers) {
if (headers[kHeadersList]) {
return headers[kHeadersList]
}
if (!kHeadersListNode) {
kHeadersListNode = Object.getOwnPropertySymbols(headers).find(
(symbol) => symbol.description === 'headers list'
)
assert(kHeadersListNode, 'Headers cannot be parsed')
}
const headersList = headers[kHeadersListNode]
assert(headersList)
return headersList
}
module.exports = {
isCTLExcludingHtab,
stringify,
getHeadersList
validateCookieName,
validateCookiePath,
validateCookieValue,
toIMFDate,
stringify
}
@@ -12825,6 +12807,7 @@ const {
isValidHeaderName,
isValidHeaderValue
} = __nccwpck_require__(555)
const util = __nccwpck_require__(9023)
const { webidl } = __nccwpck_require__(8134)
const assert = __nccwpck_require__(2613)
@@ -13378,6 +13361,9 @@ Object.defineProperties(Headers.prototype, {
[Symbol.toStringTag]: {
value: 'Headers',
configurable: true
},
[util.inspect.custom]: {
enumerable: false
}
})
@@ -22554,6 +22540,20 @@ class Pool extends PoolBase {
? { ...options.interceptors }
: undefined
this[kFactory] = factory
this.on('connectionError', (origin, targets, error) => {
// If a connection error occurs, we remove the client from the pool,
// and emit a connectionError event. They will not be re-used.
// Fixes https://github.com/nodejs/undici/issues/3895
for (const target of targets) {
// Do not use kRemoveClient here, as it will close the client,
// but the client cannot be closed in this state.
const idx = this[kClients].indexOf(target)
if (idx !== -1) {
this[kClients].splice(idx, 1)
}
}
})
}
[kGetDispatcher] () {
@@ -28201,6 +28201,7 @@ const Agent = __nccwpck_require__(7405)
const ProxyAgent = __nccwpck_require__(6672)
const EnvHttpProxyAgent = __nccwpck_require__(3137)
const RetryAgent = __nccwpck_require__(50)
const H2CClient = __nccwpck_require__(6815)
const errors = __nccwpck_require__(8707)
const util = __nccwpck_require__(3440)
const { InvalidArgumentError } = errors
@@ -28226,6 +28227,7 @@ module.exports.Agent = Agent
module.exports.ProxyAgent = ProxyAgent
module.exports.EnvHttpProxyAgent = EnvHttpProxyAgent
module.exports.RetryAgent = RetryAgent
module.exports.H2CClient = H2CClient
module.exports.RetryHandler = RetryHandler
module.exports.DecoratorHandler = DecoratorHandler
@@ -29951,6 +29953,7 @@ module.exports = {
const { Writable } = __nccwpck_require__(7075)
const { EventEmitter } = __nccwpck_require__(8474)
const { assertCacheKey, assertCacheValue } = __nccwpck_require__(7659)
/**
@@ -29962,8 +29965,9 @@ const { assertCacheKey, assertCacheValue } = __nccwpck_require__(7659)
/**
* @implements {CacheStore}
* @extends {EventEmitter}
*/
class MemoryCacheStore {
class MemoryCacheStore extends EventEmitter {
#maxCount = Infinity
#maxSize = Infinity
#maxEntrySize = Infinity
@@ -29971,11 +29975,13 @@ class MemoryCacheStore {
#size = 0
#count = 0
#entries = new Map()
#hasEmittedMaxSizeEvent = false
/**
* @param {import('../../types/cache-interceptor.d.ts').default.MemoryCacheStoreOpts | undefined} [opts]
*/
constructor (opts) {
super()
if (opts) {
if (typeof opts !== 'object') {
throw new TypeError('MemoryCacheStore options must be an object')
@@ -30016,6 +30022,22 @@ class MemoryCacheStore {
}
}
/**
* Get the current size of the cache in bytes
* @returns {number} The current size of the cache in bytes
*/
get size () {
return this.#size
}
/**
* Check if the cache is full (either max size or max count reached)
* @returns {boolean} True if the cache is full, false otherwise
*/
isFull () {
return this.#size >= this.#maxSize || this.#count >= this.#maxCount
}
/**
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} req
* @returns {import('../../types/cache-interceptor.d.ts').default.GetResult | undefined}
@@ -30026,17 +30048,9 @@ class MemoryCacheStore {
const topLevelKey = `${key.origin}:${key.path}`
const now = Date.now()
const entry = this.#entries.get(topLevelKey)?.find((entry) => (
entry.deleteAt > now &&
entry.method === key.method &&
(entry.vary == null || Object.keys(entry.vary).every(headerName => {
if (entry.vary[headerName] === null) {
return key.headers[headerName] === undefined
}
const entries = this.#entries.get(topLevelKey)
return entry.vary[headerName] === key.headers[headerName]
}))
))
const entry = entries ? findEntry(key, entries, now) : null
return entry == null
? undefined
@@ -30090,12 +30104,32 @@ class MemoryCacheStore {
entries = []
store.#entries.set(topLevelKey, entries)
}
entries.push(entry)
const previousEntry = findEntry(key, entries, Date.now())
if (previousEntry) {
const index = entries.indexOf(previousEntry)
entries.splice(index, 1, entry)
store.#size -= previousEntry.size
} else {
entries.push(entry)
store.#count += 1
}
store.#size += entry.size
store.#count += 1
// Check if cache is full and emit event if needed
if (store.#size > store.#maxSize || store.#count > store.#maxCount) {
// Emit maxSizeExceeded event if we haven't already
if (!store.#hasEmittedMaxSizeEvent) {
store.emit('maxSizeExceeded', {
size: store.#size,
maxSize: store.#maxSize,
count: store.#count,
maxCount: store.#maxCount
})
store.#hasEmittedMaxSizeEvent = true
}
// Perform eviction
for (const [key, entries] of store.#entries) {
for (const entry of entries.splice(0, entries.length / 2)) {
store.#size -= entry.size
@@ -30105,6 +30139,11 @@ class MemoryCacheStore {
store.#entries.delete(key)
}
}
// Reset the event flag after eviction
if (store.#size < store.#maxSize && store.#count < store.#maxCount) {
store.#hasEmittedMaxSizeEvent = false
}
}
callback(null)
@@ -30130,6 +30169,20 @@ class MemoryCacheStore {
}
}
function findEntry (key, entries, now) {
return entries.find((entry) => (
entry.deleteAt > now &&
entry.method === key.method &&
(entry.vary == null || Object.keys(entry.vary).every(headerName => {
if (entry.vary[headerName] === null) {
return key.headers[headerName] === undefined
}
return entry.vary[headerName] === key.headers[headerName]
}))
))
}
module.exports = MemoryCacheStore
@@ -30256,6 +30309,11 @@ module.exports = class SqliteCacheStore {
this.#db = new DatabaseSync(opts?.location ?? ':memory:')
this.#db.exec(`
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA temp_store = memory;
PRAGMA optimize;
CREATE TABLE IF NOT EXISTS cacheInterceptorV${VERSION} (
-- Data specific to us
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -30275,9 +30333,8 @@ module.exports = class SqliteCacheStore {
staleAt INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_url ON cacheInterceptorV${VERSION}(url);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_method ON cacheInterceptorV${VERSION}(method);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_deleteAt ON cacheInterceptorV${VERSION}(deleteAt);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_getValuesQuery ON cacheInterceptorV${VERSION}(url, method, deleteAt);
CREATE INDEX IF NOT EXISTS idx_cacheInterceptorV${VERSION}_deleteByUrlQuery ON cacheInterceptorV${VERSION}(deleteAt);
`)
this.#getValuesQuery = this.#db.prepare(`
@@ -30487,7 +30544,7 @@ module.exports = class SqliteCacheStore {
}
#prune () {
if (this.size <= this.#maxCount) {
if (Number.isFinite(this.#maxCount) && this.size <= this.#maxCount) {
return 0
}
@@ -30609,10 +30666,7 @@ function headerValueEquals (lhs, rhs) {
const net = __nccwpck_require__(7030)
const assert = __nccwpck_require__(4589)
const util = __nccwpck_require__(3440)
const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(8707)
const timers = __nccwpck_require__(6603)
function noop () {}
const { InvalidArgumentError } = __nccwpck_require__(8707)
let tls // include tls conditionally since it is not always available
@@ -30712,7 +30766,6 @@ function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, sess
servername,
session,
localAddress,
// TODO(HTTP/2): Add support for h2c
ALPNProtocols: allowH2 ? ['http/1.1', 'h2'] : ['http/1.1'],
socket: httpSocket, // upgrade socket connection
port,
@@ -30744,7 +30797,7 @@ function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, sess
socket.setKeepAlive(true, keepAliveInitialDelay)
}
const clearConnectTimeout = setupConnectTimeout(new WeakRef(socket), { timeout, hostname, port })
const clearConnectTimeout = util.setupConnectTimeout(new WeakRef(socket), { timeout, hostname, port })
socket
.setNoDelay(true)
@@ -30771,78 +30824,6 @@ function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, sess
}
}
/**
* @param {WeakRef<net.Socket>} socketWeakRef
* @param {object} opts
* @param {number} opts.timeout
* @param {string} opts.hostname
* @param {number} opts.port
* @returns {() => void}
*/
const setupConnectTimeout = process.platform === 'win32'
? (socketWeakRef, opts) => {
if (!opts.timeout) {
return noop
}
let s1 = null
let s2 = null
const fastTimer = timers.setFastTimeout(() => {
// setImmediate is added to make sure that we prioritize socket error events over timeouts
s1 = setImmediate(() => {
// Windows needs an extra setImmediate probably due to implementation differences in the socket logic
s2 = setImmediate(() => onConnectTimeout(socketWeakRef.deref(), opts))
})
}, opts.timeout)
return () => {
timers.clearFastTimeout(fastTimer)
clearImmediate(s1)
clearImmediate(s2)
}
}
: (socketWeakRef, opts) => {
if (!opts.timeout) {
return noop
}
let s1 = null
const fastTimer = timers.setFastTimeout(() => {
// setImmediate is added to make sure that we prioritize socket error events over timeouts
s1 = setImmediate(() => {
onConnectTimeout(socketWeakRef.deref(), opts)
})
}, opts.timeout)
return () => {
timers.clearFastTimeout(fastTimer)
clearImmediate(s1)
}
}
/**
* @param {net.Socket} socket
* @param {object} opts
* @param {number} opts.timeout
* @param {string} opts.hostname
* @param {number} opts.port
*/
function onConnectTimeout (socket, opts) {
// The socket could be already garbage collected
if (socket == null) {
return
}
let message = 'Connect Timeout Error'
if (Array.isArray(socket.autoSelectFamilyAttemptedAddresses)) {
message += ` (attempted addresses: ${socket.autoSelectFamilyAttemptedAddresses.join(', ')},`
} else {
message += ` (attempted address: ${opts.hostname}:${opts.port},`
}
message += ` timeout: ${opts.timeout}ms)`
util.destroy(socket, new ConnectTimeoutError(message))
}
module.exports = buildConnector
@@ -32119,11 +32100,12 @@ const { Blob } = __nccwpck_require__(4573)
const nodeUtil = __nccwpck_require__(7975)
const { stringify } = __nccwpck_require__(1792)
const { EventEmitter: EE } = __nccwpck_require__(8474)
const { InvalidArgumentError } = __nccwpck_require__(8707)
const timers = __nccwpck_require__(6603)
const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(8707)
const { headerNameLowerCasedRecord } = __nccwpck_require__(735)
const { tree } = __nccwpck_require__(7752)
const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
const [nodeMajor, nodeMinor] = process.versions.node.split('.', 2).map(v => Number(v))
class BodyAsyncIterable {
constructor (body) {
@@ -32138,6 +32120,8 @@ class BodyAsyncIterable {
}
}
function noop () {}
/**
* @param {*} body
* @returns {*}
@@ -32947,6 +32931,78 @@ function errorRequest (client, request, err) {
}
}
/**
* @param {WeakRef<net.Socket>} socketWeakRef
* @param {object} opts
* @param {number} opts.timeout
* @param {string} opts.hostname
* @param {number} opts.port
* @returns {() => void}
*/
const setupConnectTimeout = process.platform === 'win32'
? (socketWeakRef, opts) => {
if (!opts.timeout) {
return noop
}
let s1 = null
let s2 = null
const fastTimer = timers.setFastTimeout(() => {
// setImmediate is added to make sure that we prioritize socket error events over timeouts
s1 = setImmediate(() => {
// Windows needs an extra setImmediate probably due to implementation differences in the socket logic
s2 = setImmediate(() => onConnectTimeout(socketWeakRef.deref(), opts))
})
}, opts.timeout)
return () => {
timers.clearFastTimeout(fastTimer)
clearImmediate(s1)
clearImmediate(s2)
}
}
: (socketWeakRef, opts) => {
if (!opts.timeout) {
return noop
}
let s1 = null
const fastTimer = timers.setFastTimeout(() => {
// setImmediate is added to make sure that we prioritize socket error events over timeouts
s1 = setImmediate(() => {
onConnectTimeout(socketWeakRef.deref(), opts)
})
}, opts.timeout)
return () => {
timers.clearFastTimeout(fastTimer)
clearImmediate(s1)
}
}
/**
* @param {net.Socket} socket
* @param {object} opts
* @param {number} opts.timeout
* @param {string} opts.hostname
* @param {number} opts.port
*/
function onConnectTimeout (socket, opts) {
// The socket could be already garbage collected
if (socket == null) {
return
}
let message = 'Connect Timeout Error'
if (Array.isArray(socket.autoSelectFamilyAttemptedAddresses)) {
message += ` (attempted addresses: ${socket.autoSelectFamilyAttemptedAddresses.join(', ')},`
} else {
message += ` (attempted address: ${opts.hostname}:${opts.port},`
}
message += ` timeout: ${opts.timeout}ms)`
destroy(socket, new ConnectTimeoutError(message))
}
const kEnumerableProperty = Object.create(null)
kEnumerableProperty.enumerable = true
@@ -33018,7 +33074,8 @@ module.exports = {
nodeMajor,
nodeMinor,
safeHTTPMethods: Object.freeze(['GET', 'HEAD', 'OPTIONS', 'TRACE']),
wrapRequestBody
wrapRequestBody,
setupConnectTimeout
}
@@ -33031,7 +33088,7 @@ module.exports = {
const { InvalidArgumentError } = __nccwpck_require__(8707)
const { kClients, kRunning, kClose, kDestroy, kDispatch } = __nccwpck_require__(6443)
const { kClients, kRunning, kClose, kDestroy, kDispatch, kUrl } = __nccwpck_require__(6443)
const DispatcherBase = __nccwpck_require__(1841)
const Pool = __nccwpck_require__(628)
const Client = __nccwpck_require__(3701)
@@ -33075,22 +33132,35 @@ class Agent extends DispatcherBase {
}
this[kOnConnect] = (origin, targets) => {
const result = this[kClients].get(origin)
if (result) {
result.count += 1
}
this.emit('connect', origin, [this, ...targets])
}
this[kOnDisconnect] = (origin, targets, err) => {
const result = this[kClients].get(origin)
if (result) {
result.count -= 1
if (result.count <= 0) {
this[kClients].delete(origin)
result.dispatcher.destroy()
}
}
this.emit('disconnect', origin, [this, ...targets], err)
}
this[kOnConnectionError] = (origin, targets, err) => {
// TODO: should this decrement result.count here?
this.emit('connectionError', origin, [this, ...targets], err)
}
}
get [kRunning] () {
let ret = 0
for (const client of this[kClients].values()) {
ret += client[kRunning]
for (const { dispatcher } of this[kClients].values()) {
ret += dispatcher[kRunning]
}
return ret
}
@@ -33103,8 +33173,8 @@ class Agent extends DispatcherBase {
throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.')
}
let dispatcher = this[kClients].get(key)
const result = this[kClients].get(key)
let dispatcher = result && result.dispatcher
if (!dispatcher) {
dispatcher = this[kFactory](opts.origin, this[kOptions])
.on('drain', this[kOnDrain])
@@ -33112,10 +33182,7 @@ class Agent extends DispatcherBase {
.on('disconnect', this[kOnDisconnect])
.on('connectionError', this[kOnConnectionError])
// This introduces a tiny memory leak, as dispatchers are never removed from the map.
// TODO(mcollina): remove te timer when the client/pool do not have any more
// active connections.
this[kClients].set(key, dispatcher)
this[kClients].set(key, { count: 0, dispatcher })
}
return dispatcher.dispatch(opts, handler)
@@ -33123,8 +33190,8 @@ class Agent extends DispatcherBase {
async [kClose] () {
const closePromises = []
for (const client of this[kClients].values()) {
closePromises.push(client.close())
for (const { dispatcher } of this[kClients].values()) {
closePromises.push(dispatcher.close())
}
this[kClients].clear()
@@ -33133,13 +33200,23 @@ class Agent extends DispatcherBase {
async [kDestroy] (err) {
const destroyPromises = []
for (const client of this[kClients].values()) {
destroyPromises.push(client.destroy(err))
for (const { dispatcher } of this[kClients].values()) {
destroyPromises.push(dispatcher.destroy(err))
}
this[kClients].clear()
await Promise.all(destroyPromises)
}
get stats () {
const allClientStats = {}
for (const { dispatcher } of this[kClients].values()) {
if (dispatcher.stats) {
allClientStats[dispatcher[kUrl].origin] = dispatcher.stats
}
}
return allClientStats
}
}
module.exports = Agent
@@ -35198,6 +35275,7 @@ function onHttp2SessionGoAway (errorCode) {
assert(client[kRunning] === 0)
client.emit('disconnect', client[kUrl], [client], err)
client.emit('connectionError', client[kUrl], [client], err)
client[kResume]()
}
@@ -35284,11 +35362,13 @@ function writeH2 (client, request) {
if (Array.isArray(val)) {
for (let i = 0; i < val.length; i++) {
if (headers[key]) {
headers[key] += `,${val[i]}`
headers[key] += `, ${val[i]}`
} else {
headers[key] = val[i]
}
}
} else if (headers[key]) {
headers[key] += `, ${val}`
} else {
headers[key] = val
}
@@ -35797,6 +35877,7 @@ const assert = __nccwpck_require__(4589)
const net = __nccwpck_require__(7030)
const http = __nccwpck_require__(7067)
const util = __nccwpck_require__(3440)
const { ClientStats } = __nccwpck_require__(6854)
const { channels } = __nccwpck_require__(2414)
const Request = __nccwpck_require__(4655)
const DispatcherBase = __nccwpck_require__(1841)
@@ -36053,6 +36134,10 @@ class Client extends DispatcherBase {
this[kResume](true)
}
get stats () {
return new ClientStats(this)
}
get [kPending] () {
return this[kQueue].length - this[kPendingIdx]
}
@@ -36953,6 +37038,136 @@ module.exports = class FixedQueue {
}
/***/ }),
/***/ 6815:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const { connect } = __nccwpck_require__(7030)
const { kClose, kDestroy } = __nccwpck_require__(6443)
const { InvalidArgumentError } = __nccwpck_require__(8707)
const util = __nccwpck_require__(3440)
const Client = __nccwpck_require__(3701)
const DispatcherBase = __nccwpck_require__(1841)
class H2CClient extends DispatcherBase {
#client = null
constructor (origin, clientOpts) {
super()
if (typeof origin === 'string') {
origin = new URL(origin)
}
if (origin.protocol !== 'http:') {
throw new InvalidArgumentError(
'h2c-client: Only h2c protocol is supported'
)
}
const { connect, maxConcurrentStreams, pipelining, ...opts } =
clientOpts ?? {}
let defaultMaxConcurrentStreams = 100
let defaultPipelining = 100
if (
maxConcurrentStreams != null &&
Number.isInteger(maxConcurrentStreams) &&
maxConcurrentStreams > 0
) {
defaultMaxConcurrentStreams = maxConcurrentStreams
}
if (pipelining != null && Number.isInteger(pipelining) && pipelining > 0) {
defaultPipelining = pipelining
}
if (defaultPipelining > defaultMaxConcurrentStreams) {
throw new InvalidArgumentError(
'h2c-client: pipelining cannot be greater than maxConcurrentStreams'
)
}
this.#client = new Client(origin, {
...opts,
connect: this.#buildConnector(connect),
maxConcurrentStreams: defaultMaxConcurrentStreams,
pipelining: defaultPipelining,
allowH2: true
})
}
#buildConnector (connectOpts) {
return (opts, callback) => {
const timeout = connectOpts?.connectOpts ?? 10e3
const { hostname, port, pathname } = opts
const socket = connect({
...opts,
host: hostname,
port,
pathname
})
// Set TCP keep alive options on the socket here instead of in connect() for the case of assigning the socket
if (opts.keepAlive == null || opts.keepAlive) {
const keepAliveInitialDelay =
opts.keepAliveInitialDelay == null ? 60e3 : opts.keepAliveInitialDelay
socket.setKeepAlive(true, keepAliveInitialDelay)
}
socket.alpnProtocol = 'h2'
const clearConnectTimeout = util.setupConnectTimeout(
new WeakRef(socket),
{ timeout, hostname, port }
)
socket
.setNoDelay(true)
.once('connect', function () {
queueMicrotask(clearConnectTimeout)
if (callback) {
const cb = callback
callback = null
cb(null, this)
}
})
.on('error', function (err) {
queueMicrotask(clearConnectTimeout)
if (callback) {
const cb = callback
callback = null
cb(err)
}
})
return socket
}
}
dispatch (opts, handler) {
return this.#client.dispatch(opts, handler)
}
async [kClose] () {
await this.#client.close()
}
async [kDestroy] () {
await this.#client.destroy()
}
}
module.exports = H2CClient
/***/ }),
/***/ 2128:
@@ -36961,10 +37176,10 @@ module.exports = class FixedQueue {
"use strict";
const { PoolStats } = __nccwpck_require__(6854)
const DispatcherBase = __nccwpck_require__(1841)
const FixedQueue = __nccwpck_require__(4660)
const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(6443)
const PoolStats = __nccwpck_require__(3246)
const kClients = Symbol('clients')
const kNeedDrain = Symbol('needDrain')
@@ -36977,7 +37192,6 @@ const kOnConnectionError = Symbol('onConnectionError')
const kGetDispatcher = Symbol('get dispatcher')
const kAddClient = Symbol('add client')
const kRemoveClient = Symbol('remove client')
const kStats = Symbol('stats')
class PoolBase extends DispatcherBase {
constructor () {
@@ -37028,8 +37242,6 @@ class PoolBase extends DispatcherBase {
this[kOnConnectionError] = (origin, targets, err) => {
pool.emit('connectionError', origin, [pool, ...targets], err)
}
this[kStats] = new PoolStats(this)
}
get [kBusy] () {
@@ -37069,7 +37281,7 @@ class PoolBase extends DispatcherBase {
}
get stats () {
return this[kStats]
return new PoolStats(this)
}
async [kClose] () {
@@ -37155,50 +37367,6 @@ module.exports = {
}
/***/ }),
/***/ 3246:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(6443)
const kPool = Symbol('pool')
class PoolStats {
constructor (pool) {
this[kPool] = pool
}
get connected () {
return this[kPool][kConnected]
}
get free () {
return this[kPool][kFree]
}
get pending () {
return this[kPool][kPending]
}
get queued () {
return this[kPool][kQueued]
}
get running () {
return this[kPool][kRunning]
}
get size () {
return this[kPool][kSize]
}
}
module.exports = PoolStats
/***/ }),
/***/ 628:
@@ -37212,7 +37380,8 @@ const {
kClients,
kNeedDrain,
kAddClient,
kGetDispatcher
kGetDispatcher,
kRemoveClient
} = __nccwpck_require__(2128)
const Client = __nccwpck_require__(3701)
const {
@@ -37242,6 +37411,7 @@ class Pool extends PoolBase {
autoSelectFamily,
autoSelectFamilyAttemptTimeout,
allowH2,
clientTtl,
...options
} = {}) {
if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
@@ -37272,12 +37442,20 @@ class Pool extends PoolBase {
this[kConnections] = connections || null
this[kUrl] = util.parseOrigin(origin)
this[kOptions] = { ...util.deepClone(options), connect, allowH2 }
this[kOptions] = { ...util.deepClone(options), connect, allowH2, clientTtl }
this[kOptions].interceptors = options.interceptors
? { ...options.interceptors }
: undefined
this[kFactory] = factory
this.on('connect', (origin, targets) => {
if (clientTtl != null && clientTtl > 0) {
for (const target of targets) {
Object.assign(target, { ttl: Date.now() })
}
}
})
this.on('connectionError', (origin, targets, error) => {
// If a connection error occurs, we remove the client from the pool,
// and emit a connectionError event. They will not be re-used.
@@ -37294,8 +37472,12 @@ class Pool extends PoolBase {
}
[kGetDispatcher] () {
const clientTtlOption = this[kOptions].clientTtl
for (const client of this[kClients]) {
if (!client[kNeedDrain]) {
// check ttl of client and if it's stale, remove it from the pool
if (clientTtlOption != null && clientTtlOption > 0 && client.ttl && ((Date.now() - client.ttl) > clientTtlOption)) {
this[kRemoveClient](client)
} else if (!client[kNeedDrain]) {
return client
}
}
@@ -37319,13 +37501,14 @@ module.exports = Pool
"use strict";
const { kProxy, kClose, kDestroy } = __nccwpck_require__(6443)
const { kProxy, kClose, kDestroy, kDispatch, kConnector } = __nccwpck_require__(6443)
const { URL } = __nccwpck_require__(3136)
const Agent = __nccwpck_require__(7405)
const Pool = __nccwpck_require__(628)
const DispatcherBase = __nccwpck_require__(1841)
const { InvalidArgumentError, RequestAbortedError, SecureProxyConnectionError } = __nccwpck_require__(8707)
const buildConnector = __nccwpck_require__(9136)
const Client = __nccwpck_require__(3701)
const kAgent = Symbol('proxy agent')
const kClient = Symbol('proxy client')
@@ -37333,6 +37516,7 @@ const kProxyHeaders = Symbol('proxy headers')
const kRequestTls = Symbol('request tls settings')
const kProxyTls = Symbol('proxy tls settings')
const kConnectEndpoint = Symbol('connect endpoint function')
const kTunnelProxy = Symbol('tunnel proxy')
function defaultProtocolPort (protocol) {
return protocol === 'https:' ? 443 : 80
@@ -37344,6 +37528,61 @@ function defaultFactory (origin, opts) {
const noop = () => {}
class ProxyClient extends DispatcherBase {
#client = null
constructor (origin, opts) {
if (typeof origin === 'string') {
origin = new URL(origin)
}
if (origin.protocol !== 'http:' && origin.protocol !== 'https:') {
throw new InvalidArgumentError('ProxyClient only supports http and https protocols')
}
super()
this.#client = new Client(origin, opts)
}
async [kClose] () {
await this.#client.close()
}
async [kDestroy] () {
await this.#client.destroy()
}
async [kDispatch] (opts, handler) {
const { method, origin } = opts
if (method === 'CONNECT') {
this.#client[kConnector]({
origin,
port: opts.port || defaultProtocolPort(opts.protocol),
path: opts.host,
signal: opts.signal,
headers: {
...this[kProxyHeaders],
host: opts.host
},
servername: this[kProxyTls]?.servername || opts.servername
},
(err, socket) => {
if (err) {
handler.callback(err)
} else {
handler.callback(null, { socket, statusCode: 200 })
}
}
)
return
}
if (typeof origin === 'string') {
opts.origin = new URL(origin)
}
return this.#client.dispatch(opts, handler)
}
}
class ProxyAgent extends DispatcherBase {
constructor (opts) {
if (!opts || (typeof opts === 'object' && !(opts instanceof URL) && !opts.uri)) {
@@ -37355,6 +37594,8 @@ class ProxyAgent extends DispatcherBase {
throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.')
}
const { proxyTunnel = true } = opts
super()
const url = this.#getUrl(opts)
@@ -37376,9 +37617,19 @@ class ProxyAgent extends DispatcherBase {
this[kProxyHeaders]['proxy-authorization'] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString('base64')}`
}
const factory = (!proxyTunnel && protocol === 'http:')
? (origin, options) => {
if (origin.protocol === 'http:') {
return new ProxyClient(origin, options)
}
return new Client(origin, options)
}
: undefined
const connect = buildConnector({ ...opts.proxyTls })
this[kConnectEndpoint] = buildConnector({ ...opts.requestTls })
this[kClient] = clientFactory(url, { connect })
this[kClient] = clientFactory(url, { connect, factory })
this[kTunnelProxy] = proxyTunnel
this[kAgent] = new Agent({
...opts,
connect: async (opts, callback) => {
@@ -37434,6 +37685,10 @@ class ProxyAgent extends DispatcherBase {
headers.host = host
}
if (!this.#shouldConnect(new URL(opts.origin))) {
opts.path = opts.origin + opts.path
}
return this[kAgent].dispatch(
{
...opts,
@@ -37466,6 +37721,19 @@ class ProxyAgent extends DispatcherBase {
await this[kAgent].destroy()
await this[kClient].destroy()
}
#shouldConnect (uri) {
if (typeof uri === 'string') {
uri = new URL(uri)
}
if (this[kTunnelProxy]) {
return true
}
if (uri.protocol !== 'http:' || this[kProxy].protocol !== 'http:') {
return true
}
return false
}
}
/**
@@ -38064,7 +38332,7 @@ const assert = __nccwpck_require__(4589)
* here, which we then just pass on to the next handler (most likely a
* CacheHandler). Note that this assumes the proper headers were already
* included in the request to tell the origin that we want to revalidate the
* response (i.e. if-modified-since).
* response (i.e. if-modified-since or if-none-match).
*
* @see https://www.rfc-editor.org/rfc/rfc9111.html#name-validation
*
@@ -39060,7 +39328,7 @@ const util = __nccwpck_require__(3440)
const CacheHandler = __nccwpck_require__(9976)
const MemoryCacheStore = __nccwpck_require__(4889)
const CacheRevalidationHandler = __nccwpck_require__(7133)
const { assertCacheStore, assertCacheMethods, makeCacheKey, parseCacheControlHeader } = __nccwpck_require__(7659)
const { assertCacheStore, assertCacheMethods, makeCacheKey, normaliseHeaders, parseCacheControlHeader } = __nccwpck_require__(7659)
const { AbortError } = __nccwpck_require__(8707)
/**
@@ -39074,7 +39342,12 @@ const { AbortError } = __nccwpck_require__(8707)
*/
function needsRevalidation (result, cacheControlDirectives) {
if (cacheControlDirectives?.['no-cache']) {
// Always revalidate requests with the no-cache directive
// Always revalidate requests with the no-cache request directive
return true
}
if (result.cacheControlDirectives?.['no-cache'] && !Array.isArray(result.cacheControlDirectives['no-cache'])) {
// Always revalidate requests with unqualified no-cache response directive
return true
}
@@ -39275,7 +39548,7 @@ function handleResult (
// Check if the response is stale
if (needsRevalidation(result, reqCacheControl)) {
if (util.isStream(opts.body) && util.bodyLength(opts.body) !== 0) {
// If body is is stream we can't revalidate...
// If body is a stream we can't revalidate...
// TODO (fix): This could be less strict...
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler))
}
@@ -39373,6 +39646,11 @@ module.exports = (opts = {}) => {
return dispatch(opts, handler)
}
opts = {
...opts,
headers: normaliseHeaders(opts)
}
const reqCacheControl = opts.headers?.['cache-control']
? parseCacheControlHeader(opts.headers['cache-control'])
: undefined
@@ -40733,11 +41011,12 @@ const {
kMockAgentIsCallHistoryEnabled,
kMockAgentAddCallHistoryLog,
kMockAgentMockCallHistoryInstance,
kMockAgentAcceptsNonStandardSearchParameters,
kMockCallHistoryAddLog
} = __nccwpck_require__(1117)
const MockClient = __nccwpck_require__(7365)
const MockPool = __nccwpck_require__(4004)
const { matchValue, buildAndValidateMockOptions } = __nccwpck_require__(3397)
const { matchValue, normalizeSearchParams, buildAndValidateMockOptions } = __nccwpck_require__(3397)
const { InvalidArgumentError, UndiciError } = __nccwpck_require__(8707)
const Dispatcher = __nccwpck_require__(883)
const PendingInterceptorsFormatter = __nccwpck_require__(6142)
@@ -40752,6 +41031,7 @@ class MockAgent extends Dispatcher {
this[kNetConnect] = true
this[kIsMockActive] = true
this[kMockAgentIsCallHistoryEnabled] = mockOptions?.enableCallHistory ?? false
this[kMockAgentAcceptsNonStandardSearchParameters] = mockOptions?.acceptNonStandardSearchParameters ?? false
// Instantiate Agent and encapsulate
if (opts?.agent && typeof opts.agent.dispatch !== 'function') {
@@ -40784,7 +41064,17 @@ class MockAgent extends Dispatcher {
this[kMockAgentAddCallHistoryLog](opts)
return this[kAgent].dispatch(opts, handler)
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters]
const dispatchOpts = { ...opts }
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
const [path, searchParams] = dispatchOpts.path.split('?')
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)
dispatchOpts.path = `${path}?${normalizedSearchParams}`
}
return this[kAgent].dispatch(dispatchOpts, handler)
}
async close () {
@@ -40864,7 +41154,7 @@ class MockAgent extends Dispatcher {
}
[kMockAgentSet] (origin, dispatcher) {
this[kClients].set(origin, dispatcher)
this[kClients].set(origin, { count: 0, dispatcher })
}
[kFactory] (origin) {
@@ -40876,9 +41166,9 @@ class MockAgent extends Dispatcher {
[kMockAgentGet] (origin) {
// First check if we can immediately find it
const client = this[kClients].get(origin)
if (client) {
return client
const result = this[kClients].get(origin)
if (result?.dispatcher) {
return result.dispatcher
}
// If the origin is not a string create a dummy parent pool and return to user
@@ -40889,11 +41179,11 @@ class MockAgent extends Dispatcher {
}
// If we match, create a pool and assign the same dispatches
for (const [keyMatcher, nonExplicitDispatcher] of Array.from(this[kClients])) {
if (nonExplicitDispatcher && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) {
for (const [keyMatcher, result] of Array.from(this[kClients])) {
if (result && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) {
const dispatcher = this[kFactory](origin)
this[kMockAgentSet](origin, dispatcher)
dispatcher[kDispatches] = nonExplicitDispatcher[kDispatches]
dispatcher[kDispatches] = result.dispatcher[kDispatches]
return dispatcher
}
}
@@ -40907,7 +41197,7 @@ class MockAgent extends Dispatcher {
const mockAgentClients = this[kClients]
return Array.from(mockAgentClients.entries())
.flatMap(([origin, scope]) => scope[kDispatches].map(dispatch => ({ ...dispatch, origin })))
.flatMap(([origin, result]) => result.dispatcher[kDispatches].map(dispatch => ({ ...dispatch, origin })))
.filter(({ pending }) => pending)
}
@@ -41607,6 +41897,7 @@ module.exports = {
kMockAgentRegisterCallHistory: Symbol('mock agent register mock call history'),
kMockAgentAddCallHistoryLog: Symbol('mock agent add call history log'),
kMockAgentIsCallHistoryEnabled: Symbol('mock agent is call history enabled'),
kMockAgentAcceptsNonStandardSearchParameters: Symbol('mock agent accepts non standard search parameters'),
kMockCallHistoryAddLog: Symbol('mock call history add log')
}
@@ -41711,13 +42002,42 @@ function matchHeaders (mockDispatch, headers) {
return true
}
function normalizeSearchParams (query) {
if (typeof query !== 'string') {
return query
}
const originalQp = new URLSearchParams(query)
const normalizedQp = new URLSearchParams()
for (let [key, value] of originalQp.entries()) {
key = key.replace('[]', '')
const valueRepresentsString = /^(['"]).*\1$/.test(value)
if (valueRepresentsString) {
normalizedQp.append(key, value)
continue
}
if (value.includes(',')) {
const values = value.split(',')
for (const v of values) {
normalizedQp.append(key, v)
}
continue
}
normalizedQp.append(key, value)
}
return normalizedQp
}
function safeUrl (path) {
if (typeof path !== 'string') {
return path
}
const pathSegments = path.split('?')
const pathSegments = path.split('?', 3)
if (pathSegments.length !== 2) {
return path
}
@@ -41995,6 +42315,10 @@ function buildAndValidateMockOptions (opts) {
throw new InvalidArgumentError('options.enableCallHistory must to be a boolean')
}
if ('acceptNonStandardSearchParameters' in mockOptions && typeof mockOptions.acceptNonStandardSearchParameters !== 'boolean') {
throw new InvalidArgumentError('options.acceptNonStandardSearchParameters must to be a boolean')
}
return mockOptions
}
}
@@ -42014,7 +42338,8 @@ module.exports = {
checkNetConnect,
buildAndValidateMockOptions,
getHeaderByName,
buildHeadersFromArray
buildHeadersFromArray,
normalizeSearchParams
}
@@ -42089,7 +42414,19 @@ function makeCacheKey (opts) {
throw new Error('opts.origin is undefined')
}
/** @type {Record<string, string[] | string>} */
return {
origin: opts.origin.toString(),
method: opts.method,
path: opts.path,
headers: opts.headers
}
}
/**
* @param {Record<string, string[] | string>}
* @return {Record<string, string[] | string>}
*/
function normaliseHeaders (opts) {
let headers
if (opts.headers == null) {
headers = {}
@@ -42115,12 +42452,7 @@ function makeCacheKey (opts) {
throw new Error('opts.headers is not an object')
}
return {
origin: opts.origin.toString(),
method: opts.method,
path: opts.path,
headers
}
return headers
}
/**
@@ -42427,6 +42759,7 @@ function assertCacheMethods (methods, name = 'CacheMethods') {
module.exports = {
makeCacheKey,
normaliseHeaders,
assertCacheKey,
assertCacheValue,
parseCacheControlHeader,
@@ -42704,6 +43037,46 @@ module.exports = {
}
/***/ }),
/***/ 6854:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const {
kConnected,
kPending,
kRunning,
kSize,
kFree,
kQueued
} = __nccwpck_require__(6443)
class ClientStats {
constructor (client) {
this.connected = client[kConnected]
this.pending = client[kPending]
this.running = client[kRunning]
this.size = client[kSize]
}
}
class PoolStats {
constructor (pool) {
this.connected = pool[kConnected]
this.free = pool[kFree]
this.pending = pool[kPending]
this.queued = pool[kQueued]
this.running = pool[kRunning]
this.size = pool[kSize]
}
}
module.exports = { ClientStats, PoolStats }
/***/ }),
/***/ 6603:
@@ -49366,7 +49739,9 @@ function finalizeAndReportTiming (response, initiatorType = 'other') {
originalURL.href,
initiatorType,
globalThis,
cacheState
cacheState,
'', // bodyType
response.status
)
}
@@ -50051,7 +50426,7 @@ function fetchFinale (fetchParams, response) {
// 3. Set fetchParamss controllers report timing steps to the following steps given a global object global:
fetchParams.controller.reportTimingSteps = () => {
// 1. If fetchParamss requests URLs scheme is not an HTTP(S) scheme, then return.
if (fetchParams.request.url.protocol !== 'https:') {
if (!urlIsHttpHttpsScheme(fetchParams.request.url)) {
return
}
@@ -50093,7 +50468,6 @@ function fetchFinale (fetchParams, response) {
// fetchParamss requests URL, fetchParamss requests initiator type, global, cacheState, bodyInfo,
// and responseStatus.
if (fetchParams.request.initiatorType != null) {
// TODO: update markresourcetiming
markResourceTiming(timingInfo, fetchParams.request.url.href, fetchParams.request.initiatorType, globalThis, cacheState, bodyInfo, responseStatus)
}
}
@@ -58010,7 +58384,7 @@ function parseExtensions (extensions) {
while (position.position < extensions.length) {
const pair = collectASequenceOfCodePointsFast(';', extensions, position)
const [name, value = ''] = pair.split('=')
const [name, value = ''] = pair.split('=', 2)
extensionList.set(
removeHTTPWhitespace(name, true, false),
@@ -65121,7 +65495,8 @@ var NON_VARIABLE_OPTIONS = [
"headers",
"request",
"query",
"mediaType"
"mediaType",
"operationName"
];
var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
@@ -65259,7 +65634,7 @@ var createTokenAuth = function createTokenAuth2(token) {
;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/version.js
const version_VERSION = "6.1.4";
const version_VERSION = "7.0.2";
;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/index.js