Skip to content

Commit 5d0aec8

Browse files
chore(deps): update dependencies (#182)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: jkroepke-automation[bot] <210774419+jkroepke-automation[bot]@users.noreply.github.com>
1 parent dd2b9ff commit 5d0aec8

File tree

5 files changed

+149
-86
lines changed

5 files changed

+149
-86
lines changed

dist/index.js

Lines changed: 143 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,19 +2335,39 @@ function requireUtil$5 () {
23352335
const key = headerNameToString(headers[i]);
23362336
let val = obj[key];
23372337

2338-
if (val) {
2339-
if (typeof val === 'string') {
2340-
val = [val];
2341-
obj[key] = val;
2342-
}
2343-
val.push(headers[i + 1].toString('latin1'));
2344-
} else {
2345-
const headersValue = headers[i + 1];
2346-
if (typeof headersValue === 'string') {
2347-
obj[key] = headersValue;
2338+
if (val !== undefined) {
2339+
if (!Object.hasOwn(obj, key)) {
2340+
const headersValue = typeof headers[i + 1] === 'string'
2341+
? headers[i + 1]
2342+
: Array.isArray(headers[i + 1])
2343+
? headers[i + 1].map(x => x.toString('latin1'))
2344+
: headers[i + 1].toString('latin1');
2345+
2346+
if (key === '__proto__') {
2347+
Object.defineProperty(obj, key, {
2348+
value: headersValue,
2349+
enumerable: true,
2350+
configurable: true,
2351+
writable: true
2352+
});
2353+
} else {
2354+
obj[key] = headersValue;
2355+
}
23482356
} else {
2349-
obj[key] = Array.isArray(headersValue) ? headersValue.map(x => x.toString('latin1')) : headersValue.toString('latin1');
2357+
if (typeof val === 'string') {
2358+
val = [val];
2359+
obj[key] = val;
2360+
}
2361+
val.push(headers[i + 1].toString('latin1'));
23502362
}
2363+
} else {
2364+
const headersValue = typeof headers[i + 1] === 'string'
2365+
? headers[i + 1]
2366+
: Array.isArray(headers[i + 1])
2367+
? headers[i + 1].map(x => x.toString('latin1'))
2368+
: headers[i + 1].toString('latin1');
2369+
2370+
obj[key] = headersValue;
23512371
}
23522372
}
23532373

@@ -3092,10 +3112,12 @@ function requireDiagnostics () {
30923112

30933113
diagnosticsChannel.subscribe('undici:websocket:open',
30943114
evt => {
3095-
const {
3096-
address: { address, port }
3097-
} = evt;
3098-
debugLog('connection opened %s%s', address, port ? `:${port}` : '');
3115+
if (evt.address != null) {
3116+
const { address, port } = evt.address;
3117+
debugLog('connection opened %s%s', address, port ? `:${port}` : '');
3118+
} else {
3119+
debugLog('connection opened');
3120+
}
30993121
});
31003122

31013123
diagnosticsChannel.subscribe('undici:websocket:close',
@@ -3560,13 +3582,21 @@ function requireRequest$1 () {
35603582
} else if (headerName === 'transfer-encoding' || headerName === 'keep-alive' || headerName === 'upgrade') {
35613583
throw new InvalidArgumentError(`invalid ${headerName} header`)
35623584
} else if (headerName === 'connection') {
3563-
const value = typeof val === 'string' ? val.toLowerCase() : null;
3564-
if (value !== 'close' && value !== 'keep-alive') {
3585+
// Per RFC 7230 Section 6.1, Connection header can contain
3586+
// a comma-separated list of connection option tokens (header names)
3587+
const value = typeof val === 'string' ? val : null;
3588+
if (value === null) {
35653589
throw new InvalidArgumentError('invalid connection header')
35663590
}
35673591

3568-
if (value === 'close') {
3569-
request.reset = true;
3592+
for (const token of value.toLowerCase().split(',')) {
3593+
const trimmed = token.trim();
3594+
if (!isValidHTTPToken(trimmed)) {
3595+
throw new InvalidArgumentError('invalid connection header')
3596+
}
3597+
if (trimmed === 'close') {
3598+
request.reset = true;
3599+
}
35703600
}
35713601
} else if (headerName === 'expect') {
35723602
throw new NotSupportedError('expect header not supported')
@@ -13015,65 +13045,70 @@ function requireClient () {
1301513045
});
1301613046
}
1301713047

13018-
client[kConnector]({
13019-
host,
13020-
hostname,
13021-
protocol,
13022-
port,
13023-
servername: client[kServerName],
13024-
localAddress: client[kLocalAddress]
13025-
}, (err, socket) => {
13026-
if (err) {
13027-
handleConnectError(client, err, { host, hostname, protocol, port });
13028-
client[kResume]();
13029-
return
13030-
}
13048+
try {
13049+
client[kConnector]({
13050+
host,
13051+
hostname,
13052+
protocol,
13053+
port,
13054+
servername: client[kServerName],
13055+
localAddress: client[kLocalAddress]
13056+
}, (err, socket) => {
13057+
if (err) {
13058+
handleConnectError(client, err, { host, hostname, protocol, port });
13059+
client[kResume]();
13060+
return
13061+
}
1303113062

13032-
if (client.destroyed) {
13033-
util.destroy(socket.on('error', noop), new ClientDestroyedError());
13034-
client[kResume]();
13035-
return
13036-
}
13063+
if (client.destroyed) {
13064+
util.destroy(socket.on('error', noop), new ClientDestroyedError());
13065+
client[kResume]();
13066+
return
13067+
}
1303713068

13038-
assert(socket);
13069+
assert(socket);
1303913070

13040-
try {
13041-
client[kHTTPContext] = socket.alpnProtocol === 'h2'
13042-
? connectH2(client, socket)
13043-
: connectH1(client, socket);
13044-
} catch (err) {
13045-
socket.destroy().on('error', noop);
13046-
handleConnectError(client, err, { host, hostname, protocol, port });
13047-
client[kResume]();
13048-
return
13049-
}
13071+
try {
13072+
client[kHTTPContext] = socket.alpnProtocol === 'h2'
13073+
? connectH2(client, socket)
13074+
: connectH1(client, socket);
13075+
} catch (err) {
13076+
socket.destroy().on('error', noop);
13077+
handleConnectError(client, err, { host, hostname, protocol, port });
13078+
client[kResume]();
13079+
return
13080+
}
1305013081

13051-
client[kConnecting] = false;
13082+
client[kConnecting] = false;
1305213083

13053-
socket[kCounter] = 0;
13054-
socket[kMaxRequests] = client[kMaxRequests];
13055-
socket[kClient] = client;
13056-
socket[kError] = null;
13084+
socket[kCounter] = 0;
13085+
socket[kMaxRequests] = client[kMaxRequests];
13086+
socket[kClient] = client;
13087+
socket[kError] = null;
1305713088

13058-
if (channels.connected.hasSubscribers) {
13059-
channels.connected.publish({
13060-
connectParams: {
13061-
host,
13062-
hostname,
13063-
protocol,
13064-
port,
13065-
version: client[kHTTPContext]?.version,
13066-
servername: client[kServerName],
13067-
localAddress: client[kLocalAddress]
13068-
},
13069-
connector: client[kConnector],
13070-
socket
13071-
});
13072-
}
13089+
if (channels.connected.hasSubscribers) {
13090+
channels.connected.publish({
13091+
connectParams: {
13092+
host,
13093+
hostname,
13094+
protocol,
13095+
port,
13096+
version: client[kHTTPContext]?.version,
13097+
servername: client[kServerName],
13098+
localAddress: client[kLocalAddress]
13099+
},
13100+
connector: client[kConnector],
13101+
socket
13102+
});
13103+
}
1307313104

13074-
client.emit('connect', client[kUrl], [client]);
13105+
client.emit('connect', client[kUrl], [client]);
13106+
client[kResume]();
13107+
});
13108+
} catch (err) {
13109+
handleConnectError(client, err, { host, hostname, protocol, port });
1307513110
client[kResume]();
13076-
});
13111+
}
1307713112
}
1307813113

1307913114
function handleConnectError (client, err, { host, hostname, protocol, port }) {
@@ -17793,7 +17828,8 @@ function requireMockSymbols () {
1779317828
kMockAgentAddCallHistoryLog: Symbol('mock agent add call history log'),
1779417829
kMockAgentIsCallHistoryEnabled: Symbol('mock agent is call history enabled'),
1779517830
kMockAgentAcceptsNonStandardSearchParameters: Symbol('mock agent accepts non standard search parameters'),
17796-
kMockCallHistoryAddLog: Symbol('mock call history add log')
17831+
kMockCallHistoryAddLog: Symbol('mock call history add log'),
17832+
kTotalDispatchCount: Symbol('total dispatch count')
1779717833
};
1779817834
return mockSymbols;
1779917835
}
@@ -17811,7 +17847,8 @@ function requireMockUtils () {
1781117847
kMockAgent,
1781217848
kOriginalDispatch,
1781317849
kOrigin,
17814-
kGetNetConnect
17850+
kGetNetConnect,
17851+
kTotalDispatchCount
1781517852
} = requireMockSymbols();
1781617853
const { serializePathWithQuery } = requireUtil$5();
1781717854
const { STATUS_CODES } = require$$2;
@@ -18011,6 +18048,8 @@ function requireMockUtils () {
1801118048
const replyData = typeof data === 'function' ? { callback: data } : { ...data };
1801218049
const newMockDispatch = { ...baseData, ...key, pending: true, data: { error: null, ...replyData } };
1801318050
mockDispatches.push(newMockDispatch);
18051+
// Track total number of intercepts ever registered for better error messages
18052+
mockDispatches[kTotalDispatchCount] = (mockDispatches[kTotalDispatchCount] || 0) + 1;
1801418053
return newMockDispatch
1801518054
}
1801618055

@@ -18206,13 +18245,16 @@ function requireMockUtils () {
1820618245
} catch (error) {
1820718246
if (error.code === 'UND_MOCK_ERR_MOCK_NOT_MATCHED') {
1820818247
const netConnect = agent[kGetNetConnect]();
18248+
const totalInterceptsCount = this[kDispatches][kTotalDispatchCount] || this[kDispatches].length;
18249+
const pendingInterceptsCount = this[kDispatches].filter(({ consumed }) => !consumed).length;
18250+
const interceptsMessage = `, ${pendingInterceptsCount} interceptor(s) remaining out of ${totalInterceptsCount} defined`;
1820918251
if (netConnect === false) {
18210-
throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`)
18252+
throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)${interceptsMessage}`)
1821118253
}
1821218254
if (checkNetConnect(netConnect, origin)) {
1821318255
originalDispatch.call(this, opts, handler);
1821418256
} else {
18215-
throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`)
18257+
throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)${interceptsMessage}`)
1821618258
}
1821718259
} else {
1821818260
throw error
@@ -22764,7 +22806,7 @@ function requireCacheHandler () {
2276422806
}
2276522807

2276622808
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
22767-
if (!canCacheResponse(this.#cacheType, statusCode, resHeaders, cacheControlDirectives)) {
22809+
if (!canCacheResponse(this.#cacheType, statusCode, resHeaders, cacheControlDirectives, this.#cacheKey.headers)) {
2276822810
return downstreamOnHeaders()
2276922811
}
2277022812

@@ -22969,8 +23011,9 @@ function requireCacheHandler () {
2296923011
* @param {number} statusCode
2297023012
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} resHeaders
2297123013
* @param {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives} cacheControlDirectives
23014+
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} [reqHeaders]
2297223015
*/
22973-
function canCacheResponse (cacheType, statusCode, resHeaders, cacheControlDirectives) {
23016+
function canCacheResponse (cacheType, statusCode, resHeaders, cacheControlDirectives, reqHeaders) {
2297423017
// Status code must be final and understood.
2297523018
if (statusCode < 200 || NOT_UNDERSTOOD_STATUS_CODES.includes(statusCode)) {
2297623019
return false
@@ -23001,8 +23044,16 @@ function requireCacheHandler () {
2300123044
}
2300223045

2300323046
// https://www.rfc-editor.org/rfc/rfc9111.html#name-storing-responses-to-authen
23004-
if (resHeaders.authorization) {
23005-
if (!cacheControlDirectives.public || typeof resHeaders.authorization !== 'string') {
23047+
if (reqHeaders?.authorization) {
23048+
if (
23049+
!cacheControlDirectives.public &&
23050+
!cacheControlDirectives['s-maxage'] &&
23051+
!cacheControlDirectives['must-revalidate']
23052+
) {
23053+
return false
23054+
}
23055+
23056+
if (typeof reqHeaders.authorization !== 'string') {
2300623057
return false
2300723058
}
2300823059

@@ -34517,6 +34568,18 @@ function requireWebsocket () {
3451734568
const { WebsocketFrameSend } = requireFrame();
3451834569
const { channels } = requireDiagnostics();
3451934570

34571+
function getSocketAddress (socket) {
34572+
if (typeof socket?.address === 'function') {
34573+
return socket.address()
34574+
}
34575+
34576+
if (typeof socket?.session?.socket?.address === 'function') {
34577+
return socket.session.socket.address()
34578+
}
34579+
34580+
return null
34581+
}
34582+
3452034583
/**
3452134584
* @typedef {object} Handler
3452234585
* @property {(response: any, extensions?: string[]) => void} onConnectionEstablished
@@ -34983,7 +35046,7 @@ function requireWebsocket () {
3498335046
// Convert headers to a plain object for the event
3498435047
const headers = response.headersList.entries;
3498535048
channels.open.publish({
34986-
address: response.socket.address(),
35049+
address: getSocketAddress(response.socket),
3498735050
protocol: this.#protocol,
3498835051
extensions: this.#extensions,
3498935052
websocket: this,
@@ -42122,7 +42185,7 @@ function _getGlobal(key, defaultValue) {
4212242185
const toolName = 'stackit';
4212342186
const githubRepository = 'stackitcloud/stackit-cli';
4212442187
// renovate: github=stackitcloud/stackit-cli
42125-
const defaultVersion = 'v0.56.0';
42188+
const defaultVersion = 'v0.57.0';
4212642189
function binaryName(version, os, arch) {
4212742190
version = semverExports.clean(version) || version;
4212842191
return `stackit-cli_${version}_${os}_${arch}.${os === 'windows' ? 'zip' : 'tar.gz'}`;

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@
6363
"@rollup/rollup-linux-x64-gnu": "4.59.0"
6464
},
6565
"overrides": {
66-
"undici": "7.24.5"
66+
"undici": "7.24.6"
6767
}
6868
}

src/tool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const toolName = 'stackit'
55
export const githubRepository = 'stackitcloud/stackit-cli'
66

77
// renovate: github=stackitcloud/stackit-cli
8-
export const defaultVersion = 'v0.56.0'
8+
export const defaultVersion = 'v0.57.0'
99

1010
export function binaryName(version: string, os: string, arch: string): string {
1111
version = clean(version) || version

0 commit comments

Comments
 (0)