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