@jjrawlins/cdk-iam-policy-builder-helper 0.0.3 → 0.0.5

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 +210 -62
  2. package/.mergify.yml +60 -0
  3. package/jjrawlinscdkiampolicybuilderhelper/go.mod +4 -4
  4. package/jjrawlinscdkiampolicybuilderhelper/jsii/jsii.go +2 -2
  5. package/jjrawlinscdkiampolicybuilderhelper/version +1 -1
  6. package/lib/constructs/Actions.d.ts +834 -91
  7. package/lib/constructs/Actions.js +835 -92
  8. package/lib/constructs/ManagedPolicies.d.ts +4 -0
  9. package/lib/constructs/ManagedPolicies.js +5 -1
  10. package/methods_list.txt +19274 -0
  11. package/node_modules/axios/CHANGELOG.md +257 -0
  12. package/node_modules/axios/README.md +71 -87
  13. package/node_modules/axios/dist/axios.js +303 -235
  14. package/node_modules/axios/dist/axios.js.map +1 -1
  15. package/node_modules/axios/dist/axios.min.js +2 -1
  16. package/node_modules/axios/dist/axios.min.js.map +1 -1
  17. package/node_modules/axios/dist/browser/axios.cjs +230 -177
  18. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  19. package/node_modules/axios/dist/esm/axios.js +230 -177
  20. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  21. package/node_modules/axios/dist/esm/axios.min.js +2 -1
  22. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  23. package/node_modules/axios/dist/node/axios.cjs +268 -187
  24. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  25. package/node_modules/axios/index.d.cts +22 -6
  26. package/node_modules/axios/index.d.ts +14 -4
  27. package/node_modules/axios/lib/adapters/fetch.js +22 -22
  28. package/node_modules/axios/lib/adapters/http.js +7 -7
  29. package/node_modules/axios/lib/cancel/CancelToken.js +14 -0
  30. package/node_modules/axios/lib/core/Axios.js +20 -6
  31. package/node_modules/axios/lib/core/AxiosError.js +5 -2
  32. package/node_modules/axios/lib/core/AxiosHeaders.js +15 -3
  33. package/node_modules/axios/lib/core/buildFullPath.js +3 -2
  34. package/node_modules/axios/lib/core/mergeConfig.js +6 -6
  35. package/node_modules/axios/lib/env/data.js +1 -1
  36. package/node_modules/axios/lib/helpers/buildURL.js +7 -1
  37. package/node_modules/axios/lib/helpers/composeSignals.js +31 -29
  38. package/node_modules/axios/lib/helpers/formDataToStream.js +6 -5
  39. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +12 -65
  40. package/node_modules/axios/lib/helpers/resolveConfig.js +1 -1
  41. package/node_modules/axios/lib/helpers/throttle.js +1 -1
  42. package/node_modules/axios/lib/helpers/toFormData.js +4 -0
  43. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +4 -3
  44. package/node_modules/axios/lib/helpers/trackStream.js +25 -5
  45. package/node_modules/axios/lib/helpers/validator.js +8 -0
  46. package/node_modules/axios/lib/platform/common/utils.js +5 -4
  47. package/node_modules/axios/lib/platform/node/index.js +26 -0
  48. package/node_modules/axios/lib/utils.js +48 -28
  49. package/node_modules/axios/package.json +14 -5
  50. package/node_modules/form-data/CHANGELOG.md +601 -0
  51. package/node_modules/form-data/{Readme.md → README.md} +34 -37
  52. package/node_modules/form-data/lib/browser.js +3 -1
  53. package/node_modules/form-data/lib/form_data.js +126 -135
  54. package/node_modules/form-data/lib/populate.js +5 -5
  55. package/node_modules/form-data/package.json +24 -16
  56. package/package.json +15 -10
  57. package/node_modules/axios/SECURITY.md +0 -6
@@ -1,7 +1,8 @@
1
- // Axios v1.7.4 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ /*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors */
2
2
  'use strict';
3
3
 
4
4
  const FormData$1 = require('form-data');
5
+ const crypto = require('crypto');
5
6
  const url = require('url');
6
7
  const proxyFromEnv = require('proxy-from-env');
7
8
  const http = require('http');
@@ -15,7 +16,9 @@ const events = require('events');
15
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
17
 
17
18
  const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1);
19
+ const crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
18
20
  const url__default = /*#__PURE__*/_interopDefaultLegacy(url);
21
+ const proxyFromEnv__default = /*#__PURE__*/_interopDefaultLegacy(proxyFromEnv);
19
22
  const http__default = /*#__PURE__*/_interopDefaultLegacy(http);
20
23
  const https__default = /*#__PURE__*/_interopDefaultLegacy(https);
21
24
  const util__default = /*#__PURE__*/_interopDefaultLegacy(util);
@@ -33,6 +36,7 @@ function bind(fn, thisArg) {
33
36
 
34
37
  const {toString} = Object.prototype;
35
38
  const {getPrototypeOf} = Object;
39
+ const {iterator, toStringTag} = Symbol;
36
40
 
37
41
  const kindOf = (cache => thing => {
38
42
  const str = toString.call(thing);
@@ -159,7 +163,28 @@ const isPlainObject = (val) => {
159
163
  }
160
164
 
161
165
  const prototype = getPrototypeOf(val);
162
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
166
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
167
+ };
168
+
169
+ /**
170
+ * Determine if a value is an empty object (safely handles Buffers)
171
+ *
172
+ * @param {*} val The value to test
173
+ *
174
+ * @returns {boolean} True if value is an empty object, otherwise false
175
+ */
176
+ const isEmptyObject = (val) => {
177
+ // Early return for non-objects or Buffers to prevent RangeError
178
+ if (!isObject(val) || isBuffer(val)) {
179
+ return false;
180
+ }
181
+
182
+ try {
183
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
184
+ } catch (e) {
185
+ // Fallback for any other objects that might cause RangeError with Object.keys()
186
+ return false;
187
+ }
163
188
  };
164
189
 
165
190
  /**
@@ -284,6 +309,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
284
309
  fn.call(null, obj[i], i, obj);
285
310
  }
286
311
  } else {
312
+ // Buffer check
313
+ if (isBuffer(obj)) {
314
+ return;
315
+ }
316
+
287
317
  // Iterate over object keys
288
318
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
289
319
  const len = keys.length;
@@ -297,6 +327,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
297
327
  }
298
328
 
299
329
  function findKey(obj, key) {
330
+ if (isBuffer(obj)){
331
+ return null;
332
+ }
333
+
300
334
  key = key.toLowerCase();
301
335
  const keys = Object.keys(obj);
302
336
  let i = keys.length;
@@ -510,13 +544,13 @@ const isTypedArray = (TypedArray => {
510
544
  * @returns {void}
511
545
  */
512
546
  const forEachEntry = (obj, fn) => {
513
- const generator = obj && obj[Symbol.iterator];
547
+ const generator = obj && obj[iterator];
514
548
 
515
- const iterator = generator.call(obj);
549
+ const _iterator = generator.call(obj);
516
550
 
517
551
  let result;
518
552
 
519
- while ((result = iterator.next()) && !result.done) {
553
+ while ((result = _iterator.next()) && !result.done) {
520
554
  const pair = result.value;
521
555
  fn.call(obj, pair[0], pair[1]);
522
556
  }
@@ -629,26 +663,6 @@ const toFiniteNumber = (value, defaultValue) => {
629
663
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
630
664
  };
631
665
 
632
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
633
-
634
- const DIGIT = '0123456789';
635
-
636
- const ALPHABET = {
637
- DIGIT,
638
- ALPHA,
639
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
640
- };
641
-
642
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
643
- let str = '';
644
- const {length} = alphabet;
645
- while (size--) {
646
- str += alphabet[Math.random() * length|0];
647
- }
648
-
649
- return str;
650
- };
651
-
652
666
  /**
653
667
  * If the thing is a FormData object, return true, otherwise return false.
654
668
  *
@@ -657,7 +671,7 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
657
671
  * @returns {boolean}
658
672
  */
659
673
  function isSpecCompliantForm(thing) {
660
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
674
+ return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
661
675
  }
662
676
 
663
677
  const toJSONObject = (obj) => {
@@ -670,6 +684,11 @@ const toJSONObject = (obj) => {
670
684
  return;
671
685
  }
672
686
 
687
+ //Buffer check
688
+ if (isBuffer(source)) {
689
+ return source;
690
+ }
691
+
673
692
  if(!('toJSON' in source)) {
674
693
  stack[i] = source;
675
694
  const target = isArray(source) ? [] : {};
@@ -726,6 +745,10 @@ const asap = typeof queueMicrotask !== 'undefined' ?
726
745
 
727
746
  // *********************
728
747
 
748
+
749
+ const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
750
+
751
+
729
752
  const utils$1 = {
730
753
  isArray,
731
754
  isArrayBuffer,
@@ -737,6 +760,7 @@ const utils$1 = {
737
760
  isBoolean,
738
761
  isObject,
739
762
  isPlainObject,
763
+ isEmptyObject,
740
764
  isReadableStream,
741
765
  isRequest,
742
766
  isResponse,
@@ -776,14 +800,13 @@ const utils$1 = {
776
800
  findKey,
777
801
  global: _global,
778
802
  isContextDefined,
779
- ALPHABET,
780
- generateString,
781
803
  isSpecCompliantForm,
782
804
  toJSONObject,
783
805
  isAsyncFn,
784
806
  isThenable,
785
807
  setImmediate: _setImmediate,
786
- asap
808
+ asap,
809
+ isIterable
787
810
  };
788
811
 
789
812
  /**
@@ -811,7 +834,10 @@ function AxiosError(message, code, config, request, response) {
811
834
  code && (this.code = code);
812
835
  config && (this.config = config);
813
836
  request && (this.request = request);
814
- response && (this.response = response);
837
+ if (response) {
838
+ this.response = response;
839
+ this.status = response.status ? response.status : null;
840
+ }
815
841
  }
816
842
 
817
843
  utils$1.inherits(AxiosError, Error, {
@@ -831,7 +857,7 @@ utils$1.inherits(AxiosError, Error, {
831
857
  // Axios
832
858
  config: utils$1.toJSONObject(this.config),
833
859
  code: this.code,
834
- status: this.response && this.response.status ? this.response.status : null
860
+ status: this.status
835
861
  };
836
862
  }
837
863
  });
@@ -996,6 +1022,10 @@ function toFormData(obj, formData, options) {
996
1022
  return value.toISOString();
997
1023
  }
998
1024
 
1025
+ if (utils$1.isBoolean(value)) {
1026
+ return value.toString();
1027
+ }
1028
+
999
1029
  if (!useBlob && utils$1.isBlob(value)) {
1000
1030
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1001
1031
  }
@@ -1168,7 +1198,7 @@ function encode(val) {
1168
1198
  *
1169
1199
  * @param {string} url The base of the url (e.g., http://www.google.com)
1170
1200
  * @param {object} [params] The params to be appended
1171
- * @param {?object} options
1201
+ * @param {?(object|Function)} options
1172
1202
  *
1173
1203
  * @returns {string} The formatted url
1174
1204
  */
@@ -1180,6 +1210,12 @@ function buildURL(url, params, options) {
1180
1210
 
1181
1211
  const _encode = options && options.encode || encode;
1182
1212
 
1213
+ if (utils$1.isFunction(options)) {
1214
+ options = {
1215
+ serialize: options
1216
+ };
1217
+ }
1218
+
1183
1219
  const serializeFn = options && options.serialize;
1184
1220
 
1185
1221
  let serializedParams;
@@ -1280,6 +1316,29 @@ const transitionalDefaults = {
1280
1316
 
1281
1317
  const URLSearchParams = url__default["default"].URLSearchParams;
1282
1318
 
1319
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
1320
+
1321
+ const DIGIT = '0123456789';
1322
+
1323
+ const ALPHABET = {
1324
+ DIGIT,
1325
+ ALPHA,
1326
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
1327
+ };
1328
+
1329
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
1330
+ let str = '';
1331
+ const {length} = alphabet;
1332
+ const randomValues = new Uint32Array(size);
1333
+ crypto__default["default"].randomFillSync(randomValues);
1334
+ for (let i = 0; i < size; i++) {
1335
+ str += alphabet[randomValues[i] % length];
1336
+ }
1337
+
1338
+ return str;
1339
+ };
1340
+
1341
+
1283
1342
  const platform$1 = {
1284
1343
  isNode: true,
1285
1344
  classes: {
@@ -1287,11 +1346,15 @@ const platform$1 = {
1287
1346
  FormData: FormData__default["default"],
1288
1347
  Blob: typeof Blob !== 'undefined' && Blob || null
1289
1348
  },
1349
+ ALPHABET,
1350
+ generateString,
1290
1351
  protocols: [ 'http', 'https', 'file', 'data' ]
1291
1352
  };
1292
1353
 
1293
1354
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1294
1355
 
1356
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
1357
+
1295
1358
  /**
1296
1359
  * Determine if we're running in a standard browser environment
1297
1360
  *
@@ -1309,10 +1372,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
1309
1372
  *
1310
1373
  * @returns {boolean}
1311
1374
  */
1312
- const hasStandardBrowserEnv = (
1313
- (product) => {
1314
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
1315
- })(typeof navigator !== 'undefined' && navigator.product);
1375
+ const hasStandardBrowserEnv = hasBrowserEnv &&
1376
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1316
1377
 
1317
1378
  /**
1318
1379
  * Determine if we're running in a standard browser webWorker environment
@@ -1339,6 +1400,7 @@ const utils = /*#__PURE__*/Object.freeze({
1339
1400
  hasBrowserEnv: hasBrowserEnv,
1340
1401
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1341
1402
  hasStandardBrowserEnv: hasStandardBrowserEnv,
1403
+ navigator: _navigator,
1342
1404
  origin: origin
1343
1405
  });
1344
1406
 
@@ -1348,7 +1410,7 @@ const platform = {
1348
1410
  };
1349
1411
 
1350
1412
  function toURLEncodedForm(data, options) {
1351
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1413
+ return toFormData(data, new platform.classes.URLSearchParams(), {
1352
1414
  visitor: function(value, key, path, helpers) {
1353
1415
  if (platform.isNode && utils$1.isBuffer(value)) {
1354
1416
  this.append(key, value.toString('base64'));
@@ -1356,8 +1418,9 @@ function toURLEncodedForm(data, options) {
1356
1418
  }
1357
1419
 
1358
1420
  return helpers.defaultVisitor.apply(this, arguments);
1359
- }
1360
- }, options));
1421
+ },
1422
+ ...options
1423
+ });
1361
1424
  }
1362
1425
 
1363
1426
  /**
@@ -1751,10 +1814,18 @@ class AxiosHeaders {
1751
1814
  setHeaders(header, valueOrRewrite);
1752
1815
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1753
1816
  setHeaders(parseHeaders(header), valueOrRewrite);
1754
- } else if (utils$1.isHeaders(header)) {
1755
- for (const [key, value] of header.entries()) {
1756
- setHeader(value, key, rewrite);
1817
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1818
+ let obj = {}, dest, key;
1819
+ for (const entry of header) {
1820
+ if (!utils$1.isArray(entry)) {
1821
+ throw TypeError('Object iterator must return a key-value pair');
1822
+ }
1823
+
1824
+ obj[key = entry[0]] = (dest = obj[key]) ?
1825
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
1757
1826
  }
1827
+
1828
+ setHeaders(obj, valueOrRewrite);
1758
1829
  } else {
1759
1830
  header != null && setHeader(valueOrRewrite, header, rewrite);
1760
1831
  }
@@ -1896,6 +1967,10 @@ class AxiosHeaders {
1896
1967
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1897
1968
  }
1898
1969
 
1970
+ getSetCookie() {
1971
+ return this.get("set-cookie") || [];
1972
+ }
1973
+
1899
1974
  get [Symbol.toStringTag]() {
1900
1975
  return 'AxiosHeaders';
1901
1976
  }
@@ -2060,14 +2135,15 @@ function combineURLs(baseURL, relativeURL) {
2060
2135
  *
2061
2136
  * @returns {string} The combined full path
2062
2137
  */
2063
- function buildFullPath(baseURL, requestedURL) {
2064
- if (baseURL && !isAbsoluteURL(requestedURL)) {
2138
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2139
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
2140
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2065
2141
  return combineURLs(baseURL, requestedURL);
2066
2142
  }
2067
2143
  return requestedURL;
2068
2144
  }
2069
2145
 
2070
- const VERSION = "1.7.4";
2146
+ const VERSION = "1.11.0";
2071
2147
 
2072
2148
  function parseProtocol(url) {
2073
2149
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -2277,9 +2353,9 @@ const readBlob = async function* (blob) {
2277
2353
 
2278
2354
  const readBlob$1 = readBlob;
2279
2355
 
2280
- const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
2356
+ const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
2281
2357
 
2282
- const textEncoder = new util.TextEncoder();
2358
+ const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util__default["default"].TextEncoder();
2283
2359
 
2284
2360
  const CRLF = '\r\n';
2285
2361
  const CRLF_BYTES = textEncoder.encode(CRLF);
@@ -2337,7 +2413,7 @@ const formDataToStream = (form, headersHandler, options) => {
2337
2413
  const {
2338
2414
  tag = 'form-data-boundary',
2339
2415
  size = 25,
2340
- boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
2416
+ boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
2341
2417
  } = options || {};
2342
2418
 
2343
2419
  if(!utils$1.isFormData(form)) {
@@ -2349,7 +2425,7 @@ const formDataToStream = (form, headersHandler, options) => {
2349
2425
  }
2350
2426
 
2351
2427
  const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
2352
- const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);
2428
+ const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF);
2353
2429
  let contentLength = footerBytes.byteLength;
2354
2430
 
2355
2431
  const parts = Array.from(form.entries()).map(([name, value]) => {
@@ -2495,7 +2571,7 @@ function throttle(fn, freq) {
2495
2571
  clearTimeout(timer);
2496
2572
  timer = null;
2497
2573
  }
2498
- fn.apply(null, args);
2574
+ fn(...args);
2499
2575
  };
2500
2576
 
2501
2577
  const throttled = (...args) => {
@@ -2617,7 +2693,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
2617
2693
  function setProxy(options, configProxy, location) {
2618
2694
  let proxy = configProxy;
2619
2695
  if (!proxy && proxy !== false) {
2620
- const proxyUrl = proxyFromEnv.getProxyForUrl(location);
2696
+ const proxyUrl = proxyFromEnv__default["default"].getProxyForUrl(location);
2621
2697
  if (proxyUrl) {
2622
2698
  proxy = new URL(proxyUrl);
2623
2699
  }
@@ -2762,8 +2838,8 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
2762
2838
  }
2763
2839
 
2764
2840
  // Parse url
2765
- const fullPath = buildFullPath(config.baseURL, config.url);
2766
- const parsed = new URL(fullPath, utils$1.hasBrowserEnv ? platform.origin : undefined);
2841
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
2842
+ const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
2767
2843
  const protocol = parsed.protocol || supportedProtocols[0];
2768
2844
 
2769
2845
  if (protocol === 'data:') {
@@ -2848,7 +2924,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
2848
2924
  } catch (e) {
2849
2925
  }
2850
2926
  }
2851
- } else if (utils$1.isBlob(data)) {
2927
+ } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
2852
2928
  data.size && headers.setContentType(data.type || 'application/octet-stream');
2853
2929
  headers.setContentLength(data.size || 0);
2854
2930
  data = stream__default["default"].Readable.from(readBlob$1(data));
@@ -2959,7 +3035,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
2959
3035
  if (config.socketPath) {
2960
3036
  options.socketPath = config.socketPath;
2961
3037
  } else {
2962
- options.hostname = parsed.hostname;
3038
+ options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
2963
3039
  options.port = parsed.port;
2964
3040
  setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
2965
3041
  }
@@ -3101,7 +3177,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3101
3177
  }
3102
3178
 
3103
3179
  const err = new AxiosError(
3104
- 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
3180
+ 'stream has been aborted',
3105
3181
  AxiosError.ERR_BAD_RESPONSE,
3106
3182
  config,
3107
3183
  lastRequest
@@ -3224,68 +3300,18 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3224
3300
  });
3225
3301
  };
3226
3302
 
3227
- const isURLSameOrigin = platform.hasStandardBrowserEnv ?
3228
-
3229
- // Standard browser envs have full support of the APIs needed to test
3230
- // whether the request URL is of the same origin as current location.
3231
- (function standardBrowserEnv() {
3232
- const msie = /(msie|trident)/i.test(navigator.userAgent);
3233
- const urlParsingNode = document.createElement('a');
3234
- let originURL;
3235
-
3236
- /**
3237
- * Parse a URL to discover its components
3238
- *
3239
- * @param {String} url The URL to be parsed
3240
- * @returns {Object}
3241
- */
3242
- function resolveURL(url) {
3243
- let href = url;
3244
-
3245
- if (msie) {
3246
- // IE needs attribute set twice to normalize properties
3247
- urlParsingNode.setAttribute('href', href);
3248
- href = urlParsingNode.href;
3249
- }
3250
-
3251
- urlParsingNode.setAttribute('href', href);
3252
-
3253
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
3254
- return {
3255
- href: urlParsingNode.href,
3256
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
3257
- host: urlParsingNode.host,
3258
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
3259
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
3260
- hostname: urlParsingNode.hostname,
3261
- port: urlParsingNode.port,
3262
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
3263
- urlParsingNode.pathname :
3264
- '/' + urlParsingNode.pathname
3265
- };
3266
- }
3267
-
3268
- originURL = resolveURL(window.location.href);
3303
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
3304
+ url = new URL(url, platform.origin);
3269
3305
 
3270
- /**
3271
- * Determine if a URL shares the same origin as the current location
3272
- *
3273
- * @param {String} requestURL The URL to test
3274
- * @returns {boolean} True if URL shares the same origin, otherwise false
3275
- */
3276
- return function isURLSameOrigin(requestURL) {
3277
- const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
3278
- return (parsed.protocol === originURL.protocol &&
3279
- parsed.host === originURL.host);
3280
- };
3281
- })() :
3282
-
3283
- // Non standard browser envs (web workers, react-native) lack needed support.
3284
- (function nonStandardBrowserEnv() {
3285
- return function isURLSameOrigin() {
3286
- return true;
3287
- };
3288
- })();
3306
+ return (
3307
+ origin.protocol === url.protocol &&
3308
+ origin.host === url.host &&
3309
+ (isMSIE || origin.port === url.port)
3310
+ );
3311
+ })(
3312
+ new URL(platform.origin),
3313
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
3314
+ ) : () => true;
3289
3315
 
3290
3316
  const cookies = platform.hasStandardBrowserEnv ?
3291
3317
 
@@ -3342,7 +3368,7 @@ function mergeConfig(config1, config2) {
3342
3368
  config2 = config2 || {};
3343
3369
  const config = {};
3344
3370
 
3345
- function getMergedValue(target, source, caseless) {
3371
+ function getMergedValue(target, source, prop, caseless) {
3346
3372
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
3347
3373
  return utils$1.merge.call({caseless}, target, source);
3348
3374
  } else if (utils$1.isPlainObject(source)) {
@@ -3354,11 +3380,11 @@ function mergeConfig(config1, config2) {
3354
3380
  }
3355
3381
 
3356
3382
  // eslint-disable-next-line consistent-return
3357
- function mergeDeepProperties(a, b, caseless) {
3383
+ function mergeDeepProperties(a, b, prop , caseless) {
3358
3384
  if (!utils$1.isUndefined(b)) {
3359
- return getMergedValue(a, b, caseless);
3385
+ return getMergedValue(a, b, prop , caseless);
3360
3386
  } else if (!utils$1.isUndefined(a)) {
3361
- return getMergedValue(undefined, a, caseless);
3387
+ return getMergedValue(undefined, a, prop , caseless);
3362
3388
  }
3363
3389
  }
3364
3390
 
@@ -3416,10 +3442,10 @@ function mergeConfig(config1, config2) {
3416
3442
  socketPath: defaultToConfig2,
3417
3443
  responseEncoding: defaultToConfig2,
3418
3444
  validateStatus: mergeDirectKeys,
3419
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
3445
+ headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
3420
3446
  };
3421
3447
 
3422
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
3448
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
3423
3449
  const merge = mergeMap[prop] || mergeDeepProperties;
3424
3450
  const configValue = merge(config1[prop], config2[prop], prop);
3425
3451
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -3435,7 +3461,7 @@ const resolveConfig = (config) => {
3435
3461
 
3436
3462
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
3437
3463
 
3438
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
3464
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
3439
3465
 
3440
3466
  // HTTP basic authentication
3441
3467
  if (auth) {
@@ -3664,45 +3690,46 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
3664
3690
  };
3665
3691
 
3666
3692
  const composeSignals = (signals, timeout) => {
3667
- let controller = new AbortController();
3693
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
3668
3694
 
3669
- let aborted;
3695
+ if (timeout || length) {
3696
+ let controller = new AbortController();
3670
3697
 
3671
- const onabort = function (cancel) {
3672
- if (!aborted) {
3673
- aborted = true;
3674
- unsubscribe();
3675
- const err = cancel instanceof Error ? cancel : this.reason;
3676
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3677
- }
3678
- };
3698
+ let aborted;
3679
3699
 
3680
- let timer = timeout && setTimeout(() => {
3681
- onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
3682
- }, timeout);
3700
+ const onabort = function (reason) {
3701
+ if (!aborted) {
3702
+ aborted = true;
3703
+ unsubscribe();
3704
+ const err = reason instanceof Error ? reason : this.reason;
3705
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3706
+ }
3707
+ };
3683
3708
 
3684
- const unsubscribe = () => {
3685
- if (signals) {
3686
- timer && clearTimeout(timer);
3709
+ let timer = timeout && setTimeout(() => {
3687
3710
  timer = null;
3688
- signals.forEach(signal => {
3689
- signal &&
3690
- (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
3691
- });
3692
- signals = null;
3693
- }
3694
- };
3711
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
3712
+ }, timeout);
3713
+
3714
+ const unsubscribe = () => {
3715
+ if (signals) {
3716
+ timer && clearTimeout(timer);
3717
+ timer = null;
3718
+ signals.forEach(signal => {
3719
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3720
+ });
3721
+ signals = null;
3722
+ }
3723
+ };
3695
3724
 
3696
- signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
3725
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
3697
3726
 
3698
- const {signal} = controller;
3727
+ const {signal} = controller;
3699
3728
 
3700
- signal.unsubscribe = unsubscribe;
3729
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
3701
3730
 
3702
- return [signal, () => {
3703
- timer && clearTimeout(timer);
3704
- timer = null;
3705
- }];
3731
+ return signal;
3732
+ }
3706
3733
  };
3707
3734
 
3708
3735
  const composeSignals$1 = composeSignals;
@@ -3725,14 +3752,34 @@ const streamChunk = function* (chunk, chunkSize) {
3725
3752
  }
3726
3753
  };
3727
3754
 
3728
- const readBytes = async function* (iterable, chunkSize, encode) {
3729
- for await (const chunk of iterable) {
3730
- yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
3755
+ const readBytes = async function* (iterable, chunkSize) {
3756
+ for await (const chunk of readStream(iterable)) {
3757
+ yield* streamChunk(chunk, chunkSize);
3731
3758
  }
3732
3759
  };
3733
3760
 
3734
- const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
3735
- const iterator = readBytes(stream, chunkSize, encode);
3761
+ const readStream = async function* (stream) {
3762
+ if (stream[Symbol.asyncIterator]) {
3763
+ yield* stream;
3764
+ return;
3765
+ }
3766
+
3767
+ const reader = stream.getReader();
3768
+ try {
3769
+ for (;;) {
3770
+ const {done, value} = await reader.read();
3771
+ if (done) {
3772
+ break;
3773
+ }
3774
+ yield value;
3775
+ }
3776
+ } finally {
3777
+ await reader.cancel();
3778
+ }
3779
+ };
3780
+
3781
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3782
+ const iterator = readBytes(stream, chunkSize);
3736
3783
 
3737
3784
  let bytes = 0;
3738
3785
  let done;
@@ -3835,7 +3882,11 @@ const getBodyLength = async (body) => {
3835
3882
  }
3836
3883
 
3837
3884
  if(utils$1.isSpecCompliantForm(body)) {
3838
- return (await new Request(body).arrayBuffer()).byteLength;
3885
+ const _request = new Request(platform.origin, {
3886
+ method: 'POST',
3887
+ body,
3888
+ });
3889
+ return (await _request.arrayBuffer()).byteLength;
3839
3890
  }
3840
3891
 
3841
3892
  if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
@@ -3875,18 +3926,13 @@ const fetchAdapter = isFetchSupported && (async (config) => {
3875
3926
 
3876
3927
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3877
3928
 
3878
- let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
3879
- composeSignals$1([signal, cancelToken], timeout) : [];
3880
-
3881
- let finished, request;
3929
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3882
3930
 
3883
- const onFinish = () => {
3884
- !finished && setTimeout(() => {
3885
- composedSignal && composedSignal.unsubscribe();
3886
- });
3931
+ let request;
3887
3932
 
3888
- finished = true;
3889
- };
3933
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
3934
+ composedSignal.unsubscribe();
3935
+ });
3890
3936
 
3891
3937
  let requestContentLength;
3892
3938
 
@@ -3913,7 +3959,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
3913
3959
  progressEventReducer(asyncDecorator(onUploadProgress))
3914
3960
  );
3915
3961
 
3916
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
3962
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3917
3963
  }
3918
3964
  }
3919
3965
 
@@ -3921,6 +3967,9 @@ const fetchAdapter = isFetchSupported && (async (config) => {
3921
3967
  withCredentials = withCredentials ? 'include' : 'omit';
3922
3968
  }
3923
3969
 
3970
+ // Cloudflare Workers throws when credentials are defined
3971
+ // see https://github.com/cloudflare/workerd/issues/902
3972
+ const isCredentialsSupported = "credentials" in Request.prototype;
3924
3973
  request = new Request(url, {
3925
3974
  ...fetchOptions,
3926
3975
  signal: composedSignal,
@@ -3928,14 +3977,14 @@ const fetchAdapter = isFetchSupported && (async (config) => {
3928
3977
  headers: headers.normalize().toJSON(),
3929
3978
  body: data,
3930
3979
  duplex: "half",
3931
- credentials: withCredentials
3980
+ credentials: isCredentialsSupported ? withCredentials : undefined
3932
3981
  });
3933
3982
 
3934
- let response = await fetch(request);
3983
+ let response = await fetch(request, fetchOptions);
3935
3984
 
3936
3985
  const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3937
3986
 
3938
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
3987
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
3939
3988
  const options = {};
3940
3989
 
3941
3990
  ['status', 'statusText', 'headers'].forEach(prop => {
@@ -3952,8 +4001,8 @@ const fetchAdapter = isFetchSupported && (async (config) => {
3952
4001
  response = new Response(
3953
4002
  trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
3954
4003
  flush && flush();
3955
- isStreamResponse && onFinish();
3956
- }, encodeText),
4004
+ unsubscribe && unsubscribe();
4005
+ }),
3957
4006
  options
3958
4007
  );
3959
4008
  }
@@ -3962,9 +4011,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
3962
4011
 
3963
4012
  let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3964
4013
 
3965
- !isStreamResponse && onFinish();
3966
-
3967
- stopTimeout && stopTimeout();
4014
+ !isStreamResponse && unsubscribe && unsubscribe();
3968
4015
 
3969
4016
  return await new Promise((resolve, reject) => {
3970
4017
  settle(resolve, reject, {
@@ -3977,9 +4024,9 @@ const fetchAdapter = isFetchSupported && (async (config) => {
3977
4024
  });
3978
4025
  })
3979
4026
  } catch (err) {
3980
- onFinish();
4027
+ unsubscribe && unsubscribe();
3981
4028
 
3982
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
4029
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3983
4030
  throw Object.assign(
3984
4031
  new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
3985
4032
  {
@@ -4188,6 +4235,14 @@ validators$1.transitional = function transitional(validator, version, message) {
4188
4235
  };
4189
4236
  };
4190
4237
 
4238
+ validators$1.spelling = function spelling(correctSpelling) {
4239
+ return (value, opt) => {
4240
+ // eslint-disable-next-line no-console
4241
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
4242
+ return true;
4243
+ }
4244
+ };
4245
+
4191
4246
  /**
4192
4247
  * Assert object's properties type
4193
4248
  *
@@ -4237,7 +4292,7 @@ const validators = validator.validators;
4237
4292
  */
4238
4293
  class Axios {
4239
4294
  constructor(instanceConfig) {
4240
- this.defaults = instanceConfig;
4295
+ this.defaults = instanceConfig || {};
4241
4296
  this.interceptors = {
4242
4297
  request: new InterceptorManager$1(),
4243
4298
  response: new InterceptorManager$1()
@@ -4257,9 +4312,9 @@ class Axios {
4257
4312
  return await this._request(configOrUrl, config);
4258
4313
  } catch (err) {
4259
4314
  if (err instanceof Error) {
4260
- let dummy;
4315
+ let dummy = {};
4261
4316
 
4262
- Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
4317
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
4263
4318
 
4264
4319
  // slice off the Error: ... line
4265
4320
  const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
@@ -4314,6 +4369,18 @@ class Axios {
4314
4369
  }
4315
4370
  }
4316
4371
 
4372
+ // Set config.allowAbsoluteUrls
4373
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
4374
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
4375
+ } else {
4376
+ config.allowAbsoluteUrls = true;
4377
+ }
4378
+
4379
+ validator.assertOptions(config, {
4380
+ baseUrl: validators.spelling('baseURL'),
4381
+ withXsrfToken: validators.spelling('withXSRFToken')
4382
+ }, true);
4383
+
4317
4384
  // Set config.method
4318
4385
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
4319
4386
 
@@ -4356,8 +4423,8 @@ class Axios {
4356
4423
 
4357
4424
  if (!synchronousRequestInterceptors) {
4358
4425
  const chain = [dispatchRequest.bind(this), undefined];
4359
- chain.unshift.apply(chain, requestInterceptorChain);
4360
- chain.push.apply(chain, responseInterceptorChain);
4426
+ chain.unshift(...requestInterceptorChain);
4427
+ chain.push(...responseInterceptorChain);
4361
4428
  len = chain.length;
4362
4429
 
4363
4430
  promise = Promise.resolve(config);
@@ -4404,7 +4471,7 @@ class Axios {
4404
4471
 
4405
4472
  getUri(config) {
4406
4473
  config = mergeConfig(this.defaults, config);
4407
- const fullPath = buildFullPath(config.baseURL, config.url);
4474
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4408
4475
  return buildURL(fullPath, config.params, config.paramsSerializer);
4409
4476
  }
4410
4477
  }
@@ -4544,6 +4611,20 @@ class CancelToken {
4544
4611
  }
4545
4612
  }
4546
4613
 
4614
+ toAbortSignal() {
4615
+ const controller = new AbortController();
4616
+
4617
+ const abort = (err) => {
4618
+ controller.abort(err);
4619
+ };
4620
+
4621
+ this.subscribe(abort);
4622
+
4623
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
4624
+
4625
+ return controller.signal;
4626
+ }
4627
+
4547
4628
  /**
4548
4629
  * Returns an object that contains a new `CancelToken` and a function that, when called,
4549
4630
  * cancels the `CancelToken`.