@jjrawlins/cdk-iam-policy-builder-helper 0.0.23 → 0.0.24
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/go.mod +1 -1
- package/cdk-iam-policy-builder-helper/jsii/jsii.go +2 -2
- package/cdk-iam-policy-builder-helper/version +1 -1
- package/methods_list.txt +6 -0
- package/node_modules/@aws-sdk/client-iam/package.json +38 -38
- package/node_modules/@aws-sdk/client-sso/package.json +36 -36
- package/node_modules/@aws-sdk/core/package.json +12 -12
- package/node_modules/@aws-sdk/credential-provider-env/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-http/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +5 -5
- package/node_modules/@aws-sdk/middleware-host-header/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-logger/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +7 -7
- package/node_modules/@aws-sdk/nested-clients/package.json +36 -36
- package/node_modules/@aws-sdk/region-config-resolver/package.json +5 -5
- package/node_modules/@aws-sdk/token-providers/package.json +5 -5
- package/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/util-endpoints/package.json +5 -5
- package/node_modules/@aws-sdk/util-user-agent-browser/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +5 -5
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/axios/CHANGELOG.md +35 -0
- package/node_modules/axios/README.md +13 -10
- package/node_modules/axios/dist/axios.js +358 -289
- 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 +286 -211
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +286 -211
- 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 +377 -211
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +9 -5
- package/node_modules/axios/index.d.ts +10 -4
- package/node_modules/axios/lib/adapters/adapters.js +6 -4
- package/node_modules/axios/lib/adapters/fetch.js +220 -163
- package/node_modules/axios/lib/adapters/http.js +18 -0
- package/node_modules/axios/lib/adapters/xhr.js +11 -8
- package/node_modules/axios/lib/core/AxiosError.js +10 -3
- package/node_modules/axios/lib/core/dispatchRequest.js +1 -1
- package/node_modules/axios/lib/defaults/index.js +1 -1
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/buildURL.js +1 -3
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +73 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +13 -9
- package/node_modules/axios/lib/utils.js +7 -3
- package/node_modules/axios/package.json +12 -9
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.
|
|
1
|
+
/*! Axios v1.12.0 Copyright (c) 2025 Matt Zabriskie and contributors */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
function bind(fn, thisArg) {
|
|
@@ -52,7 +52,7 @@ const isUndefined = typeOfTest('undefined');
|
|
|
52
52
|
*/
|
|
53
53
|
function isBuffer(val) {
|
|
54
54
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
55
|
-
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
55
|
+
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
@@ -97,7 +97,7 @@ const isString = typeOfTest('string');
|
|
|
97
97
|
* @param {*} val The value to test
|
|
98
98
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
99
99
|
*/
|
|
100
|
-
const isFunction = typeOfTest('function');
|
|
100
|
+
const isFunction$1 = typeOfTest('function');
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* Determine if a value is a Number
|
|
@@ -153,7 +153,7 @@ const isEmptyObject = (val) => {
|
|
|
153
153
|
if (!isObject(val) || isBuffer(val)) {
|
|
154
154
|
return false;
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
|
|
157
157
|
try {
|
|
158
158
|
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
159
159
|
} catch (e) {
|
|
@@ -205,7 +205,7 @@ const isFileList = kindOfTest('FileList');
|
|
|
205
205
|
*
|
|
206
206
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
207
207
|
*/
|
|
208
|
-
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
208
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
211
|
* Determine if a value is a FormData
|
|
@@ -218,10 +218,10 @@ const isFormData = (thing) => {
|
|
|
218
218
|
let kind;
|
|
219
219
|
return thing && (
|
|
220
220
|
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
221
|
-
isFunction(thing.append) && (
|
|
221
|
+
isFunction$1(thing.append) && (
|
|
222
222
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
223
223
|
// detect form-data instance
|
|
224
|
-
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
|
224
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
225
225
|
)
|
|
226
226
|
)
|
|
227
227
|
)
|
|
@@ -346,7 +346,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
346
346
|
* @returns {Object} Result of all merge properties
|
|
347
347
|
*/
|
|
348
348
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
349
|
-
const {caseless} = isContextDefined(this) && this || {};
|
|
349
|
+
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
350
350
|
const result = {};
|
|
351
351
|
const assignValue = (val, key) => {
|
|
352
352
|
const targetKey = caseless && findKey(result, key) || key;
|
|
@@ -357,7 +357,9 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
357
357
|
} else if (isArray(val)) {
|
|
358
358
|
result[targetKey] = val.slice();
|
|
359
359
|
} else {
|
|
360
|
-
|
|
360
|
+
if (!skipUndefined || !isUndefined(val)) {
|
|
361
|
+
result[targetKey] = val;
|
|
362
|
+
}
|
|
361
363
|
}
|
|
362
364
|
};
|
|
363
365
|
|
|
@@ -379,7 +381,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
379
381
|
*/
|
|
380
382
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
381
383
|
forEach(b, (val, key) => {
|
|
382
|
-
if (thisArg && isFunction(val)) {
|
|
384
|
+
if (thisArg && isFunction$1(val)) {
|
|
383
385
|
a[key] = bind(val, thisArg);
|
|
384
386
|
} else {
|
|
385
387
|
a[key] = val;
|
|
@@ -595,13 +597,13 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
595
597
|
const freezeMethods = (obj) => {
|
|
596
598
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
597
599
|
// skip restricted props in strict mode
|
|
598
|
-
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
600
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
599
601
|
return false;
|
|
600
602
|
}
|
|
601
603
|
|
|
602
604
|
const value = obj[name];
|
|
603
605
|
|
|
604
|
-
if (!isFunction(value)) return;
|
|
606
|
+
if (!isFunction$1(value)) return;
|
|
605
607
|
|
|
606
608
|
descriptor.enumerable = false;
|
|
607
609
|
|
|
@@ -638,6 +640,8 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
638
640
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
639
641
|
};
|
|
640
642
|
|
|
643
|
+
|
|
644
|
+
|
|
641
645
|
/**
|
|
642
646
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
643
647
|
*
|
|
@@ -646,7 +650,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
646
650
|
* @returns {boolean}
|
|
647
651
|
*/
|
|
648
652
|
function isSpecCompliantForm(thing) {
|
|
649
|
-
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
653
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
650
654
|
}
|
|
651
655
|
|
|
652
656
|
const toJSONObject = (obj) => {
|
|
@@ -688,7 +692,7 @@ const toJSONObject = (obj) => {
|
|
|
688
692
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
689
693
|
|
|
690
694
|
const isThenable = (thing) =>
|
|
691
|
-
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
695
|
+
thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
692
696
|
|
|
693
697
|
// original code
|
|
694
698
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -712,7 +716,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
712
716
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
713
717
|
})(
|
|
714
718
|
typeof setImmediate === 'function',
|
|
715
|
-
isFunction(_global.postMessage)
|
|
719
|
+
isFunction$1(_global.postMessage)
|
|
716
720
|
);
|
|
717
721
|
|
|
718
722
|
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
@@ -721,7 +725,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
721
725
|
// *********************
|
|
722
726
|
|
|
723
727
|
|
|
724
|
-
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
728
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
725
729
|
|
|
726
730
|
|
|
727
731
|
var utils$1 = {
|
|
@@ -745,7 +749,7 @@ var utils$1 = {
|
|
|
745
749
|
isFile,
|
|
746
750
|
isBlob,
|
|
747
751
|
isRegExp,
|
|
748
|
-
isFunction,
|
|
752
|
+
isFunction: isFunction$1,
|
|
749
753
|
isStream,
|
|
750
754
|
isURLSearchParams,
|
|
751
755
|
isTypedArray,
|
|
@@ -871,11 +875,18 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
|
871
875
|
return prop !== 'isAxiosError';
|
|
872
876
|
});
|
|
873
877
|
|
|
874
|
-
|
|
878
|
+
const msg = error && error.message ? error.message : 'Error';
|
|
879
|
+
|
|
880
|
+
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
881
|
+
const errCode = code == null && error ? error.code : code;
|
|
882
|
+
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
875
883
|
|
|
876
|
-
|
|
884
|
+
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
885
|
+
if (error && axiosError.cause == null) {
|
|
886
|
+
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
887
|
+
}
|
|
877
888
|
|
|
878
|
-
axiosError.name = error.name;
|
|
889
|
+
axiosError.name = (error && error.name) || 'Error';
|
|
879
890
|
|
|
880
891
|
customProps && Object.assign(axiosError, customProps);
|
|
881
892
|
|
|
@@ -1166,9 +1177,7 @@ function encode(val) {
|
|
|
1166
1177
|
replace(/%3A/gi, ':').
|
|
1167
1178
|
replace(/%24/g, '$').
|
|
1168
1179
|
replace(/%2C/gi, ',').
|
|
1169
|
-
replace(/%20/g, '+')
|
|
1170
|
-
replace(/%5B/gi, '[').
|
|
1171
|
-
replace(/%5D/gi, ']');
|
|
1180
|
+
replace(/%20/g, '+');
|
|
1172
1181
|
}
|
|
1173
1182
|
|
|
1174
1183
|
/**
|
|
@@ -1573,7 +1582,7 @@ const defaults = {
|
|
|
1573
1582
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1574
1583
|
|
|
1575
1584
|
try {
|
|
1576
|
-
return JSON.parse(data);
|
|
1585
|
+
return JSON.parse(data, this.parseReviver);
|
|
1577
1586
|
} catch (e) {
|
|
1578
1587
|
if (strictJSONParsing) {
|
|
1579
1588
|
if (e.name === 'SyntaxError') {
|
|
@@ -2398,7 +2407,7 @@ function mergeConfig(config1, config2) {
|
|
|
2398
2407
|
var resolveConfig = (config) => {
|
|
2399
2408
|
const newConfig = mergeConfig({}, config);
|
|
2400
2409
|
|
|
2401
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
2410
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
2402
2411
|
|
|
2403
2412
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2404
2413
|
|
|
@@ -2411,17 +2420,21 @@ var resolveConfig = (config) => {
|
|
|
2411
2420
|
);
|
|
2412
2421
|
}
|
|
2413
2422
|
|
|
2414
|
-
let contentType;
|
|
2415
|
-
|
|
2416
2423
|
if (utils$1.isFormData(data)) {
|
|
2417
2424
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2418
|
-
headers.setContentType(undefined); //
|
|
2419
|
-
} else if ((
|
|
2420
|
-
//
|
|
2421
|
-
const
|
|
2422
|
-
headers
|
|
2425
|
+
headers.setContentType(undefined); // browser handles it
|
|
2426
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
2427
|
+
// Node.js FormData (like form-data package)
|
|
2428
|
+
const formHeaders = data.getHeaders();
|
|
2429
|
+
// Only set safe headers to avoid overwriting security headers
|
|
2430
|
+
const allowedHeaders = ['content-type', 'content-length'];
|
|
2431
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
2432
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
2433
|
+
headers.set(key, val);
|
|
2434
|
+
}
|
|
2435
|
+
});
|
|
2423
2436
|
}
|
|
2424
|
-
}
|
|
2437
|
+
}
|
|
2425
2438
|
|
|
2426
2439
|
// Add xsrf header
|
|
2427
2440
|
// This is only done if running in a standard browser environment.
|
|
@@ -2538,15 +2551,18 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
2538
2551
|
};
|
|
2539
2552
|
|
|
2540
2553
|
// Handle low level network errors
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2554
|
+
request.onerror = function handleError(event) {
|
|
2555
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
2556
|
+
// (message may be empty; when present, surface it)
|
|
2557
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
2558
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
2559
|
+
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
2560
|
+
// attach the underlying event for consumers who want details
|
|
2561
|
+
err.event = event || null;
|
|
2562
|
+
reject(err);
|
|
2563
|
+
request = null;
|
|
2548
2564
|
};
|
|
2549
|
-
|
|
2565
|
+
|
|
2550
2566
|
// Handle timeout
|
|
2551
2567
|
request.ontimeout = function handleTimeout() {
|
|
2552
2568
|
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
@@ -2762,14 +2778,18 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
2762
2778
|
})
|
|
2763
2779
|
};
|
|
2764
2780
|
|
|
2765
|
-
const
|
|
2766
|
-
|
|
2781
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
2782
|
+
|
|
2783
|
+
const {isFunction} = utils$1;
|
|
2784
|
+
|
|
2785
|
+
const globalFetchAPI = (({fetch, Request, Response}) => ({
|
|
2786
|
+
fetch, Request, Response
|
|
2787
|
+
}))(utils$1.global);
|
|
2788
|
+
|
|
2789
|
+
const {
|
|
2790
|
+
ReadableStream: ReadableStream$1, TextEncoder
|
|
2791
|
+
} = utils$1.global;
|
|
2767
2792
|
|
|
2768
|
-
// used only inside the fetch adapter
|
|
2769
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
2770
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
2771
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
2772
|
-
);
|
|
2773
2793
|
|
|
2774
2794
|
const test = (fn, ...args) => {
|
|
2775
2795
|
try {
|
|
@@ -2779,211 +2799,266 @@ const test = (fn, ...args) => {
|
|
|
2779
2799
|
}
|
|
2780
2800
|
};
|
|
2781
2801
|
|
|
2782
|
-
const
|
|
2783
|
-
|
|
2802
|
+
const factory = (env) => {
|
|
2803
|
+
const {fetch, Request, Response} = Object.assign({}, globalFetchAPI, env);
|
|
2804
|
+
const isFetchSupported = isFunction(fetch);
|
|
2805
|
+
const isRequestSupported = isFunction(Request);
|
|
2806
|
+
const isResponseSupported = isFunction(Response);
|
|
2784
2807
|
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
get duplex() {
|
|
2789
|
-
duplexAccessed = true;
|
|
2790
|
-
return 'half';
|
|
2791
|
-
},
|
|
2792
|
-
}).headers.has('Content-Type');
|
|
2808
|
+
if (!isFetchSupported) {
|
|
2809
|
+
return false;
|
|
2810
|
+
}
|
|
2793
2811
|
|
|
2794
|
-
|
|
2795
|
-
});
|
|
2812
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
2796
2813
|
|
|
2797
|
-
const
|
|
2814
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
2815
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
2816
|
+
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
|
2817
|
+
);
|
|
2798
2818
|
|
|
2799
|
-
const
|
|
2800
|
-
|
|
2819
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
2820
|
+
let duplexAccessed = false;
|
|
2801
2821
|
|
|
2822
|
+
const hasContentType = new Request(platform.origin, {
|
|
2823
|
+
body: new ReadableStream$1(),
|
|
2824
|
+
method: 'POST',
|
|
2825
|
+
get duplex() {
|
|
2826
|
+
duplexAccessed = true;
|
|
2827
|
+
return 'half';
|
|
2828
|
+
},
|
|
2829
|
+
}).headers.has('Content-Type');
|
|
2802
2830
|
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2831
|
+
return duplexAccessed && !hasContentType;
|
|
2832
|
+
});
|
|
2833
|
+
|
|
2834
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
|
|
2835
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
2836
|
+
|
|
2837
|
+
const resolvers = {
|
|
2838
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
2839
|
+
};
|
|
2840
|
+
|
|
2841
|
+
isFetchSupported && ((() => {
|
|
2842
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
2843
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
2844
|
+
let method = res && res[type];
|
|
2845
|
+
|
|
2846
|
+
if (method) {
|
|
2847
|
+
return method.call(res);
|
|
2848
|
+
}
|
|
2806
2849
|
|
|
2807
|
-
isFetchSupported && (((res) => {
|
|
2808
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
2809
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
2810
|
-
(_, config) => {
|
|
2811
2850
|
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
2812
2851
|
});
|
|
2813
|
-
|
|
2814
|
-
})(
|
|
2852
|
+
});
|
|
2853
|
+
})());
|
|
2815
2854
|
|
|
2816
|
-
const getBodyLength = async (body) => {
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2855
|
+
const getBodyLength = async (body) => {
|
|
2856
|
+
if (body == null) {
|
|
2857
|
+
return 0;
|
|
2858
|
+
}
|
|
2820
2859
|
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2860
|
+
if (utils$1.isBlob(body)) {
|
|
2861
|
+
return body.size;
|
|
2862
|
+
}
|
|
2824
2863
|
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2864
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
2865
|
+
const _request = new Request(platform.origin, {
|
|
2866
|
+
method: 'POST',
|
|
2867
|
+
body,
|
|
2868
|
+
});
|
|
2869
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
2870
|
+
}
|
|
2832
2871
|
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2872
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
2873
|
+
return body.byteLength;
|
|
2874
|
+
}
|
|
2836
2875
|
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2876
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
2877
|
+
body = body + '';
|
|
2878
|
+
}
|
|
2840
2879
|
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
};
|
|
2880
|
+
if (utils$1.isString(body)) {
|
|
2881
|
+
return (await encodeText(body)).byteLength;
|
|
2882
|
+
}
|
|
2883
|
+
};
|
|
2845
2884
|
|
|
2846
|
-
const resolveBodyLength = async (headers, body) => {
|
|
2847
|
-
|
|
2885
|
+
const resolveBodyLength = async (headers, body) => {
|
|
2886
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
2848
2887
|
|
|
2849
|
-
|
|
2850
|
-
};
|
|
2888
|
+
return length == null ? getBodyLength(body) : length;
|
|
2889
|
+
};
|
|
2890
|
+
|
|
2891
|
+
return async (config) => {
|
|
2892
|
+
let {
|
|
2893
|
+
url,
|
|
2894
|
+
method,
|
|
2895
|
+
data,
|
|
2896
|
+
signal,
|
|
2897
|
+
cancelToken,
|
|
2898
|
+
timeout,
|
|
2899
|
+
onDownloadProgress,
|
|
2900
|
+
onUploadProgress,
|
|
2901
|
+
responseType,
|
|
2902
|
+
headers,
|
|
2903
|
+
withCredentials = 'same-origin',
|
|
2904
|
+
fetchOptions
|
|
2905
|
+
} = resolveConfig(config);
|
|
2906
|
+
|
|
2907
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
2908
|
+
|
|
2909
|
+
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
2910
|
+
|
|
2911
|
+
let request = null;
|
|
2851
2912
|
|
|
2852
|
-
|
|
2853
|
-
let {
|
|
2854
|
-
url,
|
|
2855
|
-
method,
|
|
2856
|
-
data,
|
|
2857
|
-
signal,
|
|
2858
|
-
cancelToken,
|
|
2859
|
-
timeout,
|
|
2860
|
-
onDownloadProgress,
|
|
2861
|
-
onUploadProgress,
|
|
2862
|
-
responseType,
|
|
2863
|
-
headers,
|
|
2864
|
-
withCredentials = 'same-origin',
|
|
2865
|
-
fetchOptions
|
|
2866
|
-
} = resolveConfig(config);
|
|
2867
|
-
|
|
2868
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
2869
|
-
|
|
2870
|
-
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
2871
|
-
|
|
2872
|
-
let request;
|
|
2873
|
-
|
|
2874
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2913
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
2875
2914
|
composedSignal.unsubscribe();
|
|
2876
|
-
|
|
2915
|
+
});
|
|
2877
2916
|
|
|
2878
|
-
|
|
2917
|
+
let requestContentLength;
|
|
2879
2918
|
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2919
|
+
try {
|
|
2920
|
+
if (
|
|
2921
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
2922
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
2923
|
+
) {
|
|
2924
|
+
let _request = new Request(url, {
|
|
2925
|
+
method: 'POST',
|
|
2926
|
+
body: data,
|
|
2927
|
+
duplex: "half"
|
|
2928
|
+
});
|
|
2890
2929
|
|
|
2891
|
-
|
|
2930
|
+
let contentTypeHeader;
|
|
2892
2931
|
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2932
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
2933
|
+
headers.setContentType(contentTypeHeader);
|
|
2934
|
+
}
|
|
2896
2935
|
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2936
|
+
if (_request.body) {
|
|
2937
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
2938
|
+
requestContentLength,
|
|
2939
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
2940
|
+
);
|
|
2902
2941
|
|
|
2903
|
-
|
|
2942
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
2943
|
+
}
|
|
2904
2944
|
}
|
|
2905
|
-
}
|
|
2906
2945
|
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2946
|
+
if (!utils$1.isString(withCredentials)) {
|
|
2947
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
2948
|
+
}
|
|
2910
2949
|
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
request = new Request(url, {
|
|
2915
|
-
...fetchOptions,
|
|
2916
|
-
signal: composedSignal,
|
|
2917
|
-
method: method.toUpperCase(),
|
|
2918
|
-
headers: headers.normalize().toJSON(),
|
|
2919
|
-
body: data,
|
|
2920
|
-
duplex: "half",
|
|
2921
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
2922
|
-
});
|
|
2950
|
+
// Cloudflare Workers throws when credentials are defined
|
|
2951
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
2952
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
2923
2953
|
|
|
2924
|
-
|
|
2954
|
+
const resolvedOptions = {
|
|
2955
|
+
...fetchOptions,
|
|
2956
|
+
signal: composedSignal,
|
|
2957
|
+
method: method.toUpperCase(),
|
|
2958
|
+
headers: headers.normalize().toJSON(),
|
|
2959
|
+
body: data,
|
|
2960
|
+
duplex: "half",
|
|
2961
|
+
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
2962
|
+
};
|
|
2925
2963
|
|
|
2926
|
-
|
|
2964
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
2927
2965
|
|
|
2928
|
-
|
|
2929
|
-
const options = {};
|
|
2966
|
+
let response = await (isRequestSupported ? fetch(request, fetchOptions) : fetch(url, resolvedOptions));
|
|
2930
2967
|
|
|
2931
|
-
|
|
2932
|
-
options[prop] = response[prop];
|
|
2933
|
-
});
|
|
2968
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
2934
2969
|
|
|
2935
|
-
|
|
2970
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
2971
|
+
const options = {};
|
|
2936
2972
|
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
) || [];
|
|
2973
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
2974
|
+
options[prop] = response[prop];
|
|
2975
|
+
});
|
|
2941
2976
|
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2977
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
2978
|
+
|
|
2979
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
2980
|
+
responseContentLength,
|
|
2981
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
2982
|
+
) || [];
|
|
2983
|
+
|
|
2984
|
+
response = new Response(
|
|
2985
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
2986
|
+
flush && flush();
|
|
2987
|
+
unsubscribe && unsubscribe();
|
|
2988
|
+
}),
|
|
2989
|
+
options
|
|
2990
|
+
);
|
|
2991
|
+
}
|
|
2950
2992
|
|
|
2951
|
-
|
|
2993
|
+
responseType = responseType || 'text';
|
|
2952
2994
|
|
|
2953
|
-
|
|
2995
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
2954
2996
|
|
|
2955
|
-
|
|
2997
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
2956
2998
|
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2999
|
+
return await new Promise((resolve, reject) => {
|
|
3000
|
+
settle(resolve, reject, {
|
|
3001
|
+
data: responseData,
|
|
3002
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
3003
|
+
status: response.status,
|
|
3004
|
+
statusText: response.statusText,
|
|
3005
|
+
config,
|
|
3006
|
+
request
|
|
3007
|
+
});
|
|
3008
|
+
})
|
|
3009
|
+
} catch (err) {
|
|
3010
|
+
unsubscribe && unsubscribe();
|
|
3011
|
+
|
|
3012
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3013
|
+
throw Object.assign(
|
|
3014
|
+
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
3015
|
+
{
|
|
3016
|
+
cause: err.cause || err
|
|
3017
|
+
}
|
|
3018
|
+
)
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
throw AxiosError.from(err, err && err.code, config, request);
|
|
2977
3022
|
}
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
3025
|
+
|
|
3026
|
+
const seedCache = new Map();
|
|
3027
|
+
|
|
3028
|
+
const getFetch = (config) => {
|
|
3029
|
+
let env = utils$1.merge.call({
|
|
3030
|
+
skipUndefined: true
|
|
3031
|
+
}, globalFetchAPI, config ? config.env : null);
|
|
3032
|
+
|
|
3033
|
+
const {fetch, Request, Response} = env;
|
|
3034
|
+
|
|
3035
|
+
const seeds = [
|
|
3036
|
+
Request, Response, fetch
|
|
3037
|
+
];
|
|
3038
|
+
|
|
3039
|
+
let len = seeds.length, i = len,
|
|
3040
|
+
seed, target, map = seedCache;
|
|
2978
3041
|
|
|
2979
|
-
|
|
3042
|
+
while (i--) {
|
|
3043
|
+
seed = seeds[i];
|
|
3044
|
+
target = map.get(seed);
|
|
3045
|
+
|
|
3046
|
+
target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
|
|
3047
|
+
|
|
3048
|
+
map = target;
|
|
2980
3049
|
}
|
|
2981
|
-
|
|
3050
|
+
|
|
3051
|
+
return target;
|
|
3052
|
+
};
|
|
3053
|
+
|
|
3054
|
+
getFetch();
|
|
2982
3055
|
|
|
2983
3056
|
const knownAdapters = {
|
|
2984
3057
|
http: httpAdapter,
|
|
2985
3058
|
xhr: xhrAdapter,
|
|
2986
|
-
fetch:
|
|
3059
|
+
fetch: {
|
|
3060
|
+
get: getFetch,
|
|
3061
|
+
}
|
|
2987
3062
|
};
|
|
2988
3063
|
|
|
2989
3064
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
@@ -3002,7 +3077,7 @@ const renderReason = (reason) => `- ${reason}`;
|
|
|
3002
3077
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3003
3078
|
|
|
3004
3079
|
var adapters = {
|
|
3005
|
-
getAdapter: (adapters) => {
|
|
3080
|
+
getAdapter: (adapters, config) => {
|
|
3006
3081
|
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
3007
3082
|
|
|
3008
3083
|
const {length} = adapters;
|
|
@@ -3025,7 +3100,7 @@ var adapters = {
|
|
|
3025
3100
|
}
|
|
3026
3101
|
}
|
|
3027
3102
|
|
|
3028
|
-
if (adapter) {
|
|
3103
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
3029
3104
|
break;
|
|
3030
3105
|
}
|
|
3031
3106
|
|
|
@@ -3093,7 +3168,7 @@ function dispatchRequest(config) {
|
|
|
3093
3168
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
3094
3169
|
}
|
|
3095
3170
|
|
|
3096
|
-
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
3171
|
+
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
3097
3172
|
|
|
3098
3173
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
3099
3174
|
throwIfCancellationRequested(config);
|
|
@@ -3127,7 +3202,7 @@ function dispatchRequest(config) {
|
|
|
3127
3202
|
});
|
|
3128
3203
|
}
|
|
3129
3204
|
|
|
3130
|
-
const VERSION = "1.
|
|
3205
|
+
const VERSION = "1.12.0";
|
|
3131
3206
|
|
|
3132
3207
|
const validators$1 = {};
|
|
3133
3208
|
|