@zuplo/cli 6.70.61 → 6.70.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@fastify/reply-from/node_modules/undici/lib/handler/unwrap-handler.js +6 -0
- package/node_modules/@fastify/reply-from/node_modules/undici/package.json +1 -1
- package/node_modules/@fastify/reply-from/node_modules/undici/types/dispatcher.d.ts +2 -0
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-C2TBCXWG.js +26 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-C2TBCXWG.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-GI3LNO4X.js +370 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-GI3LNO4X.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +52 -1
- package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +4 -1
- package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +4 -1
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/axios/CHANGELOG.md +42 -0
- package/node_modules/axios/README.md +237 -237
- package/node_modules/axios/dist/axios.js +113 -21
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +121 -15
- package/node_modules/axios/dist/esm/axios.js +121 -15
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +249 -107
- package/node_modules/axios/index.d.cts +8 -3
- package/node_modules/axios/index.d.ts +4 -1
- package/node_modules/axios/lib/adapters/fetch.js +79 -0
- package/node_modules/axios/lib/adapters/http.js +62 -118
- package/node_modules/axios/lib/core/Axios.js +1 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +2 -2
- package/node_modules/axios/lib/defaults/transitional.js +1 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
- package/node_modules/axios/lib/helpers/buildURL.js +1 -1
- package/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
- package/node_modules/axios/lib/helpers/resolveConfig.js +12 -6
- package/node_modules/axios/lib/helpers/toFormData.js +1 -1
- package/node_modules/axios/lib/utils.js +23 -2
- package/node_modules/axios/package.json +29 -13
- package/node_modules/thread-stream/.claude/settings.local.json +15 -0
- package/node_modules/thread-stream/CLAUDE.md +64 -0
- package/node_modules/thread-stream/README.md +2 -1
- package/node_modules/thread-stream/index.js +41 -13
- package/node_modules/thread-stream/lib/indexes.js +3 -1
- package/node_modules/thread-stream/lib/worker.js +20 -8
- package/node_modules/thread-stream/package.json +1 -1
- package/node_modules/thread-stream/test/base.test.js +61 -88
- package/node_modules/thread-stream/test/message-without-code.js +19 -0
- package/node_modules/thread-stream/test/watch-mode.test.js +28 -0
- package/package.json +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-4SACVMDH.js +0 -26
- package/node_modules/@zuplo/runtime/out/esm/chunk-4SACVMDH.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-6WKYPMAI.js +0 -322
- package/node_modules/@zuplo/runtime/out/esm/chunk-6WKYPMAI.js.map +0 -1
- package/node_modules/axios/dist/axios.js.map +0 -1
- package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
- package/node_modules/axios/dist/esm/axios.js.map +0 -1
- package/node_modules/axios/dist/node/axios.cjs.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-6WKYPMAI.js.LEGAL.txt → chunk-GI3LNO4X.js.LEGAL.txt} +0 -0
|
@@ -19,6 +19,35 @@ const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
|
19
19
|
|
|
20
20
|
const { isFunction } = utils;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
|
|
24
|
+
* This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} str The string to encode
|
|
27
|
+
*
|
|
28
|
+
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
29
|
+
*/
|
|
30
|
+
const encodeUTF8 = (str) =>
|
|
31
|
+
encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
|
|
32
|
+
String.fromCharCode(parseInt(hex, 16))
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Node's WHATWG URL parser returns `username` and `password` percent-encoded.
|
|
36
|
+
// Decode before composing the `auth` option so credentials such as
|
|
37
|
+
// `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
|
|
38
|
+
// original value for malformed input so a bad encoding never throws.
|
|
39
|
+
const decodeURIComponentSafe = (value) => {
|
|
40
|
+
if (!utils.isString(value)) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
return decodeURIComponent(value);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
22
51
|
const test = (fn, ...args) => {
|
|
23
52
|
try {
|
|
24
53
|
return !!fn(...args);
|
|
@@ -27,6 +56,15 @@ const test = (fn, ...args) => {
|
|
|
27
56
|
}
|
|
28
57
|
};
|
|
29
58
|
|
|
59
|
+
const maybeWithAuthCredentials = (url) => {
|
|
60
|
+
const protocolIndex = url.indexOf('://');
|
|
61
|
+
let urlToCheck = url;
|
|
62
|
+
if (protocolIndex !== -1) {
|
|
63
|
+
urlToCheck = urlToCheck.slice(protocolIndex + 3);
|
|
64
|
+
}
|
|
65
|
+
return urlToCheck.includes('@') || urlToCheck.includes(':');
|
|
66
|
+
};
|
|
67
|
+
|
|
30
68
|
const factory = (env) => {
|
|
31
69
|
const globalObject =
|
|
32
70
|
utils.global !== undefined && utils.global !== null
|
|
@@ -174,6 +212,7 @@ const factory = (env) => {
|
|
|
174
212
|
|
|
175
213
|
const hasMaxContentLength = utils.isNumber(maxContentLength) && maxContentLength > -1;
|
|
176
214
|
const hasMaxBodyLength = utils.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
215
|
+
const own = (key) => (utils.hasOwnProp(config, key) ? config[key] : undefined);
|
|
177
216
|
|
|
178
217
|
let _fetch = envFetch || fetch;
|
|
179
218
|
|
|
@@ -196,6 +235,46 @@ const factory = (env) => {
|
|
|
196
235
|
let requestContentLength;
|
|
197
236
|
|
|
198
237
|
try {
|
|
238
|
+
// HTTP basic authentication
|
|
239
|
+
let auth = undefined;
|
|
240
|
+
const configAuth = own('auth');
|
|
241
|
+
|
|
242
|
+
if (configAuth) {
|
|
243
|
+
const username = configAuth.username || '';
|
|
244
|
+
const password = configAuth.password || '';
|
|
245
|
+
auth = {
|
|
246
|
+
username,
|
|
247
|
+
password
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (maybeWithAuthCredentials(url)) {
|
|
252
|
+
const parsedURL = new URL(url, platform.origin);
|
|
253
|
+
|
|
254
|
+
if (!auth && (parsedURL.username || parsedURL.password)) {
|
|
255
|
+
const urlUsername = decodeURIComponentSafe(parsedURL.username);
|
|
256
|
+
const urlPassword = decodeURIComponentSafe(parsedURL.password);
|
|
257
|
+
auth = {
|
|
258
|
+
username: urlUsername,
|
|
259
|
+
password: urlPassword
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (parsedURL.username || parsedURL.password) {
|
|
264
|
+
parsedURL.username = '';
|
|
265
|
+
parsedURL.password = '';
|
|
266
|
+
url = parsedURL.href;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (auth) {
|
|
271
|
+
headers.delete('authorization');
|
|
272
|
+
headers.set(
|
|
273
|
+
'Authorization',
|
|
274
|
+
'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
199
278
|
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
200
279
|
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
201
280
|
// "if (protocol === 'data:')" branch).
|
|
@@ -24,6 +24,7 @@ import { EventEmitter } from 'events';
|
|
|
24
24
|
import formDataToStream from '../helpers/formDataToStream.js';
|
|
25
25
|
import readBlob from '../helpers/readBlob.js';
|
|
26
26
|
import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
|
|
27
|
+
import Http2Sessions from '../helpers/Http2Sessions.js';
|
|
27
28
|
import callbackify from '../helpers/callbackify.js';
|
|
28
29
|
import shouldBypassProxy from '../helpers/shouldBypassProxy.js';
|
|
29
30
|
import { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';
|
|
@@ -44,7 +45,15 @@ const brotliOptions = {
|
|
|
44
45
|
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH,
|
|
45
46
|
};
|
|
46
47
|
|
|
48
|
+
const zstdOptions = {
|
|
49
|
+
flush: zlib.constants.ZSTD_e_flush,
|
|
50
|
+
finishFlush: zlib.constants.ZSTD_e_flush,
|
|
51
|
+
};
|
|
52
|
+
|
|
47
53
|
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
|
54
|
+
const isZstdSupported = utils.isFunction(zlib.createZstdDecompress);
|
|
55
|
+
const ACCEPT_ENCODING = 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : '');
|
|
56
|
+
const ACCEPT_ENCODING_WITH_ZSTD = ACCEPT_ENCODING + (isZstdSupported ? ', zstd' : '');
|
|
48
57
|
|
|
49
58
|
const { http: httpFollow, https: httpsFollow } = followRedirects;
|
|
50
59
|
|
|
@@ -103,6 +112,14 @@ function getTunnelingAgent(agentOptions, userHttpsAgent) {
|
|
|
103
112
|
? { ...userHttpsAgent.options, ...agentOptions }
|
|
104
113
|
: agentOptions;
|
|
105
114
|
agent = new HttpsProxyAgent(merged);
|
|
115
|
+
if (userHttpsAgent && userHttpsAgent.options) {
|
|
116
|
+
const originTLSOptions = { ...userHttpsAgent.options };
|
|
117
|
+
const callback = agent.callback;
|
|
118
|
+
agent.callback = function axiosTunnelingAgentCallback(req, opts) {
|
|
119
|
+
// HttpsProxyAgent v5 reads callback opts for the post-CONNECT origin TLS upgrade.
|
|
120
|
+
return callback.call(this, req, { ...originTLSOptions, ...opts });
|
|
121
|
+
};
|
|
122
|
+
}
|
|
106
123
|
agent[kAxiosInstalledTunnel] = true;
|
|
107
124
|
cache.set(key, agent);
|
|
108
125
|
return agent;
|
|
@@ -134,114 +151,11 @@ const flushOnFinish = (stream, [throttled, flush]) => {
|
|
|
134
151
|
return throttled;
|
|
135
152
|
};
|
|
136
153
|
|
|
137
|
-
class Http2Sessions {
|
|
138
|
-
constructor() {
|
|
139
|
-
this.sessions = Object.create(null);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
getSession(authority, options) {
|
|
143
|
-
options = Object.assign(
|
|
144
|
-
{
|
|
145
|
-
sessionTimeout: 1000,
|
|
146
|
-
},
|
|
147
|
-
options
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
let authoritySessions = this.sessions[authority];
|
|
151
|
-
|
|
152
|
-
if (authoritySessions) {
|
|
153
|
-
let len = authoritySessions.length;
|
|
154
|
-
|
|
155
|
-
for (let i = 0; i < len; i++) {
|
|
156
|
-
const [sessionHandle, sessionOptions] = authoritySessions[i];
|
|
157
|
-
if (
|
|
158
|
-
!sessionHandle.destroyed &&
|
|
159
|
-
!sessionHandle.closed &&
|
|
160
|
-
util.isDeepStrictEqual(sessionOptions, options)
|
|
161
|
-
) {
|
|
162
|
-
return sessionHandle;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const session = http2.connect(authority, options);
|
|
168
|
-
|
|
169
|
-
let removed;
|
|
170
|
-
|
|
171
|
-
const removeSession = () => {
|
|
172
|
-
if (removed) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
removed = true;
|
|
177
|
-
|
|
178
|
-
let entries = authoritySessions,
|
|
179
|
-
len = entries.length,
|
|
180
|
-
i = len;
|
|
181
|
-
|
|
182
|
-
while (i--) {
|
|
183
|
-
if (entries[i][0] === session) {
|
|
184
|
-
if (len === 1) {
|
|
185
|
-
delete this.sessions[authority];
|
|
186
|
-
} else {
|
|
187
|
-
entries.splice(i, 1);
|
|
188
|
-
}
|
|
189
|
-
if (!session.closed) {
|
|
190
|
-
session.close();
|
|
191
|
-
}
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const originalRequestFn = session.request;
|
|
198
|
-
|
|
199
|
-
const { sessionTimeout } = options;
|
|
200
|
-
|
|
201
|
-
if (sessionTimeout != null) {
|
|
202
|
-
let timer;
|
|
203
|
-
let streamsCount = 0;
|
|
204
|
-
|
|
205
|
-
session.request = function () {
|
|
206
|
-
const stream = originalRequestFn.apply(this, arguments);
|
|
207
|
-
|
|
208
|
-
streamsCount++;
|
|
209
|
-
|
|
210
|
-
if (timer) {
|
|
211
|
-
clearTimeout(timer);
|
|
212
|
-
timer = null;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
stream.once('close', () => {
|
|
216
|
-
if (!--streamsCount) {
|
|
217
|
-
timer = setTimeout(() => {
|
|
218
|
-
timer = null;
|
|
219
|
-
removeSession();
|
|
220
|
-
}, sessionTimeout);
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
return stream;
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
session.once('close', removeSession);
|
|
229
|
-
|
|
230
|
-
let entry = [session, options];
|
|
231
|
-
|
|
232
|
-
authoritySessions
|
|
233
|
-
? authoritySessions.push(entry)
|
|
234
|
-
: (authoritySessions = this.sessions[authority] = [entry]);
|
|
235
|
-
|
|
236
|
-
return session;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
154
|
const http2Sessions = new Http2Sessions();
|
|
241
155
|
|
|
242
156
|
/**
|
|
243
|
-
* If the proxy or config beforeRedirects functions are defined, call them
|
|
244
|
-
* object.
|
|
157
|
+
* If the proxy, auth, or config beforeRedirects functions are defined, call them
|
|
158
|
+
* with the options object.
|
|
245
159
|
*
|
|
246
160
|
* @param {Object<string, any>} options - The options object that was passed to the request.
|
|
247
161
|
*
|
|
@@ -251,6 +165,9 @@ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
|
|
|
251
165
|
if (options.beforeRedirects.proxy) {
|
|
252
166
|
options.beforeRedirects.proxy(options);
|
|
253
167
|
}
|
|
168
|
+
if (options.beforeRedirects.auth) {
|
|
169
|
+
options.beforeRedirects.auth(options);
|
|
170
|
+
}
|
|
254
171
|
if (options.beforeRedirects.config) {
|
|
255
172
|
options.beforeRedirects.config(options, responseDetails, requestDetails);
|
|
256
173
|
}
|
|
@@ -518,6 +435,7 @@ export default isHttpAdapterSupported &&
|
|
|
518
435
|
function httpAdapter(config) {
|
|
519
436
|
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
|
520
437
|
const own = (key) => (utils.hasOwnProp(config, key) ? config[key] : undefined);
|
|
438
|
+
const transitional = own('transitional') || transitionalDefaults;
|
|
521
439
|
let data = own('data');
|
|
522
440
|
let lookup = own('lookup');
|
|
523
441
|
let family = own('family');
|
|
@@ -571,7 +489,7 @@ export default isHttpAdapterSupported &&
|
|
|
571
489
|
!reason || reason.type ? new CanceledError(null, config, req) : reason
|
|
572
490
|
);
|
|
573
491
|
} catch (err) {
|
|
574
|
-
|
|
492
|
+
// ignore emit errors
|
|
575
493
|
}
|
|
576
494
|
}
|
|
577
495
|
|
|
@@ -586,7 +504,6 @@ export default isHttpAdapterSupported &&
|
|
|
586
504
|
let timeoutErrorMessage = config.timeout
|
|
587
505
|
? 'timeout of ' + config.timeout + 'ms exceeded'
|
|
588
506
|
: 'timeout exceeded';
|
|
589
|
-
const transitional = config.transitional || transitionalDefaults;
|
|
590
507
|
if (config.timeoutErrorMessage) {
|
|
591
508
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
592
509
|
}
|
|
@@ -835,7 +752,7 @@ export default isHttpAdapterSupported &&
|
|
|
835
752
|
auth = username + ':' + password;
|
|
836
753
|
}
|
|
837
754
|
|
|
838
|
-
if (!auth && parsed.username) {
|
|
755
|
+
if (!auth && (parsed.username || parsed.password)) {
|
|
839
756
|
const urlUsername = decodeURIComponentSafe(parsed.username);
|
|
840
757
|
const urlPassword = decodeURIComponentSafe(parsed.password);
|
|
841
758
|
auth = urlUsername + ':' + urlPassword;
|
|
@@ -861,7 +778,8 @@ export default isHttpAdapterSupported &&
|
|
|
861
778
|
|
|
862
779
|
headers.set(
|
|
863
780
|
'Accept-Encoding',
|
|
864
|
-
|
|
781
|
+
utils.hasOwnProp(transitional, 'advertiseZstdAcceptEncoding') &&
|
|
782
|
+
transitional.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING,
|
|
865
783
|
false
|
|
866
784
|
);
|
|
867
785
|
|
|
@@ -883,19 +801,21 @@ export default isHttpAdapterSupported &&
|
|
|
883
801
|
// cacheable-lookup integration hotfix
|
|
884
802
|
!utils.isUndefined(lookup) && (options.lookup = lookup);
|
|
885
803
|
|
|
886
|
-
|
|
887
|
-
|
|
804
|
+
const socketPath = own('socketPath');
|
|
805
|
+
if (socketPath) {
|
|
806
|
+
if (typeof socketPath !== 'string') {
|
|
888
807
|
return reject(
|
|
889
808
|
new AxiosError('socketPath must be a string', AxiosError.ERR_BAD_OPTION_VALUE, config)
|
|
890
809
|
);
|
|
891
810
|
}
|
|
892
811
|
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
812
|
+
const allowedSocketPaths = own('allowedSocketPaths');
|
|
813
|
+
if (allowedSocketPaths != null) {
|
|
814
|
+
const allowed = Array.isArray(allowedSocketPaths)
|
|
815
|
+
? allowedSocketPaths
|
|
816
|
+
: [allowedSocketPaths];
|
|
897
817
|
|
|
898
|
-
const resolvedSocket = resolvePath(
|
|
818
|
+
const resolvedSocket = resolvePath(socketPath);
|
|
899
819
|
const isAllowed = allowed.some(
|
|
900
820
|
(entry) => typeof entry === 'string' && resolvePath(entry) === resolvedSocket
|
|
901
821
|
);
|
|
@@ -903,7 +823,7 @@ export default isHttpAdapterSupported &&
|
|
|
903
823
|
if (!isAllowed) {
|
|
904
824
|
return reject(
|
|
905
825
|
new AxiosError(
|
|
906
|
-
`socketPath "${
|
|
826
|
+
`socketPath "${socketPath}" is not permitted by allowedSocketPaths`,
|
|
907
827
|
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
908
828
|
config
|
|
909
829
|
)
|
|
@@ -911,7 +831,7 @@ export default isHttpAdapterSupported &&
|
|
|
911
831
|
}
|
|
912
832
|
}
|
|
913
833
|
|
|
914
|
-
options.socketPath =
|
|
834
|
+
options.socketPath = socketPath;
|
|
915
835
|
} else {
|
|
916
836
|
options.hostname = parsed.hostname.startsWith('[')
|
|
917
837
|
? parsed.hostname.slice(1, -1)
|
|
@@ -951,6 +871,23 @@ export default isHttpAdapterSupported &&
|
|
|
951
871
|
if (configBeforeRedirect) {
|
|
952
872
|
options.beforeRedirects.config = configBeforeRedirect;
|
|
953
873
|
}
|
|
874
|
+
if (auth) {
|
|
875
|
+
// Restore HTTP Basic credentials on same-origin redirects only.
|
|
876
|
+
// follow-redirects >= 1.15.8 strips Authorization on every redirect (see #6929);
|
|
877
|
+
// cross-origin stripping is the documented mitigation for T-R2 in THREATMODEL.md
|
|
878
|
+
// and is preserved by deliberately not restoring on origin change.
|
|
879
|
+
const requestOrigin = parsed.origin;
|
|
880
|
+
const authToRestore = auth;
|
|
881
|
+
options.beforeRedirects.auth = function beforeRedirectAuth(redirectOptions) {
|
|
882
|
+
try {
|
|
883
|
+
if (new URL(redirectOptions.href).origin === requestOrigin) {
|
|
884
|
+
redirectOptions.auth = authToRestore;
|
|
885
|
+
}
|
|
886
|
+
} catch (e) {
|
|
887
|
+
// ignore malformed URL: leaving auth stripped is fail-safe
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
}
|
|
954
891
|
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
955
892
|
}
|
|
956
893
|
}
|
|
@@ -1037,6 +974,13 @@ export default isHttpAdapterSupported &&
|
|
|
1037
974
|
streams.push(zlib.createBrotliDecompress(brotliOptions));
|
|
1038
975
|
delete res.headers['content-encoding'];
|
|
1039
976
|
}
|
|
977
|
+
break;
|
|
978
|
+
case 'zstd':
|
|
979
|
+
if (isZstdSupported) {
|
|
980
|
+
streams.push(zlib.createZstdDecompress(zstdOptions));
|
|
981
|
+
delete res.headers['content-encoding'];
|
|
982
|
+
}
|
|
983
|
+
break;
|
|
1040
984
|
}
|
|
1041
985
|
}
|
|
1042
986
|
|
|
@@ -101,6 +101,7 @@ class Axios {
|
|
|
101
101
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
102
102
|
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
103
103
|
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
104
|
+
advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
|
|
104
105
|
},
|
|
105
106
|
false
|
|
106
107
|
);
|
|
@@ -89,7 +89,7 @@ class AxiosHeaders {
|
|
|
89
89
|
const lHeader = normalizeHeader(_header);
|
|
90
90
|
|
|
91
91
|
if (!lHeader) {
|
|
92
|
-
|
|
92
|
+
return;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
const key = utils.findKey(self, lHeader);
|
|
@@ -117,7 +117,7 @@ class AxiosHeaders {
|
|
|
117
117
|
key;
|
|
118
118
|
for (const entry of header) {
|
|
119
119
|
if (!utils.isArray(entry)) {
|
|
120
|
-
throw TypeError('Object iterator must return a key-value pair');
|
|
120
|
+
throw new TypeError('Object iterator must return a key-value pair');
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
obj[(key = entry[0])] = (dest = obj[key])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.17.0";
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Node-only: relies on the built-in `http2` module. Browser/react-native
|
|
4
|
+
// builds replace `lib/adapters/http.js` (the sole importer) with `lib/helpers/null.js`
|
|
5
|
+
// via the `browser` package.json field, so this module is never reached in
|
|
6
|
+
// those environments. Do not import it from any browser-reachable code path.
|
|
7
|
+
|
|
8
|
+
import http2 from 'http2';
|
|
9
|
+
import util from 'util';
|
|
10
|
+
|
|
11
|
+
class Http2Sessions {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.sessions = Object.create(null);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getSession(authority, options) {
|
|
17
|
+
options = Object.assign(
|
|
18
|
+
{
|
|
19
|
+
sessionTimeout: 1000,
|
|
20
|
+
},
|
|
21
|
+
options
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
let authoritySessions = this.sessions[authority];
|
|
25
|
+
|
|
26
|
+
if (authoritySessions) {
|
|
27
|
+
let len = authoritySessions.length;
|
|
28
|
+
|
|
29
|
+
for (let i = 0; i < len; i++) {
|
|
30
|
+
const [sessionHandle, sessionOptions] = authoritySessions[i];
|
|
31
|
+
if (
|
|
32
|
+
!sessionHandle.destroyed &&
|
|
33
|
+
!sessionHandle.closed &&
|
|
34
|
+
util.isDeepStrictEqual(sessionOptions, options)
|
|
35
|
+
) {
|
|
36
|
+
return sessionHandle;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const session = http2.connect(authority, options);
|
|
42
|
+
|
|
43
|
+
let removed;
|
|
44
|
+
let timer;
|
|
45
|
+
|
|
46
|
+
const removeSession = () => {
|
|
47
|
+
if (removed) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
removed = true;
|
|
52
|
+
|
|
53
|
+
if (timer) {
|
|
54
|
+
clearTimeout(timer);
|
|
55
|
+
timer = null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let entries = authoritySessions,
|
|
59
|
+
len = entries.length,
|
|
60
|
+
i = len;
|
|
61
|
+
|
|
62
|
+
while (i--) {
|
|
63
|
+
if (entries[i][0] === session) {
|
|
64
|
+
if (len === 1) {
|
|
65
|
+
delete this.sessions[authority];
|
|
66
|
+
} else {
|
|
67
|
+
entries.splice(i, 1);
|
|
68
|
+
}
|
|
69
|
+
if (!session.closed) {
|
|
70
|
+
session.close();
|
|
71
|
+
}
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const originalRequestFn = session.request;
|
|
78
|
+
|
|
79
|
+
const { sessionTimeout } = options;
|
|
80
|
+
|
|
81
|
+
if (sessionTimeout != null) {
|
|
82
|
+
let streamsCount = 0;
|
|
83
|
+
|
|
84
|
+
session.request = function () {
|
|
85
|
+
const stream = originalRequestFn.apply(this, arguments);
|
|
86
|
+
|
|
87
|
+
streamsCount++;
|
|
88
|
+
|
|
89
|
+
if (timer) {
|
|
90
|
+
clearTimeout(timer);
|
|
91
|
+
timer = null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
stream.once('close', () => {
|
|
95
|
+
if (!--streamsCount) {
|
|
96
|
+
timer = setTimeout(() => {
|
|
97
|
+
timer = null;
|
|
98
|
+
removeSession();
|
|
99
|
+
}, sessionTimeout);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return stream;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
session.once('close', removeSession);
|
|
108
|
+
|
|
109
|
+
let entry = [session, options];
|
|
110
|
+
|
|
111
|
+
authoritySessions
|
|
112
|
+
? authoritySessions.push(entry)
|
|
113
|
+
: (authoritySessions = this.sessions[authority] = [entry]);
|
|
114
|
+
|
|
115
|
+
return session;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default Http2Sessions;
|
|
@@ -73,11 +73,11 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
|
73
73
|
} = options || {};
|
|
74
74
|
|
|
75
75
|
if (!utils.isFormData(form)) {
|
|
76
|
-
throw TypeError('FormData instance required');
|
|
76
|
+
throw new TypeError('FormData instance required');
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
if (boundary.length < 1 || boundary.length > 70) {
|
|
80
|
-
throw Error('boundary must be 1-70 characters long');
|
|
80
|
+
throw new Error('boundary must be 1-70 characters long');
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
|
|
@@ -35,7 +35,7 @@ const encodeUTF8 = (str) =>
|
|
|
35
35
|
String.fromCharCode(parseInt(hex, 16))
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
function resolveConfig(config) {
|
|
39
39
|
const newConfig = mergeConfig({}, config);
|
|
40
40
|
|
|
41
41
|
// Read only own properties to prevent prototype pollution gadgets
|
|
@@ -56,8 +56,8 @@ export default (config) => {
|
|
|
56
56
|
|
|
57
57
|
newConfig.url = buildURL(
|
|
58
58
|
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
own('params'),
|
|
60
|
+
own('paramsSerializer')
|
|
61
61
|
);
|
|
62
62
|
|
|
63
63
|
// HTTP basic authentication
|
|
@@ -70,8 +70,12 @@ export default (config) => {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
if (utils.isFormData(data)) {
|
|
73
|
-
if (
|
|
74
|
-
|
|
73
|
+
if (
|
|
74
|
+
platform.hasStandardBrowserEnv ||
|
|
75
|
+
platform.hasStandardBrowserWebWorkerEnv ||
|
|
76
|
+
utils.isReactNative(data)
|
|
77
|
+
) {
|
|
78
|
+
headers.setContentType(undefined); // browser/web worker/RN handles it
|
|
75
79
|
} else if (utils.isFunction(data.getHeaders)) {
|
|
76
80
|
// Node.js FormData (like form-data package)
|
|
77
81
|
setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
|
|
@@ -103,4 +107,6 @@ export default (config) => {
|
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
return newConfig;
|
|
106
|
-
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default resolveConfig;
|
|
@@ -219,7 +219,7 @@ function toFormData(obj, formData, options) {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
if (stack.indexOf(value) !== -1) {
|
|
222
|
-
throw Error('Circular reference detected in ' + path.join('.'));
|
|
222
|
+
throw new Error('Circular reference detected in ' + path.join('.'));
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
stack.push(value);
|
|
@@ -412,7 +412,9 @@ function merge(...objs) {
|
|
|
412
412
|
return;
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
|
|
415
|
+
// findKey lowercases the key, so caseless lookup only applies to strings —
|
|
416
|
+
// symbol keys are identity-matched.
|
|
417
|
+
const targetKey = (caseless && typeof key === 'string' && findKey(result, key)) || key;
|
|
416
418
|
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
417
419
|
// chain, so a polluted Object.prototype value could surface here and get
|
|
418
420
|
// copied into the merged result.
|
|
@@ -429,7 +431,24 @@ function merge(...objs) {
|
|
|
429
431
|
};
|
|
430
432
|
|
|
431
433
|
for (let i = 0, l = objs.length; i < l; i++) {
|
|
432
|
-
|
|
434
|
+
const source = objs[i];
|
|
435
|
+
if (!source || isBuffer(source)) {
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
forEach(source, assignValue);
|
|
440
|
+
|
|
441
|
+
if (typeof source !== 'object' || isArray(source)) {
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const symbols = Object.getOwnPropertySymbols(source);
|
|
446
|
+
for (let j = 0; j < symbols.length; j++) {
|
|
447
|
+
const symbol = symbols[j];
|
|
448
|
+
if (propertyIsEnumerable.call(source, symbol)) {
|
|
449
|
+
assignValue(source[symbol], symbol);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
433
452
|
}
|
|
434
453
|
return result;
|
|
435
454
|
}
|
|
@@ -658,6 +677,8 @@ const hasOwnProperty = (
|
|
|
658
677
|
hasOwnProperty.call(obj, prop)
|
|
659
678
|
)(Object.prototype);
|
|
660
679
|
|
|
680
|
+
const { propertyIsEnumerable } = Object.prototype;
|
|
681
|
+
|
|
661
682
|
/**
|
|
662
683
|
* Determine if a value is a RegExp object
|
|
663
684
|
*
|