@jjrawlins/cdk-iam-policy-builder-helper 0.0.66 → 0.0.68
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/.jsii +3 -3
- package/cdk-iam-policy-builder-helper/jsii/jsii.go +2 -2
- package/cdk-iam-policy-builder-helper/version +1 -1
- package/lib/constructs/Actions.d.ts +1 -0
- package/lib/constructs/Actions.js +2 -1
- package/methods_list.txt +1 -0
- package/node_modules/@aws-sdk/client-iam/dist-cjs/index.js +7 -0
- package/node_modules/@aws-sdk/client-iam/dist-es/models/models_0.js +7 -0
- package/node_modules/@aws-sdk/client-iam/dist-types/models/models_0.d.ts +7 -0
- package/node_modules/@aws-sdk/client-iam/dist-types/ts3.4/models/models_0.d.ts +7 -0
- package/node_modules/@aws-sdk/client-iam/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +2 -2
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js +2 -2
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromTokenFile.d.ts +2 -3
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-types/ts3.4/fromTokenFile.d.ts +5 -3
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +1 -1
- package/node_modules/axios/CHANGELOG.md +402 -368
- package/node_modules/axios/README.md +80 -49
- package/node_modules/axios/dist/axios.js +121 -46
- package/node_modules/axios/dist/axios.js.map +1 -1
- 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 +126 -57
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +126 -57
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- 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 +347 -98
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +4 -0
- package/node_modules/axios/index.d.ts +4 -0
- package/node_modules/axios/lib/adapters/adapters.js +85 -40
- package/node_modules/axios/lib/adapters/fetch.js +1 -1
- package/node_modules/axios/lib/adapters/http.js +221 -43
- package/node_modules/axios/lib/core/InterceptorManager.js +1 -1
- package/node_modules/axios/lib/core/mergeConfig.js +4 -4
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +6 -0
- package/node_modules/axios/lib/helpers/bind.js +7 -0
- package/node_modules/axios/lib/helpers/cookies.js +24 -13
- package/node_modules/axios/package.json +9 -4
- package/package.json +2 -2
|
@@ -436,6 +436,10 @@ declare namespace axios {
|
|
|
436
436
|
((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);
|
|
437
437
|
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
|
438
438
|
fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
|
|
439
|
+
httpVersion?: 1 | 2;
|
|
440
|
+
http2Options?: Record<string, any> & {
|
|
441
|
+
sessionTimeout?: number;
|
|
442
|
+
};
|
|
439
443
|
}
|
|
440
444
|
|
|
441
445
|
// Alias
|
|
@@ -369,6 +369,10 @@ export interface AxiosRequestConfig<D = any> {
|
|
|
369
369
|
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
|
370
370
|
parseReviver?: (this: any, key: string, value: any) => any;
|
|
371
371
|
fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
|
|
372
|
+
httpVersion?: 1 | 2;
|
|
373
|
+
http2Options?: Record<string, any> & {
|
|
374
|
+
sessionTimeout?: number;
|
|
375
|
+
};
|
|
372
376
|
}
|
|
373
377
|
|
|
374
378
|
// Alias
|
|
@@ -4,78 +4,123 @@ import xhrAdapter from './xhr.js';
|
|
|
4
4
|
import * as fetchAdapter from './fetch.js';
|
|
5
5
|
import AxiosError from "../core/AxiosError.js";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Known adapters mapping.
|
|
9
|
+
* Provides environment-specific adapters for Axios:
|
|
10
|
+
* - `http` for Node.js
|
|
11
|
+
* - `xhr` for browsers
|
|
12
|
+
* - `fetch` for fetch API-based requests
|
|
13
|
+
*
|
|
14
|
+
* @type {Object<string, Function|Object>}
|
|
15
|
+
*/
|
|
7
16
|
const knownAdapters = {
|
|
8
17
|
http: httpAdapter,
|
|
9
18
|
xhr: xhrAdapter,
|
|
10
19
|
fetch: {
|
|
11
20
|
get: fetchAdapter.getFetch,
|
|
12
21
|
}
|
|
13
|
-
}
|
|
22
|
+
};
|
|
14
23
|
|
|
24
|
+
// Assign adapter names for easier debugging and identification
|
|
15
25
|
utils.forEach(knownAdapters, (fn, value) => {
|
|
16
26
|
if (fn) {
|
|
17
27
|
try {
|
|
18
|
-
Object.defineProperty(fn, 'name', {value});
|
|
28
|
+
Object.defineProperty(fn, 'name', { value });
|
|
19
29
|
} catch (e) {
|
|
20
30
|
// eslint-disable-next-line no-empty
|
|
21
31
|
}
|
|
22
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
32
|
+
Object.defineProperty(fn, 'adapterName', { value });
|
|
23
33
|
}
|
|
24
34
|
});
|
|
25
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Render a rejection reason string for unknown or unsupported adapters
|
|
38
|
+
*
|
|
39
|
+
* @param {string} reason
|
|
40
|
+
* @returns {string}
|
|
41
|
+
*/
|
|
26
42
|
const renderReason = (reason) => `- ${reason}`;
|
|
27
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Check if the adapter is resolved (function, null, or false)
|
|
46
|
+
*
|
|
47
|
+
* @param {Function|null|false} adapter
|
|
48
|
+
* @returns {boolean}
|
|
49
|
+
*/
|
|
28
50
|
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
|
29
51
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Get the first suitable adapter from the provided list.
|
|
54
|
+
* Tries each adapter in order until a supported one is found.
|
|
55
|
+
* Throws an AxiosError if no adapter is suitable.
|
|
56
|
+
*
|
|
57
|
+
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
58
|
+
* @param {Object} config - Axios request configuration
|
|
59
|
+
* @throws {AxiosError} If no suitable adapter is available
|
|
60
|
+
* @returns {Function} The resolved adapter function
|
|
61
|
+
*/
|
|
62
|
+
function getAdapter(adapters, config) {
|
|
63
|
+
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
37
64
|
|
|
38
|
-
|
|
65
|
+
const { length } = adapters;
|
|
66
|
+
let nameOrAdapter;
|
|
67
|
+
let adapter;
|
|
39
68
|
|
|
40
|
-
|
|
41
|
-
nameOrAdapter = adapters[i];
|
|
42
|
-
let id;
|
|
69
|
+
const rejectedReasons = {};
|
|
43
70
|
|
|
44
|
-
|
|
71
|
+
for (let i = 0; i < length; i++) {
|
|
72
|
+
nameOrAdapter = adapters[i];
|
|
73
|
+
let id;
|
|
45
74
|
|
|
46
|
-
|
|
47
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
75
|
+
adapter = nameOrAdapter;
|
|
48
76
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}
|
|
77
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
78
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
53
79
|
|
|
54
|
-
if (adapter
|
|
55
|
-
|
|
80
|
+
if (adapter === undefined) {
|
|
81
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
56
82
|
}
|
|
83
|
+
}
|
|
57
84
|
|
|
58
|
-
|
|
85
|
+
if (adapter && (utils.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
86
|
+
break;
|
|
59
87
|
}
|
|
60
88
|
|
|
61
|
-
|
|
89
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!adapter) {
|
|
93
|
+
const reasons = Object.entries(rejectedReasons)
|
|
94
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
95
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
96
|
+
);
|
|
62
97
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
);
|
|
98
|
+
let s = length ?
|
|
99
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
100
|
+
'as no adapter specified';
|
|
67
101
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
102
|
+
throw new AxiosError(
|
|
103
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
104
|
+
'ERR_NOT_SUPPORT'
|
|
105
|
+
);
|
|
106
|
+
}
|
|
71
107
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
'ERR_NOT_SUPPORT'
|
|
75
|
-
);
|
|
76
|
-
}
|
|
108
|
+
return adapter;
|
|
109
|
+
}
|
|
77
110
|
|
|
78
|
-
|
|
79
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Exports Axios adapters and utility to resolve an adapter
|
|
113
|
+
*/
|
|
114
|
+
export default {
|
|
115
|
+
/**
|
|
116
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
117
|
+
* @type {Function}
|
|
118
|
+
*/
|
|
119
|
+
getAdapter,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Exposes all known adapters
|
|
123
|
+
* @type {Object<string, Function|Object>}
|
|
124
|
+
*/
|
|
80
125
|
adapters: knownAdapters
|
|
81
|
-
}
|
|
126
|
+
};
|
|
@@ -262,7 +262,7 @@ const factory = (env) => {
|
|
|
262
262
|
const seedCache = new Map();
|
|
263
263
|
|
|
264
264
|
export const getFetch = (config) => {
|
|
265
|
-
let env = config
|
|
265
|
+
let env = (config && config.env) || {};
|
|
266
266
|
const {fetch, Request, Response} = env;
|
|
267
267
|
const seeds = [
|
|
268
268
|
Request, Response, fetch
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { connect, constants } from 'http2';
|
|
3
2
|
import utils from './../utils.js';
|
|
4
3
|
import settle from './../core/settle.js';
|
|
5
4
|
import buildFullPath from '../core/buildFullPath.js';
|
|
@@ -37,6 +36,13 @@ const brotliOptions = {
|
|
|
37
36
|
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
|
38
37
|
}
|
|
39
38
|
|
|
39
|
+
const {
|
|
40
|
+
HTTP2_HEADER_SCHEME,
|
|
41
|
+
HTTP2_HEADER_METHOD,
|
|
42
|
+
HTTP2_HEADER_PATH,
|
|
43
|
+
HTTP2_HEADER_STATUS
|
|
44
|
+
} = constants;
|
|
45
|
+
|
|
40
46
|
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
|
41
47
|
|
|
42
48
|
const {http: httpFollow, https: httpsFollow} = followRedirects;
|
|
@@ -56,6 +62,100 @@ const flushOnFinish = (stream, [throttled, flush]) => {
|
|
|
56
62
|
return throttled;
|
|
57
63
|
}
|
|
58
64
|
|
|
65
|
+
class Http2Sessions {
|
|
66
|
+
constructor() {
|
|
67
|
+
this.sessions = Object.create(null);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
getSession(authority, options) {
|
|
71
|
+
options = Object.assign({
|
|
72
|
+
sessionTimeout: 1000
|
|
73
|
+
}, options);
|
|
74
|
+
|
|
75
|
+
let authoritySessions;
|
|
76
|
+
|
|
77
|
+
if ((authoritySessions = this.sessions[authority])) {
|
|
78
|
+
let len = authoritySessions.length;
|
|
79
|
+
|
|
80
|
+
for (let i = 0; i < len; i++) {
|
|
81
|
+
const [sessionHandle, sessionOptions] = authoritySessions[i];
|
|
82
|
+
if (!sessionHandle.destroyed && !sessionHandle.closed && util.isDeepStrictEqual(sessionOptions, options)) {
|
|
83
|
+
return sessionHandle;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const session = connect(authority, options);
|
|
89
|
+
|
|
90
|
+
let removed;
|
|
91
|
+
|
|
92
|
+
const removeSession = () => {
|
|
93
|
+
if (removed) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
removed = true;
|
|
98
|
+
|
|
99
|
+
let entries = authoritySessions, len = entries.length, i = len;
|
|
100
|
+
|
|
101
|
+
while (i--) {
|
|
102
|
+
if (entries[i][0] === session) {
|
|
103
|
+
entries.splice(i, 1);
|
|
104
|
+
if (len === 1) {
|
|
105
|
+
delete this.sessions[authority];
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const originalRequestFn = session.request;
|
|
113
|
+
|
|
114
|
+
const {sessionTimeout} = options;
|
|
115
|
+
|
|
116
|
+
if(sessionTimeout != null) {
|
|
117
|
+
|
|
118
|
+
let timer;
|
|
119
|
+
let streamsCount = 0;
|
|
120
|
+
|
|
121
|
+
session.request = function () {
|
|
122
|
+
const stream = originalRequestFn.apply(this, arguments);
|
|
123
|
+
|
|
124
|
+
streamsCount++;
|
|
125
|
+
|
|
126
|
+
if (timer) {
|
|
127
|
+
clearTimeout(timer);
|
|
128
|
+
timer = null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
stream.once('close', () => {
|
|
132
|
+
if (!--streamsCount) {
|
|
133
|
+
timer = setTimeout(() => {
|
|
134
|
+
timer = null;
|
|
135
|
+
removeSession();
|
|
136
|
+
}, sessionTimeout);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return stream;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
session.once('close', removeSession);
|
|
145
|
+
|
|
146
|
+
let entries = this.sessions[authority], entry = [
|
|
147
|
+
session,
|
|
148
|
+
options
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
entries ? this.sessions[authority].push(entry) : authoritySessions = this.sessions[authority] = [entry];
|
|
152
|
+
|
|
153
|
+
return session;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const http2Sessions = new Http2Sessions();
|
|
158
|
+
|
|
59
159
|
|
|
60
160
|
/**
|
|
61
161
|
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
|
@@ -168,16 +268,68 @@ const resolveFamily = ({address, family}) => {
|
|
|
168
268
|
|
|
169
269
|
const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});
|
|
170
270
|
|
|
271
|
+
const http2Transport = {
|
|
272
|
+
request(options, cb) {
|
|
273
|
+
const authority = options.protocol + '//' + options.hostname + ':' + (options.port || 80);
|
|
274
|
+
|
|
275
|
+
const {http2Options, headers} = options;
|
|
276
|
+
|
|
277
|
+
const session = http2Sessions.getSession(authority, http2Options);
|
|
278
|
+
|
|
279
|
+
const http2Headers = {
|
|
280
|
+
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
|
281
|
+
[HTTP2_HEADER_METHOD]: options.method,
|
|
282
|
+
[HTTP2_HEADER_PATH]: options.path,
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
utils.forEach(headers, (header, name) => {
|
|
286
|
+
name.charAt(0) !== ':' && (http2Headers[name] = header);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
const req = session.request(http2Headers);
|
|
290
|
+
|
|
291
|
+
req.once('response', (responseHeaders) => {
|
|
292
|
+
const response = req; //duplex
|
|
293
|
+
|
|
294
|
+
responseHeaders = Object.assign({}, responseHeaders);
|
|
295
|
+
|
|
296
|
+
const status = responseHeaders[HTTP2_HEADER_STATUS];
|
|
297
|
+
|
|
298
|
+
delete responseHeaders[HTTP2_HEADER_STATUS];
|
|
299
|
+
|
|
300
|
+
response.headers = responseHeaders;
|
|
301
|
+
|
|
302
|
+
response.statusCode = +status;
|
|
303
|
+
|
|
304
|
+
cb(response);
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
return req;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
171
311
|
/*eslint consistent-return:0*/
|
|
172
312
|
export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
173
313
|
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
|
174
|
-
let {data, lookup, family} = config;
|
|
314
|
+
let {data, lookup, family, httpVersion = 1, http2Options} = config;
|
|
175
315
|
const {responseType, responseEncoding} = config;
|
|
176
316
|
const method = config.method.toUpperCase();
|
|
177
317
|
let isDone;
|
|
178
318
|
let rejected = false;
|
|
179
319
|
let req;
|
|
180
320
|
|
|
321
|
+
httpVersion = +httpVersion;
|
|
322
|
+
|
|
323
|
+
if (Number.isNaN(httpVersion)) {
|
|
324
|
+
throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (httpVersion !== 1 && httpVersion !== 2) {
|
|
328
|
+
throw TypeError(`Unsupported protocol version '${httpVersion}'`);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const isHttp2 = httpVersion === 2;
|
|
332
|
+
|
|
181
333
|
if (lookup) {
|
|
182
334
|
const _lookup = callbackify(lookup, (value) => utils.isArray(value) ? value : [value]);
|
|
183
335
|
// hotfix to support opt.all option which is required for node 20.x
|
|
@@ -194,8 +346,17 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
194
346
|
}
|
|
195
347
|
}
|
|
196
348
|
|
|
197
|
-
|
|
198
|
-
|
|
349
|
+
const abortEmitter = new EventEmitter();
|
|
350
|
+
|
|
351
|
+
function abort(reason) {
|
|
352
|
+
try {
|
|
353
|
+
abortEmitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
|
354
|
+
} catch(err) {
|
|
355
|
+
console.warn('emit error', err);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
abortEmitter.once('abort', reject);
|
|
199
360
|
|
|
200
361
|
const onFinished = () => {
|
|
201
362
|
if (config.cancelToken) {
|
|
@@ -206,29 +367,40 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
206
367
|
config.signal.removeEventListener('abort', abort);
|
|
207
368
|
}
|
|
208
369
|
|
|
209
|
-
|
|
370
|
+
abortEmitter.removeAllListeners();
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if (config.cancelToken || config.signal) {
|
|
374
|
+
config.cancelToken && config.cancelToken.subscribe(abort);
|
|
375
|
+
if (config.signal) {
|
|
376
|
+
config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
|
|
377
|
+
}
|
|
210
378
|
}
|
|
211
379
|
|
|
212
|
-
onDone((
|
|
380
|
+
onDone((response, isRejected) => {
|
|
213
381
|
isDone = true;
|
|
382
|
+
|
|
214
383
|
if (isRejected) {
|
|
215
384
|
rejected = true;
|
|
216
385
|
onFinished();
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const {data} = response;
|
|
390
|
+
|
|
391
|
+
if (data instanceof stream.Readable || data instanceof stream.Duplex) {
|
|
392
|
+
const offListeners = stream.finished(data, () => {
|
|
393
|
+
offListeners();
|
|
394
|
+
onFinished();
|
|
395
|
+
});
|
|
396
|
+
} else {
|
|
397
|
+
onFinished();
|
|
217
398
|
}
|
|
218
399
|
});
|
|
219
400
|
|
|
220
|
-
function abort(reason) {
|
|
221
|
-
emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
|
222
|
-
}
|
|
223
401
|
|
|
224
|
-
emitter.once('abort', reject);
|
|
225
402
|
|
|
226
|
-
|
|
227
|
-
config.cancelToken && config.cancelToken.subscribe(abort);
|
|
228
|
-
if (config.signal) {
|
|
229
|
-
config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
403
|
+
|
|
232
404
|
|
|
233
405
|
// Parse url
|
|
234
406
|
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
@@ -436,7 +608,8 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
436
608
|
protocol,
|
|
437
609
|
family,
|
|
438
610
|
beforeRedirect: dispatchBeforeRedirect,
|
|
439
|
-
beforeRedirects: {}
|
|
611
|
+
beforeRedirects: {},
|
|
612
|
+
http2Options
|
|
440
613
|
};
|
|
441
614
|
|
|
442
615
|
// cacheable-lookup integration hotfix
|
|
@@ -453,18 +626,23 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
453
626
|
let transport;
|
|
454
627
|
const isHttpsRequest = isHttps.test(options.protocol);
|
|
455
628
|
options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
transport = isHttpsRequest ? https : http;
|
|
629
|
+
|
|
630
|
+
if (isHttp2) {
|
|
631
|
+
transport = http2Transport;
|
|
460
632
|
} else {
|
|
461
|
-
if (config.
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
633
|
+
if (config.transport) {
|
|
634
|
+
transport = config.transport;
|
|
635
|
+
} else if (config.maxRedirects === 0) {
|
|
636
|
+
transport = isHttpsRequest ? https : http;
|
|
637
|
+
} else {
|
|
638
|
+
if (config.maxRedirects) {
|
|
639
|
+
options.maxRedirects = config.maxRedirects;
|
|
640
|
+
}
|
|
641
|
+
if (config.beforeRedirect) {
|
|
642
|
+
options.beforeRedirects.config = config.beforeRedirect;
|
|
643
|
+
}
|
|
644
|
+
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
466
645
|
}
|
|
467
|
-
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
468
646
|
}
|
|
469
647
|
|
|
470
648
|
if (config.maxBodyLength > -1) {
|
|
@@ -484,7 +662,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
484
662
|
|
|
485
663
|
const streams = [res];
|
|
486
664
|
|
|
487
|
-
const responseLength =
|
|
665
|
+
const responseLength = utils.toFiniteNumber(res.headers['content-length']);
|
|
488
666
|
|
|
489
667
|
if (onDownloadProgress || maxDownloadRate) {
|
|
490
668
|
const transformStream = new AxiosTransformStream({
|
|
@@ -547,10 +725,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
547
725
|
|
|
548
726
|
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
|
549
727
|
|
|
550
|
-
|
|
551
|
-
offListeners();
|
|
552
|
-
onFinished();
|
|
553
|
-
});
|
|
728
|
+
|
|
554
729
|
|
|
555
730
|
const response = {
|
|
556
731
|
status: res.statusCode,
|
|
@@ -562,7 +737,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
562
737
|
|
|
563
738
|
if (responseType === 'stream') {
|
|
564
739
|
response.data = responseStream;
|
|
565
|
-
settle(resolve,
|
|
740
|
+
settle(resolve, abort, response);
|
|
566
741
|
} else {
|
|
567
742
|
const responseBuffer = [];
|
|
568
743
|
let totalResponseBytes = 0;
|
|
@@ -576,7 +751,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
576
751
|
// stream.destroy() emit aborted event before calling reject() on Node.js v16
|
|
577
752
|
rejected = true;
|
|
578
753
|
responseStream.destroy();
|
|
579
|
-
|
|
754
|
+
abort(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
580
755
|
AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
|
|
581
756
|
}
|
|
582
757
|
});
|
|
@@ -618,7 +793,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
618
793
|
});
|
|
619
794
|
}
|
|
620
795
|
|
|
621
|
-
|
|
796
|
+
abortEmitter.once('abort', err => {
|
|
622
797
|
if (!responseStream.destroyed) {
|
|
623
798
|
responseStream.emit('error', err);
|
|
624
799
|
responseStream.destroy();
|
|
@@ -626,9 +801,12 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
626
801
|
});
|
|
627
802
|
});
|
|
628
803
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
804
|
+
abortEmitter.once('abort', err => {
|
|
805
|
+
if (req.close) {
|
|
806
|
+
req.close();
|
|
807
|
+
} else {
|
|
808
|
+
req.destroy(err);
|
|
809
|
+
}
|
|
632
810
|
});
|
|
633
811
|
|
|
634
812
|
// Handle errors
|
|
@@ -650,7 +828,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
650
828
|
const timeout = parseInt(config.timeout, 10);
|
|
651
829
|
|
|
652
830
|
if (Number.isNaN(timeout)) {
|
|
653
|
-
|
|
831
|
+
abort(new AxiosError(
|
|
654
832
|
'error trying to parse `config.timeout` to int',
|
|
655
833
|
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
656
834
|
config,
|
|
@@ -672,13 +850,12 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
672
850
|
if (config.timeoutErrorMessage) {
|
|
673
851
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
674
852
|
}
|
|
675
|
-
|
|
853
|
+
abort(new AxiosError(
|
|
676
854
|
timeoutErrorMessage,
|
|
677
855
|
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
678
856
|
config,
|
|
679
857
|
req
|
|
680
858
|
));
|
|
681
|
-
abort();
|
|
682
859
|
});
|
|
683
860
|
}
|
|
684
861
|
|
|
@@ -705,7 +882,8 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
705
882
|
|
|
706
883
|
data.pipe(req);
|
|
707
884
|
} else {
|
|
708
|
-
req.
|
|
885
|
+
data && req.write(data);
|
|
886
|
+
req.end();
|
|
709
887
|
}
|
|
710
888
|
});
|
|
711
889
|
}
|
|
@@ -31,11 +31,11 @@ export default function mergeConfig(config1, config2) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// eslint-disable-next-line consistent-return
|
|
34
|
-
function mergeDeepProperties(a, b, prop
|
|
34
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
35
35
|
if (!utils.isUndefined(b)) {
|
|
36
|
-
return getMergedValue(a, b, prop
|
|
36
|
+
return getMergedValue(a, b, prop, caseless);
|
|
37
37
|
} else if (!utils.isUndefined(a)) {
|
|
38
|
-
return getMergedValue(undefined, a, prop
|
|
38
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -93,7 +93,7 @@ export default function mergeConfig(config1, config2) {
|
|
|
93
93
|
socketPath: defaultToConfig2,
|
|
94
94
|
responseEncoding: defaultToConfig2,
|
|
95
95
|
validateStatus: mergeDirectKeys,
|
|
96
|
-
headers: (a, b
|
|
96
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
utils.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.13.0";
|
|
@@ -62,6 +62,12 @@ const HttpStatusCode = {
|
|
|
62
62
|
LoopDetected: 508,
|
|
63
63
|
NotExtended: 510,
|
|
64
64
|
NetworkAuthenticationRequired: 511,
|
|
65
|
+
WebServerIsDown: 521,
|
|
66
|
+
ConnectionTimedOut: 522,
|
|
67
|
+
OriginIsUnreachable: 523,
|
|
68
|
+
TimeoutOccurred: 524,
|
|
69
|
+
SslHandshakeFailed: 525,
|
|
70
|
+
InvalidSslCertificate: 526,
|
|
65
71
|
};
|
|
66
72
|
|
|
67
73
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Create a bound version of a function with a specified `this` context
|
|
5
|
+
*
|
|
6
|
+
* @param {Function} fn - The function to bind
|
|
7
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
8
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
9
|
+
*/
|
|
3
10
|
export default function bind(fn, thisArg) {
|
|
4
11
|
return function wrap() {
|
|
5
12
|
return fn.apply(thisArg, arguments);
|