@jjrawlins/cdk-iam-policy-builder-helper 0.0.4 → 0.0.6

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 (62) hide show
  1. package/.jsii +211 -62
  2. package/.mergify.yml +60 -0
  3. package/cdk-iam-policy-builder-helper/go.mod +13 -0
  4. package/{jjrawlinscdkiampolicybuilderhelper → cdk-iam-policy-builder-helper}/jsii/jsii.go +2 -2
  5. package/cdk-iam-policy-builder-helper/version +1 -0
  6. package/lib/bin/download-actions-json.js +3 -7
  7. package/lib/constructs/Actions.d.ts +800 -61
  8. package/lib/constructs/Actions.js +801 -62
  9. package/lib/constructs/ManagedPolicies.d.ts +248 -40
  10. package/lib/constructs/ManagedPolicies.js +249 -41
  11. package/methods_list.txt +19274 -0
  12. package/node_modules/axios/CHANGELOG.md +257 -0
  13. package/node_modules/axios/README.md +71 -87
  14. package/node_modules/axios/dist/axios.js +303 -235
  15. package/node_modules/axios/dist/axios.js.map +1 -1
  16. package/node_modules/axios/dist/axios.min.js +2 -1
  17. package/node_modules/axios/dist/axios.min.js.map +1 -1
  18. package/node_modules/axios/dist/browser/axios.cjs +230 -177
  19. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  20. package/node_modules/axios/dist/esm/axios.js +230 -177
  21. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  22. package/node_modules/axios/dist/esm/axios.min.js +2 -1
  23. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  24. package/node_modules/axios/dist/node/axios.cjs +268 -187
  25. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  26. package/node_modules/axios/index.d.cts +22 -6
  27. package/node_modules/axios/index.d.ts +14 -4
  28. package/node_modules/axios/lib/adapters/fetch.js +22 -22
  29. package/node_modules/axios/lib/adapters/http.js +7 -7
  30. package/node_modules/axios/lib/cancel/CancelToken.js +14 -0
  31. package/node_modules/axios/lib/core/Axios.js +20 -6
  32. package/node_modules/axios/lib/core/AxiosError.js +5 -2
  33. package/node_modules/axios/lib/core/AxiosHeaders.js +15 -3
  34. package/node_modules/axios/lib/core/buildFullPath.js +3 -2
  35. package/node_modules/axios/lib/core/mergeConfig.js +6 -6
  36. package/node_modules/axios/lib/env/data.js +1 -1
  37. package/node_modules/axios/lib/helpers/buildURL.js +7 -1
  38. package/node_modules/axios/lib/helpers/composeSignals.js +31 -29
  39. package/node_modules/axios/lib/helpers/formDataToStream.js +6 -5
  40. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +12 -65
  41. package/node_modules/axios/lib/helpers/resolveConfig.js +1 -1
  42. package/node_modules/axios/lib/helpers/throttle.js +1 -1
  43. package/node_modules/axios/lib/helpers/toFormData.js +4 -0
  44. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +4 -3
  45. package/node_modules/axios/lib/helpers/trackStream.js +25 -5
  46. package/node_modules/axios/lib/helpers/validator.js +8 -0
  47. package/node_modules/axios/lib/platform/common/utils.js +5 -4
  48. package/node_modules/axios/lib/platform/node/index.js +26 -0
  49. package/node_modules/axios/lib/utils.js +48 -28
  50. package/node_modules/axios/package.json +14 -5
  51. package/node_modules/form-data/CHANGELOG.md +601 -0
  52. package/node_modules/form-data/{Readme.md → README.md} +34 -37
  53. package/node_modules/form-data/lib/browser.js +3 -1
  54. package/node_modules/form-data/lib/form_data.js +126 -135
  55. package/node_modules/form-data/lib/populate.js +5 -5
  56. package/node_modules/form-data/package.json +24 -16
  57. package/package.json +16 -10
  58. package/jjrawlinscdkiampolicybuilderhelper/go.mod +0 -13
  59. package/jjrawlinscdkiampolicybuilderhelper/version +0 -1
  60. package/node_modules/axios/SECURITY.md +0 -6
  61. /package/{jjrawlinscdkiampolicybuilderhelper → cdk-iam-policy-builder-helper}/LICENSE +0 -0
  62. /package/{jjrawlinscdkiampolicybuilderhelper → cdk-iam-policy-builder-helper}/README.md +0 -0
@@ -1,4 +1,4 @@
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
  function bind(fn, thisArg) {
@@ -11,6 +11,7 @@ function bind(fn, thisArg) {
11
11
 
12
12
  const {toString} = Object.prototype;
13
13
  const {getPrototypeOf} = Object;
14
+ const {iterator, toStringTag} = Symbol;
14
15
 
15
16
  const kindOf = (cache => thing => {
16
17
  const str = toString.call(thing);
@@ -137,7 +138,28 @@ const isPlainObject = (val) => {
137
138
  }
138
139
 
139
140
  const prototype = getPrototypeOf(val);
140
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
141
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
142
+ };
143
+
144
+ /**
145
+ * Determine if a value is an empty object (safely handles Buffers)
146
+ *
147
+ * @param {*} val The value to test
148
+ *
149
+ * @returns {boolean} True if value is an empty object, otherwise false
150
+ */
151
+ const isEmptyObject = (val) => {
152
+ // Early return for non-objects or Buffers to prevent RangeError
153
+ if (!isObject(val) || isBuffer(val)) {
154
+ return false;
155
+ }
156
+
157
+ try {
158
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
159
+ } catch (e) {
160
+ // Fallback for any other objects that might cause RangeError with Object.keys()
161
+ return false;
162
+ }
141
163
  };
142
164
 
143
165
  /**
@@ -262,6 +284,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
262
284
  fn.call(null, obj[i], i, obj);
263
285
  }
264
286
  } else {
287
+ // Buffer check
288
+ if (isBuffer(obj)) {
289
+ return;
290
+ }
291
+
265
292
  // Iterate over object keys
266
293
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
267
294
  const len = keys.length;
@@ -275,6 +302,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
275
302
  }
276
303
 
277
304
  function findKey(obj, key) {
305
+ if (isBuffer(obj)){
306
+ return null;
307
+ }
308
+
278
309
  key = key.toLowerCase();
279
310
  const keys = Object.keys(obj);
280
311
  let i = keys.length;
@@ -488,13 +519,13 @@ const isTypedArray = (TypedArray => {
488
519
  * @returns {void}
489
520
  */
490
521
  const forEachEntry = (obj, fn) => {
491
- const generator = obj && obj[Symbol.iterator];
522
+ const generator = obj && obj[iterator];
492
523
 
493
- const iterator = generator.call(obj);
524
+ const _iterator = generator.call(obj);
494
525
 
495
526
  let result;
496
527
 
497
- while ((result = iterator.next()) && !result.done) {
528
+ while ((result = _iterator.next()) && !result.done) {
498
529
  const pair = result.value;
499
530
  fn.call(obj, pair[0], pair[1]);
500
531
  }
@@ -607,26 +638,6 @@ const toFiniteNumber = (value, defaultValue) => {
607
638
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
608
639
  };
609
640
 
610
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
611
-
612
- const DIGIT = '0123456789';
613
-
614
- const ALPHABET = {
615
- DIGIT,
616
- ALPHA,
617
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
618
- };
619
-
620
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
621
- let str = '';
622
- const {length} = alphabet;
623
- while (size--) {
624
- str += alphabet[Math.random() * length|0];
625
- }
626
-
627
- return str;
628
- };
629
-
630
641
  /**
631
642
  * If the thing is a FormData object, return true, otherwise return false.
632
643
  *
@@ -635,7 +646,7 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
635
646
  * @returns {boolean}
636
647
  */
637
648
  function isSpecCompliantForm(thing) {
638
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
649
+ return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
639
650
  }
640
651
 
641
652
  const toJSONObject = (obj) => {
@@ -648,6 +659,11 @@ const toJSONObject = (obj) => {
648
659
  return;
649
660
  }
650
661
 
662
+ //Buffer check
663
+ if (isBuffer(source)) {
664
+ return source;
665
+ }
666
+
651
667
  if(!('toJSON' in source)) {
652
668
  stack[i] = source;
653
669
  const target = isArray(source) ? [] : {};
@@ -704,6 +720,10 @@ const asap = typeof queueMicrotask !== 'undefined' ?
704
720
 
705
721
  // *********************
706
722
 
723
+
724
+ const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
725
+
726
+
707
727
  var utils$1 = {
708
728
  isArray,
709
729
  isArrayBuffer,
@@ -715,6 +735,7 @@ var utils$1 = {
715
735
  isBoolean,
716
736
  isObject,
717
737
  isPlainObject,
738
+ isEmptyObject,
718
739
  isReadableStream,
719
740
  isRequest,
720
741
  isResponse,
@@ -754,14 +775,13 @@ var utils$1 = {
754
775
  findKey,
755
776
  global: _global,
756
777
  isContextDefined,
757
- ALPHABET,
758
- generateString,
759
778
  isSpecCompliantForm,
760
779
  toJSONObject,
761
780
  isAsyncFn,
762
781
  isThenable,
763
782
  setImmediate: _setImmediate,
764
- asap
783
+ asap,
784
+ isIterable
765
785
  };
766
786
 
767
787
  /**
@@ -789,7 +809,10 @@ function AxiosError(message, code, config, request, response) {
789
809
  code && (this.code = code);
790
810
  config && (this.config = config);
791
811
  request && (this.request = request);
792
- response && (this.response = response);
812
+ if (response) {
813
+ this.response = response;
814
+ this.status = response.status ? response.status : null;
815
+ }
793
816
  }
794
817
 
795
818
  utils$1.inherits(AxiosError, Error, {
@@ -809,7 +832,7 @@ utils$1.inherits(AxiosError, Error, {
809
832
  // Axios
810
833
  config: utils$1.toJSONObject(this.config),
811
834
  code: this.code,
812
- status: this.response && this.response.status ? this.response.status : null
835
+ status: this.status
813
836
  };
814
837
  }
815
838
  });
@@ -977,6 +1000,10 @@ function toFormData(obj, formData, options) {
977
1000
  return value.toISOString();
978
1001
  }
979
1002
 
1003
+ if (utils$1.isBoolean(value)) {
1004
+ return value.toString();
1005
+ }
1006
+
980
1007
  if (!useBlob && utils$1.isBlob(value)) {
981
1008
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
982
1009
  }
@@ -1149,7 +1176,7 @@ function encode(val) {
1149
1176
  *
1150
1177
  * @param {string} url The base of the url (e.g., http://www.google.com)
1151
1178
  * @param {object} [params] The params to be appended
1152
- * @param {?object} options
1179
+ * @param {?(object|Function)} options
1153
1180
  *
1154
1181
  * @returns {string} The formatted url
1155
1182
  */
@@ -1161,6 +1188,12 @@ function buildURL(url, params, options) {
1161
1188
 
1162
1189
  const _encode = options && options.encode || encode;
1163
1190
 
1191
+ if (utils$1.isFunction(options)) {
1192
+ options = {
1193
+ serialize: options
1194
+ };
1195
+ }
1196
+
1164
1197
  const serializeFn = options && options.serialize;
1165
1198
 
1166
1199
  let serializedParams;
@@ -1277,6 +1310,8 @@ var platform$1 = {
1277
1310
 
1278
1311
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1279
1312
 
1313
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
1314
+
1280
1315
  /**
1281
1316
  * Determine if we're running in a standard browser environment
1282
1317
  *
@@ -1294,10 +1329,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
1294
1329
  *
1295
1330
  * @returns {boolean}
1296
1331
  */
1297
- const hasStandardBrowserEnv = (
1298
- (product) => {
1299
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
1300
- })(typeof navigator !== 'undefined' && navigator.product);
1332
+ const hasStandardBrowserEnv = hasBrowserEnv &&
1333
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1301
1334
 
1302
1335
  /**
1303
1336
  * Determine if we're running in a standard browser webWorker environment
@@ -1324,6 +1357,7 @@ var utils = /*#__PURE__*/Object.freeze({
1324
1357
  hasBrowserEnv: hasBrowserEnv,
1325
1358
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1326
1359
  hasStandardBrowserEnv: hasStandardBrowserEnv,
1360
+ navigator: _navigator,
1327
1361
  origin: origin
1328
1362
  });
1329
1363
 
@@ -1333,7 +1367,7 @@ var platform = {
1333
1367
  };
1334
1368
 
1335
1369
  function toURLEncodedForm(data, options) {
1336
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1370
+ return toFormData(data, new platform.classes.URLSearchParams(), {
1337
1371
  visitor: function(value, key, path, helpers) {
1338
1372
  if (platform.isNode && utils$1.isBuffer(value)) {
1339
1373
  this.append(key, value.toString('base64'));
@@ -1341,8 +1375,9 @@ function toURLEncodedForm(data, options) {
1341
1375
  }
1342
1376
 
1343
1377
  return helpers.defaultVisitor.apply(this, arguments);
1344
- }
1345
- }, options));
1378
+ },
1379
+ ...options
1380
+ });
1346
1381
  }
1347
1382
 
1348
1383
  /**
@@ -1736,10 +1771,18 @@ class AxiosHeaders {
1736
1771
  setHeaders(header, valueOrRewrite);
1737
1772
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1738
1773
  setHeaders(parseHeaders(header), valueOrRewrite);
1739
- } else if (utils$1.isHeaders(header)) {
1740
- for (const [key, value] of header.entries()) {
1741
- setHeader(value, key, rewrite);
1774
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1775
+ let obj = {}, dest, key;
1776
+ for (const entry of header) {
1777
+ if (!utils$1.isArray(entry)) {
1778
+ throw TypeError('Object iterator must return a key-value pair');
1779
+ }
1780
+
1781
+ obj[key = entry[0]] = (dest = obj[key]) ?
1782
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
1742
1783
  }
1784
+
1785
+ setHeaders(obj, valueOrRewrite);
1743
1786
  } else {
1744
1787
  header != null && setHeader(valueOrRewrite, header, rewrite);
1745
1788
  }
@@ -1881,6 +1924,10 @@ class AxiosHeaders {
1881
1924
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1882
1925
  }
1883
1926
 
1927
+ getSetCookie() {
1928
+ return this.get("set-cookie") || [];
1929
+ }
1930
+
1884
1931
  get [Symbol.toStringTag]() {
1885
1932
  return 'AxiosHeaders';
1886
1933
  }
@@ -2083,7 +2130,7 @@ function throttle(fn, freq) {
2083
2130
  clearTimeout(timer);
2084
2131
  timer = null;
2085
2132
  }
2086
- fn.apply(null, args);
2133
+ fn(...args);
2087
2134
  };
2088
2135
 
2089
2136
  const throttled = (...args) => {
@@ -2148,68 +2195,18 @@ const progressEventDecorator = (total, throttled) => {
2148
2195
 
2149
2196
  const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
2150
2197
 
2151
- var isURLSameOrigin = platform.hasStandardBrowserEnv ?
2152
-
2153
- // Standard browser envs have full support of the APIs needed to test
2154
- // whether the request URL is of the same origin as current location.
2155
- (function standardBrowserEnv() {
2156
- const msie = /(msie|trident)/i.test(navigator.userAgent);
2157
- const urlParsingNode = document.createElement('a');
2158
- let originURL;
2159
-
2160
- /**
2161
- * Parse a URL to discover its components
2162
- *
2163
- * @param {String} url The URL to be parsed
2164
- * @returns {Object}
2165
- */
2166
- function resolveURL(url) {
2167
- let href = url;
2168
-
2169
- if (msie) {
2170
- // IE needs attribute set twice to normalize properties
2171
- urlParsingNode.setAttribute('href', href);
2172
- href = urlParsingNode.href;
2173
- }
2174
-
2175
- urlParsingNode.setAttribute('href', href);
2176
-
2177
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2178
- return {
2179
- href: urlParsingNode.href,
2180
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2181
- host: urlParsingNode.host,
2182
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2183
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2184
- hostname: urlParsingNode.hostname,
2185
- port: urlParsingNode.port,
2186
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
2187
- urlParsingNode.pathname :
2188
- '/' + urlParsingNode.pathname
2189
- };
2190
- }
2198
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
2199
+ url = new URL(url, platform.origin);
2191
2200
 
2192
- originURL = resolveURL(window.location.href);
2193
-
2194
- /**
2195
- * Determine if a URL shares the same origin as the current location
2196
- *
2197
- * @param {String} requestURL The URL to test
2198
- * @returns {boolean} True if URL shares the same origin, otherwise false
2199
- */
2200
- return function isURLSameOrigin(requestURL) {
2201
- const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2202
- return (parsed.protocol === originURL.protocol &&
2203
- parsed.host === originURL.host);
2204
- };
2205
- })() :
2206
-
2207
- // Non standard browser envs (web workers, react-native) lack needed support.
2208
- (function nonStandardBrowserEnv() {
2209
- return function isURLSameOrigin() {
2210
- return true;
2211
- };
2212
- })();
2201
+ return (
2202
+ origin.protocol === url.protocol &&
2203
+ origin.host === url.host &&
2204
+ (isMSIE || origin.port === url.port)
2205
+ );
2206
+ })(
2207
+ new URL(platform.origin),
2208
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
2209
+ ) : () => true;
2213
2210
 
2214
2211
  var cookies = platform.hasStandardBrowserEnv ?
2215
2212
 
@@ -2288,8 +2285,9 @@ function combineURLs(baseURL, relativeURL) {
2288
2285
  *
2289
2286
  * @returns {string} The combined full path
2290
2287
  */
2291
- function buildFullPath(baseURL, requestedURL) {
2292
- if (baseURL && !isAbsoluteURL(requestedURL)) {
2288
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2289
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
2290
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2293
2291
  return combineURLs(baseURL, requestedURL);
2294
2292
  }
2295
2293
  return requestedURL;
@@ -2311,7 +2309,7 @@ function mergeConfig(config1, config2) {
2311
2309
  config2 = config2 || {};
2312
2310
  const config = {};
2313
2311
 
2314
- function getMergedValue(target, source, caseless) {
2312
+ function getMergedValue(target, source, prop, caseless) {
2315
2313
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2316
2314
  return utils$1.merge.call({caseless}, target, source);
2317
2315
  } else if (utils$1.isPlainObject(source)) {
@@ -2323,11 +2321,11 @@ function mergeConfig(config1, config2) {
2323
2321
  }
2324
2322
 
2325
2323
  // eslint-disable-next-line consistent-return
2326
- function mergeDeepProperties(a, b, caseless) {
2324
+ function mergeDeepProperties(a, b, prop , caseless) {
2327
2325
  if (!utils$1.isUndefined(b)) {
2328
- return getMergedValue(a, b, caseless);
2326
+ return getMergedValue(a, b, prop , caseless);
2329
2327
  } else if (!utils$1.isUndefined(a)) {
2330
- return getMergedValue(undefined, a, caseless);
2328
+ return getMergedValue(undefined, a, prop , caseless);
2331
2329
  }
2332
2330
  }
2333
2331
 
@@ -2385,10 +2383,10 @@ function mergeConfig(config1, config2) {
2385
2383
  socketPath: defaultToConfig2,
2386
2384
  responseEncoding: defaultToConfig2,
2387
2385
  validateStatus: mergeDirectKeys,
2388
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2386
+ headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
2389
2387
  };
2390
2388
 
2391
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2389
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
2392
2390
  const merge = mergeMap[prop] || mergeDeepProperties;
2393
2391
  const configValue = merge(config1[prop], config2[prop], prop);
2394
2392
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -2404,7 +2402,7 @@ var resolveConfig = (config) => {
2404
2402
 
2405
2403
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
2406
2404
 
2407
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
2405
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
2408
2406
 
2409
2407
  // HTTP basic authentication
2410
2408
  if (auth) {
@@ -2633,45 +2631,46 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2633
2631
  };
2634
2632
 
2635
2633
  const composeSignals = (signals, timeout) => {
2636
- let controller = new AbortController();
2634
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
2637
2635
 
2638
- let aborted;
2636
+ if (timeout || length) {
2637
+ let controller = new AbortController();
2639
2638
 
2640
- const onabort = function (cancel) {
2641
- if (!aborted) {
2642
- aborted = true;
2643
- unsubscribe();
2644
- const err = cancel instanceof Error ? cancel : this.reason;
2645
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
2646
- }
2647
- };
2639
+ let aborted;
2648
2640
 
2649
- let timer = timeout && setTimeout(() => {
2650
- onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
2651
- }, timeout);
2641
+ const onabort = function (reason) {
2642
+ if (!aborted) {
2643
+ aborted = true;
2644
+ unsubscribe();
2645
+ const err = reason instanceof Error ? reason : this.reason;
2646
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
2647
+ }
2648
+ };
2652
2649
 
2653
- const unsubscribe = () => {
2654
- if (signals) {
2655
- timer && clearTimeout(timer);
2650
+ let timer = timeout && setTimeout(() => {
2656
2651
  timer = null;
2657
- signals.forEach(signal => {
2658
- signal &&
2659
- (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
2660
- });
2661
- signals = null;
2662
- }
2663
- };
2652
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
2653
+ }, timeout);
2654
+
2655
+ const unsubscribe = () => {
2656
+ if (signals) {
2657
+ timer && clearTimeout(timer);
2658
+ timer = null;
2659
+ signals.forEach(signal => {
2660
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
2661
+ });
2662
+ signals = null;
2663
+ }
2664
+ };
2664
2665
 
2665
- signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
2666
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
2666
2667
 
2667
- const {signal} = controller;
2668
+ const {signal} = controller;
2668
2669
 
2669
- signal.unsubscribe = unsubscribe;
2670
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
2670
2671
 
2671
- return [signal, () => {
2672
- timer && clearTimeout(timer);
2673
- timer = null;
2674
- }];
2672
+ return signal;
2673
+ }
2675
2674
  };
2676
2675
 
2677
2676
  var composeSignals$1 = composeSignals;
@@ -2694,14 +2693,34 @@ const streamChunk = function* (chunk, chunkSize) {
2694
2693
  }
2695
2694
  };
2696
2695
 
2697
- const readBytes = async function* (iterable, chunkSize, encode) {
2698
- for await (const chunk of iterable) {
2699
- yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
2696
+ const readBytes = async function* (iterable, chunkSize) {
2697
+ for await (const chunk of readStream(iterable)) {
2698
+ yield* streamChunk(chunk, chunkSize);
2700
2699
  }
2701
2700
  };
2702
2701
 
2703
- const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
2704
- const iterator = readBytes(stream, chunkSize, encode);
2702
+ const readStream = async function* (stream) {
2703
+ if (stream[Symbol.asyncIterator]) {
2704
+ yield* stream;
2705
+ return;
2706
+ }
2707
+
2708
+ const reader = stream.getReader();
2709
+ try {
2710
+ for (;;) {
2711
+ const {done, value} = await reader.read();
2712
+ if (done) {
2713
+ break;
2714
+ }
2715
+ yield value;
2716
+ }
2717
+ } finally {
2718
+ await reader.cancel();
2719
+ }
2720
+ };
2721
+
2722
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
2723
+ const iterator = readBytes(stream, chunkSize);
2705
2724
 
2706
2725
  let bytes = 0;
2707
2726
  let done;
@@ -2804,7 +2823,11 @@ const getBodyLength = async (body) => {
2804
2823
  }
2805
2824
 
2806
2825
  if(utils$1.isSpecCompliantForm(body)) {
2807
- return (await new Request(body).arrayBuffer()).byteLength;
2826
+ const _request = new Request(platform.origin, {
2827
+ method: 'POST',
2828
+ body,
2829
+ });
2830
+ return (await _request.arrayBuffer()).byteLength;
2808
2831
  }
2809
2832
 
2810
2833
  if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
@@ -2844,18 +2867,13 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2844
2867
 
2845
2868
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
2846
2869
 
2847
- let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
2848
- composeSignals$1([signal, cancelToken], timeout) : [];
2849
-
2850
- let finished, request;
2870
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2851
2871
 
2852
- const onFinish = () => {
2853
- !finished && setTimeout(() => {
2854
- composedSignal && composedSignal.unsubscribe();
2855
- });
2872
+ let request;
2856
2873
 
2857
- finished = true;
2858
- };
2874
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2875
+ composedSignal.unsubscribe();
2876
+ });
2859
2877
 
2860
2878
  let requestContentLength;
2861
2879
 
@@ -2882,7 +2900,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2882
2900
  progressEventReducer(asyncDecorator(onUploadProgress))
2883
2901
  );
2884
2902
 
2885
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
2903
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2886
2904
  }
2887
2905
  }
2888
2906
 
@@ -2890,6 +2908,9 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2890
2908
  withCredentials = withCredentials ? 'include' : 'omit';
2891
2909
  }
2892
2910
 
2911
+ // Cloudflare Workers throws when credentials are defined
2912
+ // see https://github.com/cloudflare/workerd/issues/902
2913
+ const isCredentialsSupported = "credentials" in Request.prototype;
2893
2914
  request = new Request(url, {
2894
2915
  ...fetchOptions,
2895
2916
  signal: composedSignal,
@@ -2897,14 +2918,14 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2897
2918
  headers: headers.normalize().toJSON(),
2898
2919
  body: data,
2899
2920
  duplex: "half",
2900
- credentials: withCredentials
2921
+ credentials: isCredentialsSupported ? withCredentials : undefined
2901
2922
  });
2902
2923
 
2903
- let response = await fetch(request);
2924
+ let response = await fetch(request, fetchOptions);
2904
2925
 
2905
2926
  const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2906
2927
 
2907
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
2928
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
2908
2929
  const options = {};
2909
2930
 
2910
2931
  ['status', 'statusText', 'headers'].forEach(prop => {
@@ -2921,8 +2942,8 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2921
2942
  response = new Response(
2922
2943
  trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2923
2944
  flush && flush();
2924
- isStreamResponse && onFinish();
2925
- }, encodeText),
2945
+ unsubscribe && unsubscribe();
2946
+ }),
2926
2947
  options
2927
2948
  );
2928
2949
  }
@@ -2931,9 +2952,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2931
2952
 
2932
2953
  let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
2933
2954
 
2934
- !isStreamResponse && onFinish();
2935
-
2936
- stopTimeout && stopTimeout();
2955
+ !isStreamResponse && unsubscribe && unsubscribe();
2937
2956
 
2938
2957
  return await new Promise((resolve, reject) => {
2939
2958
  settle(resolve, reject, {
@@ -2946,9 +2965,9 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2946
2965
  });
2947
2966
  })
2948
2967
  } catch (err) {
2949
- onFinish();
2968
+ unsubscribe && unsubscribe();
2950
2969
 
2951
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
2970
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2952
2971
  throw Object.assign(
2953
2972
  new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
2954
2973
  {
@@ -3108,7 +3127,7 @@ function dispatchRequest(config) {
3108
3127
  });
3109
3128
  }
3110
3129
 
3111
- const VERSION = "1.7.4";
3130
+ const VERSION = "1.11.0";
3112
3131
 
3113
3132
  const validators$1 = {};
3114
3133
 
@@ -3159,6 +3178,14 @@ validators$1.transitional = function transitional(validator, version, message) {
3159
3178
  };
3160
3179
  };
3161
3180
 
3181
+ validators$1.spelling = function spelling(correctSpelling) {
3182
+ return (value, opt) => {
3183
+ // eslint-disable-next-line no-console
3184
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
3185
+ return true;
3186
+ }
3187
+ };
3188
+
3162
3189
  /**
3163
3190
  * Assert object's properties type
3164
3191
  *
@@ -3208,7 +3235,7 @@ const validators = validator.validators;
3208
3235
  */
3209
3236
  class Axios {
3210
3237
  constructor(instanceConfig) {
3211
- this.defaults = instanceConfig;
3238
+ this.defaults = instanceConfig || {};
3212
3239
  this.interceptors = {
3213
3240
  request: new InterceptorManager$1(),
3214
3241
  response: new InterceptorManager$1()
@@ -3228,9 +3255,9 @@ class Axios {
3228
3255
  return await this._request(configOrUrl, config);
3229
3256
  } catch (err) {
3230
3257
  if (err instanceof Error) {
3231
- let dummy;
3258
+ let dummy = {};
3232
3259
 
3233
- Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
3260
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
3234
3261
 
3235
3262
  // slice off the Error: ... line
3236
3263
  const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
@@ -3285,6 +3312,18 @@ class Axios {
3285
3312
  }
3286
3313
  }
3287
3314
 
3315
+ // Set config.allowAbsoluteUrls
3316
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
3317
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
3318
+ } else {
3319
+ config.allowAbsoluteUrls = true;
3320
+ }
3321
+
3322
+ validator.assertOptions(config, {
3323
+ baseUrl: validators.spelling('baseURL'),
3324
+ withXsrfToken: validators.spelling('withXSRFToken')
3325
+ }, true);
3326
+
3288
3327
  // Set config.method
3289
3328
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3290
3329
 
@@ -3327,8 +3366,8 @@ class Axios {
3327
3366
 
3328
3367
  if (!synchronousRequestInterceptors) {
3329
3368
  const chain = [dispatchRequest.bind(this), undefined];
3330
- chain.unshift.apply(chain, requestInterceptorChain);
3331
- chain.push.apply(chain, responseInterceptorChain);
3369
+ chain.unshift(...requestInterceptorChain);
3370
+ chain.push(...responseInterceptorChain);
3332
3371
  len = chain.length;
3333
3372
 
3334
3373
  promise = Promise.resolve(config);
@@ -3375,7 +3414,7 @@ class Axios {
3375
3414
 
3376
3415
  getUri(config) {
3377
3416
  config = mergeConfig(this.defaults, config);
3378
- const fullPath = buildFullPath(config.baseURL, config.url);
3417
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
3379
3418
  return buildURL(fullPath, config.params, config.paramsSerializer);
3380
3419
  }
3381
3420
  }
@@ -3515,6 +3554,20 @@ class CancelToken {
3515
3554
  }
3516
3555
  }
3517
3556
 
3557
+ toAbortSignal() {
3558
+ const controller = new AbortController();
3559
+
3560
+ const abort = (err) => {
3561
+ controller.abort(err);
3562
+ };
3563
+
3564
+ this.subscribe(abort);
3565
+
3566
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
3567
+
3568
+ return controller.signal;
3569
+ }
3570
+
3518
3571
  /**
3519
3572
  * Returns an object that contains a new `CancelToken` and a function that, when called,
3520
3573
  * cancels the `CancelToken`.