@aslaluroba/help-center-react 3.0.18 → 3.0.20

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.
@@ -262,7 +262,7 @@ var isUndefined = typeOfTest('undefined');
262
262
  * @returns {boolean} True if value is a Buffer, otherwise false
263
263
  */
264
264
  function isBuffer(val) {
265
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
265
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
266
266
  }
267
267
 
268
268
  /**
@@ -306,7 +306,7 @@ var isString = typeOfTest('string');
306
306
  * @param {*} val The value to test
307
307
  * @returns {boolean} True if value is a Function, otherwise false
308
308
  */
309
- var isFunction = typeOfTest('function');
309
+ var isFunction$1 = typeOfTest('function');
310
310
 
311
311
  /**
312
312
  * Determine if a value is a Number
@@ -412,7 +412,7 @@ var isFileList = kindOfTest('FileList');
412
412
  *
413
413
  * @returns {boolean} True if value is a Stream, otherwise false
414
414
  */
415
- var isStream = val => isObject(val) && isFunction(val.pipe);
415
+ var isStream = val => isObject(val) && isFunction$1(val.pipe);
416
416
 
417
417
  /**
418
418
  * Determine if a value is a FormData
@@ -423,9 +423,9 @@ var isStream = val => isObject(val) && isFunction(val.pipe);
423
423
  */
424
424
  var isFormData = thing => {
425
425
  var kind;
426
- return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
426
+ return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
427
427
  // detect form-data instance
428
- kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]'));
428
+ kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
429
429
  };
430
430
 
431
431
  /**
@@ -543,7 +543,8 @@ var isContextDefined = context => !isUndefined(context) && context !== _global;
543
543
  function merge(/* obj1, obj2, obj3, ... */
544
544
  ) {
545
545
  var {
546
- caseless
546
+ caseless,
547
+ skipUndefined
547
548
  } = isContextDefined(this) && this || {};
548
549
  var result = {};
549
550
  var assignValue = (val, key) => {
@@ -554,7 +555,7 @@ function merge(/* obj1, obj2, obj3, ... */
554
555
  result[targetKey] = merge({}, val);
555
556
  } else if (isArray(val)) {
556
557
  result[targetKey] = val.slice();
557
- } else {
558
+ } else if (!skipUndefined || !isUndefined(val)) {
558
559
  result[targetKey] = val;
559
560
  }
560
561
  };
@@ -579,7 +580,7 @@ var extend = function extend(a, b, thisArg) {
579
580
  allOwnKeys
580
581
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
581
582
  forEach(b, (val, key) => {
582
- if (thisArg && isFunction(val)) {
583
+ if (thisArg && isFunction$1(val)) {
583
584
  a[key] = bind(val, thisArg);
584
585
  } else {
585
586
  a[key] = val;
@@ -787,11 +788,11 @@ var reduceDescriptors = (obj, reducer) => {
787
788
  var freezeMethods = obj => {
788
789
  reduceDescriptors(obj, (descriptor, name) => {
789
790
  // skip restricted props in strict mode
790
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
791
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
791
792
  return false;
792
793
  }
793
794
  var value = obj[name];
794
- if (!isFunction(value)) return;
795
+ if (!isFunction$1(value)) return;
795
796
  descriptor.enumerable = false;
796
797
  if ('writable' in descriptor) {
797
798
  descriptor.writable = false;
@@ -827,7 +828,7 @@ var toFiniteNumber = (value, defaultValue) => {
827
828
  * @returns {boolean}
828
829
  */
829
830
  function isSpecCompliantForm(thing) {
830
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
831
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
831
832
  }
832
833
  var toJSONObject = obj => {
833
834
  var stack = new Array(10);
@@ -857,7 +858,7 @@ var toJSONObject = obj => {
857
858
  return visit(obj, 0);
858
859
  };
859
860
  var isAsyncFn = kindOfTest('AsyncFunction');
860
- var isThenable = thing => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
861
+ var isThenable = thing => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
861
862
 
862
863
  // original code
863
864
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -881,12 +882,12 @@ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
881
882
  _global.postMessage(token, "*");
882
883
  };
883
884
  })("axios@".concat(Math.random()), []) : cb => setTimeout(cb);
884
- })(typeof setImmediate === 'function', isFunction(_global.postMessage));
885
+ })(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
885
886
  var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
886
887
 
887
888
  // *********************
888
889
 
889
- var isIterable = thing => thing != null && isFunction(thing[iterator]);
890
+ var isIterable = thing => thing != null && isFunction$1(thing[iterator]);
890
891
  var utils$1 = {
891
892
  isArray,
892
893
  isArrayBuffer,
@@ -908,7 +909,7 @@ var utils$1 = {
908
909
  isFile,
909
910
  isBlob,
910
911
  isRegExp,
911
- isFunction,
912
+ isFunction: isFunction$1,
912
913
  isStream,
913
914
  isURLSearchParams,
914
915
  isTypedArray,
@@ -1019,9 +1020,20 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
1019
1020
  }, prop => {
1020
1021
  return prop !== 'isAxiosError';
1021
1022
  });
1022
- AxiosError.call(axiosError, error.message, code, config, request, response);
1023
- axiosError.cause = error;
1024
- axiosError.name = error.name;
1023
+ var msg = error && error.message ? error.message : 'Error';
1024
+
1025
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
1026
+ var errCode = code == null && error ? error.code : code;
1027
+ AxiosError.call(axiosError, msg, errCode, config, request, response);
1028
+
1029
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
1030
+ if (error && axiosError.cause == null) {
1031
+ Object.defineProperty(axiosError, 'cause', {
1032
+ value: error,
1033
+ configurable: true
1034
+ });
1035
+ }
1036
+ axiosError.name = error && error.name || 'Error';
1025
1037
  customProps && Object.assign(axiosError, customProps);
1026
1038
  return axiosError;
1027
1039
  };
@@ -1269,7 +1281,7 @@ prototype.toString = function toString(encoder) {
1269
1281
  * @returns {string} The encoded value.
1270
1282
  */
1271
1283
  function encode(val) {
1272
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
1284
+ return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
1273
1285
  }
1274
1286
 
1275
1287
  /**
@@ -1613,7 +1625,7 @@ var defaults = {
1613
1625
  var silentJSONParsing = transitional && transitional.silentJSONParsing;
1614
1626
  var strictJSONParsing = !silentJSONParsing && JSONRequested;
1615
1627
  try {
1616
- return JSON.parse(data);
1628
+ return JSON.parse(data, this.parseReviver);
1617
1629
  } catch (e) {
1618
1630
  if (strictJSONParsing) {
1619
1631
  if (e.name === 'SyntaxError') {
@@ -2322,14 +2334,20 @@ var resolveConfig = config => {
2322
2334
  if (auth) {
2323
2335
  headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
2324
2336
  }
2325
- var contentType;
2326
2337
  if (utils$1.isFormData(data)) {
2327
2338
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2328
- headers.setContentType(undefined); // Let the browser set it
2329
- } else if ((contentType = headers.getContentType()) !== false) {
2330
- // fix semicolon duplication issue for ReactNative FormData implementation
2331
- var [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
2332
- headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
2339
+ headers.setContentType(undefined); // browser handles it
2340
+ } else if (utils$1.isFunction(data.getHeaders)) {
2341
+ // Node.js FormData (like form-data package)
2342
+ var formHeaders = data.getHeaders();
2343
+ // Only set safe headers to avoid overwriting security headers
2344
+ var allowedHeaders = ['content-type', 'content-length'];
2345
+ Object.entries(formHeaders).forEach(_ref => {
2346
+ var [key, val] = _ref;
2347
+ if (allowedHeaders.includes(key.toLowerCase())) {
2348
+ headers.set(key, val);
2349
+ }
2350
+ });
2333
2351
  }
2334
2352
  }
2335
2353
 
@@ -2437,12 +2455,15 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2437
2455
  };
2438
2456
 
2439
2457
  // Handle low level network errors
2440
- request.onerror = function handleError() {
2441
- // Real errors are hidden from us by the browser
2442
- // onerror should only fire if it's a network error
2443
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2444
-
2445
- // Clean up request
2458
+ request.onerror = function handleError(event) {
2459
+ // Browsers deliver a ProgressEvent in XHR onerror
2460
+ // (message may be empty; when present, surface it)
2461
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
2462
+ var msg = event && event.message ? event.message : 'Network Error';
2463
+ var err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
2464
+ // attach the underlying event for consumers who want details
2465
+ err.event = event || null;
2466
+ reject(err);
2446
2467
  request = null;
2447
2468
  };
2448
2469
 
@@ -2672,18 +2693,24 @@ var trackStream = (stream, chunkSize, onProgress, onFinish) => {
2672
2693
  });
2673
2694
  };
2674
2695
 
2675
- var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
2676
- var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
2677
-
2678
- // used only inside the fetch adapter
2679
- var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? (encoder => str => encoder.encode(str))(new TextEncoder()) : (/*#__PURE__*/function () {
2680
- var _ref = _asyncToGenerator(function* (str) {
2681
- return new Uint8Array(yield new Response(str).arrayBuffer());
2682
- });
2683
- return function (_x) {
2684
- return _ref.apply(this, arguments);
2696
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
2697
+ var {
2698
+ isFunction
2699
+ } = utils$1;
2700
+ var globalFetchAPI = (_ref => {
2701
+ var {
2702
+ Request,
2703
+ Response
2704
+ } = _ref;
2705
+ return {
2706
+ Request,
2707
+ Response
2685
2708
  };
2686
- }()));
2709
+ })(utils$1.global);
2710
+ var {
2711
+ ReadableStream: ReadableStream$1,
2712
+ TextEncoder
2713
+ } = utils$1.global;
2687
2714
  var test = function test(fn) {
2688
2715
  try {
2689
2716
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -2694,168 +2721,223 @@ var test = function test(fn) {
2694
2721
  return false;
2695
2722
  }
2696
2723
  };
2697
- var supportsRequestStream = isReadableStreamSupported && test(() => {
2698
- var duplexAccessed = false;
2699
- var hasContentType = new Request(platform.origin, {
2700
- body: new ReadableStream(),
2701
- method: 'POST',
2702
- get duplex() {
2703
- duplexAccessed = true;
2704
- return 'half';
2705
- }
2706
- }).headers.has('Content-Type');
2707
- return duplexAccessed && !hasContentType;
2708
- });
2709
- var DEFAULT_CHUNK_SIZE = 64 * 1024;
2710
- var supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response('').body));
2711
- var resolvers = {
2712
- stream: supportsResponseStream && (res => res.body)
2713
- };
2714
- isFetchSupported && (res => {
2715
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2716
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? res => res[type]() : (_, config) => {
2717
- throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
2724
+ var factory = env => {
2725
+ env = utils$1.merge.call({
2726
+ skipUndefined: true
2727
+ }, globalFetchAPI, env);
2728
+ var {
2729
+ fetch: envFetch,
2730
+ Request,
2731
+ Response
2732
+ } = env;
2733
+ var isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
2734
+ var isRequestSupported = isFunction(Request);
2735
+ var isResponseSupported = isFunction(Response);
2736
+ if (!isFetchSupported) {
2737
+ return false;
2738
+ }
2739
+ var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
2740
+ var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? (encoder => str => encoder.encode(str))(new TextEncoder()) : (/*#__PURE__*/function () {
2741
+ var _ref2 = _asyncToGenerator(function* (str) {
2742
+ return new Uint8Array(yield new Request(str).arrayBuffer());
2718
2743
  });
2744
+ return function (_x) {
2745
+ return _ref2.apply(this, arguments);
2746
+ };
2747
+ }()));
2748
+ var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
2749
+ var duplexAccessed = false;
2750
+ var hasContentType = new Request(platform.origin, {
2751
+ body: new ReadableStream$1(),
2752
+ method: 'POST',
2753
+ get duplex() {
2754
+ duplexAccessed = true;
2755
+ return 'half';
2756
+ }
2757
+ }).headers.has('Content-Type');
2758
+ return duplexAccessed && !hasContentType;
2719
2759
  });
2720
- })(new Response());
2721
- var getBodyLength = /*#__PURE__*/function () {
2722
- var _ref2 = _asyncToGenerator(function* (body) {
2723
- if (body == null) {
2724
- return 0;
2725
- }
2726
- if (utils$1.isBlob(body)) {
2727
- return body.size;
2728
- }
2729
- if (utils$1.isSpecCompliantForm(body)) {
2730
- var _request = new Request(platform.origin, {
2731
- method: 'POST',
2732
- body
2733
- });
2734
- return (yield _request.arrayBuffer()).byteLength;
2735
- }
2736
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2737
- return body.byteLength;
2738
- }
2739
- if (utils$1.isURLSearchParams(body)) {
2740
- body = body + '';
2741
- }
2742
- if (utils$1.isString(body)) {
2743
- return (yield encodeText(body)).byteLength;
2744
- }
2745
- });
2746
- return function getBodyLength(_x2) {
2747
- return _ref2.apply(this, arguments);
2748
- };
2749
- }();
2750
- var resolveBodyLength = /*#__PURE__*/function () {
2751
- var _ref3 = _asyncToGenerator(function* (headers, body) {
2752
- var length = utils$1.toFiniteNumber(headers.getContentLength());
2753
- return length == null ? getBodyLength(body) : length;
2754
- });
2755
- return function resolveBodyLength(_x3, _x4) {
2756
- return _ref3.apply(this, arguments);
2760
+ var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response('').body));
2761
+ var resolvers = {
2762
+ stream: supportsResponseStream && (res => res.body)
2757
2763
  };
2758
- }();
2759
- var fetchAdapter = isFetchSupported && (/*#__PURE__*/function () {
2760
- var _ref4 = _asyncToGenerator(function* (config) {
2761
- var {
2762
- url,
2763
- method,
2764
- data,
2765
- signal,
2766
- cancelToken,
2767
- timeout,
2768
- onDownloadProgress,
2769
- onUploadProgress,
2770
- responseType,
2771
- headers,
2772
- withCredentials = 'same-origin',
2773
- fetchOptions
2774
- } = resolveConfig(config);
2775
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
2776
- var composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2777
- var request;
2778
- var unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2779
- composedSignal.unsubscribe();
2764
+ isFetchSupported && (() => {
2765
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2766
+ !resolvers[type] && (resolvers[type] = (res, config) => {
2767
+ var method = res && res[type];
2768
+ if (method) {
2769
+ return method.call(res);
2770
+ }
2771
+ throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
2772
+ });
2780
2773
  });
2781
- var requestContentLength;
2782
- try {
2783
- if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && (requestContentLength = yield resolveBodyLength(headers, data)) !== 0) {
2784
- var _request = new Request(url, {
2774
+ })();
2775
+ var getBodyLength = /*#__PURE__*/function () {
2776
+ var _ref3 = _asyncToGenerator(function* (body) {
2777
+ if (body == null) {
2778
+ return 0;
2779
+ }
2780
+ if (utils$1.isBlob(body)) {
2781
+ return body.size;
2782
+ }
2783
+ if (utils$1.isSpecCompliantForm(body)) {
2784
+ var _request = new Request(platform.origin, {
2785
2785
  method: 'POST',
2786
- body: data,
2787
- duplex: "half"
2786
+ body
2788
2787
  });
2789
- var contentTypeHeader;
2790
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
2791
- headers.setContentType(contentTypeHeader);
2792
- }
2793
- if (_request.body) {
2794
- var [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
2795
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2796
- }
2788
+ return (yield _request.arrayBuffer()).byteLength;
2789
+ }
2790
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2791
+ return body.byteLength;
2797
2792
  }
2798
- if (!utils$1.isString(withCredentials)) {
2799
- withCredentials = withCredentials ? 'include' : 'omit';
2793
+ if (utils$1.isURLSearchParams(body)) {
2794
+ body = body + '';
2800
2795
  }
2796
+ if (utils$1.isString(body)) {
2797
+ return (yield encodeText(body)).byteLength;
2798
+ }
2799
+ });
2800
+ return function getBodyLength(_x2) {
2801
+ return _ref3.apply(this, arguments);
2802
+ };
2803
+ }();
2804
+ var resolveBodyLength = /*#__PURE__*/function () {
2805
+ var _ref4 = _asyncToGenerator(function* (headers, body) {
2806
+ var length = utils$1.toFiniteNumber(headers.getContentLength());
2807
+ return length == null ? getBodyLength(body) : length;
2808
+ });
2809
+ return function resolveBodyLength(_x3, _x4) {
2810
+ return _ref4.apply(this, arguments);
2811
+ };
2812
+ }();
2813
+ return /*#__PURE__*/function () {
2814
+ var _ref5 = _asyncToGenerator(function* (config) {
2815
+ var {
2816
+ url,
2817
+ method,
2818
+ data,
2819
+ signal,
2820
+ cancelToken,
2821
+ timeout,
2822
+ onDownloadProgress,
2823
+ onUploadProgress,
2824
+ responseType,
2825
+ headers,
2826
+ withCredentials = 'same-origin',
2827
+ fetchOptions
2828
+ } = resolveConfig(config);
2829
+ var _fetch = envFetch || fetch;
2830
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
2831
+ var composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2832
+ var request = null;
2833
+ var unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2834
+ composedSignal.unsubscribe();
2835
+ });
2836
+ var requestContentLength;
2837
+ try {
2838
+ if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && (requestContentLength = yield resolveBodyLength(headers, data)) !== 0) {
2839
+ var _request = new Request(url, {
2840
+ method: 'POST',
2841
+ body: data,
2842
+ duplex: "half"
2843
+ });
2844
+ var contentTypeHeader;
2845
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
2846
+ headers.setContentType(contentTypeHeader);
2847
+ }
2848
+ if (_request.body) {
2849
+ var [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
2850
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2851
+ }
2852
+ }
2853
+ if (!utils$1.isString(withCredentials)) {
2854
+ withCredentials = withCredentials ? 'include' : 'omit';
2855
+ }
2801
2856
 
2802
- // Cloudflare Workers throws when credentials are defined
2803
- // see https://github.com/cloudflare/workerd/issues/902
2804
- var isCredentialsSupported = "credentials" in Request.prototype;
2805
- request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
2806
- signal: composedSignal,
2807
- method: method.toUpperCase(),
2808
- headers: headers.normalize().toJSON(),
2809
- body: data,
2810
- duplex: "half",
2811
- credentials: isCredentialsSupported ? withCredentials : undefined
2812
- }));
2813
- var response = yield fetch(request, fetchOptions);
2814
- var isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2815
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
2816
- var options = {};
2817
- ['status', 'statusText', 'headers'].forEach(prop => {
2818
- options[prop] = response[prop];
2819
- });
2820
- var responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
2821
- var [_onProgress, _flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
2822
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, () => {
2823
- _flush && _flush();
2824
- unsubscribe && unsubscribe();
2825
- }), options);
2826
- }
2827
- responseType = responseType || 'text';
2828
- var responseData = yield resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
2829
- !isStreamResponse && unsubscribe && unsubscribe();
2830
- return yield new Promise((resolve, reject) => {
2831
- settle(resolve, reject, {
2832
- data: responseData,
2833
- headers: AxiosHeaders$1.from(response.headers),
2834
- status: response.status,
2835
- statusText: response.statusText,
2836
- config,
2837
- request
2857
+ // Cloudflare Workers throws when credentials are defined
2858
+ // see https://github.com/cloudflare/workerd/issues/902
2859
+ var isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
2860
+ var resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
2861
+ signal: composedSignal,
2862
+ method: method.toUpperCase(),
2863
+ headers: headers.normalize().toJSON(),
2864
+ body: data,
2865
+ duplex: "half",
2866
+ credentials: isCredentialsSupported ? withCredentials : undefined
2838
2867
  });
2839
- });
2840
- } catch (err) {
2841
- unsubscribe && unsubscribe();
2842
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2843
- throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
2844
- cause: err.cause || err
2868
+ request = isRequestSupported && new Request(url, resolvedOptions);
2869
+ var response = yield isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
2870
+ var isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2871
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
2872
+ var options = {};
2873
+ ['status', 'statusText', 'headers'].forEach(prop => {
2874
+ options[prop] = response[prop];
2875
+ });
2876
+ var responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
2877
+ var [_onProgress, _flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
2878
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, () => {
2879
+ _flush && _flush();
2880
+ unsubscribe && unsubscribe();
2881
+ }), options);
2882
+ }
2883
+ responseType = responseType || 'text';
2884
+ var responseData = yield resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
2885
+ !isStreamResponse && unsubscribe && unsubscribe();
2886
+ return yield new Promise((resolve, reject) => {
2887
+ settle(resolve, reject, {
2888
+ data: responseData,
2889
+ headers: AxiosHeaders$1.from(response.headers),
2890
+ status: response.status,
2891
+ statusText: response.statusText,
2892
+ config,
2893
+ request
2894
+ });
2845
2895
  });
2896
+ } catch (err) {
2897
+ unsubscribe && unsubscribe();
2898
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2899
+ throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
2900
+ cause: err.cause || err
2901
+ });
2902
+ }
2903
+ throw AxiosError.from(err, err && err.code, config, request);
2846
2904
  }
2847
- throw AxiosError.from(err, err && err.code, config, request);
2848
- }
2849
- });
2850
- return function (_x5) {
2851
- return _ref4.apply(this, arguments);
2852
- };
2853
- }());
2905
+ });
2906
+ return function (_x5) {
2907
+ return _ref5.apply(this, arguments);
2908
+ };
2909
+ }();
2910
+ };
2911
+ var seedCache = new Map();
2912
+ var getFetch = config => {
2913
+ var env = config ? config.env : {};
2914
+ var {
2915
+ fetch,
2916
+ Request,
2917
+ Response
2918
+ } = env;
2919
+ var seeds = [Request, Response, fetch];
2920
+ var len = seeds.length,
2921
+ i = len,
2922
+ seed,
2923
+ target,
2924
+ map = seedCache;
2925
+ while (i--) {
2926
+ seed = seeds[i];
2927
+ target = map.get(seed);
2928
+ target === undefined && map.set(seed, target = i ? new Map() : factory(env));
2929
+ map = target;
2930
+ }
2931
+ return target;
2932
+ };
2933
+ getFetch();
2854
2934
 
2855
2935
  var knownAdapters = {
2856
2936
  http: httpAdapter,
2857
2937
  xhr: xhrAdapter,
2858
- fetch: fetchAdapter
2938
+ fetch: {
2939
+ get: getFetch
2940
+ }
2859
2941
  };
2860
2942
  utils$1.forEach(knownAdapters, (fn, value) => {
2861
2943
  if (fn) {
@@ -2874,7 +2956,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
2874
2956
  var renderReason = reason => "- ".concat(reason);
2875
2957
  var isResolvedHandle = adapter => utils$1.isFunction(adapter) || adapter === null || adapter === false;
2876
2958
  var adapters = {
2877
- getAdapter: adapters => {
2959
+ getAdapter: (adapters, config) => {
2878
2960
  adapters = utils$1.isArray(adapters) ? adapters : [adapters];
2879
2961
  var {
2880
2962
  length
@@ -2892,7 +2974,7 @@ var adapters = {
2892
2974
  throw new AxiosError("Unknown adapter '".concat(id, "'"));
2893
2975
  }
2894
2976
  }
2895
- if (adapter) {
2977
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
2896
2978
  break;
2897
2979
  }
2898
2980
  rejectedReasons[id || '#' + i] = adapter;
@@ -2942,7 +3024,7 @@ function dispatchRequest(config) {
2942
3024
  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
2943
3025
  config.headers.setContentType('application/x-www-form-urlencoded', false);
2944
3026
  }
2945
- var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
3027
+ var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
2946
3028
  return adapter(config).then(function onAdapterResolution(response) {
2947
3029
  throwIfCancellationRequested(config);
2948
3030
 
@@ -2964,7 +3046,7 @@ function dispatchRequest(config) {
2964
3046
  });
2965
3047
  }
2966
3048
 
2967
- var VERSION = "1.11.0";
3049
+ var VERSION = "1.12.2";
2968
3050
 
2969
3051
  var validators$1 = {};
2970
3052
 
@@ -3187,7 +3269,6 @@ class Axios {
3187
3269
  }
3188
3270
  len = requestInterceptorChain.length;
3189
3271
  var newConfig = config;
3190
- i = 0;
3191
3272
  while (i < len) {
3192
3273
  var onFulfilled = requestInterceptorChain[i++];
3193
3274
  var onRejected = requestInterceptorChain[i++];
@@ -4272,7 +4353,7 @@ var ably = {exports: {}};
4272
4353
  });
4273
4354
  return _withTimeoutAsync2.apply(this, arguments);
4274
4355
  }
4275
- var version = "2.12.0";
4356
+ var version = "2.13.0";
4276
4357
 
4277
4358
  // src/common/lib/util/defaults.ts
4278
4359
  var agent = "ably-js/" + version;
@@ -4303,7 +4384,7 @@ var ably = {exports: {}};
4303
4384
  httpMaxRetryCount: 3,
4304
4385
  maxMessageSize: 65536,
4305
4386
  version,
4306
- protocolVersion: 3,
4387
+ protocolVersion: 4,
4307
4388
  agent,
4308
4389
  getPort,
4309
4390
  getHttpScheme,
@@ -5876,6 +5957,10 @@ var ably = {exports: {}};
5876
5957
  }
5877
5958
  } else if (attr && (attr === "extras" || attr === "operation")) {
5878
5959
  result += "; " + attr + "=" + JSON.stringify(m[attr]);
5960
+ } else if (attr === "version") {
5961
+ result += "; version=" + JSON.stringify(m[attr]);
5962
+ } else if (attr === "annotations") {
5963
+ result += "; annotations=" + JSON.stringify(m[attr]);
5879
5964
  } else if (m[attr] !== void 0) {
5880
5965
  result += "; " + attr + "=" + m[attr];
5881
5966
  }
@@ -7000,15 +7085,22 @@ var ably = {exports: {}};
7000
7085
  return total;
7001
7086
  }
7002
7087
  var Message = class _Message extends BaseMessage {
7003
- // TODO improve typings after summary structure is finalised
7004
7088
  expandFields() {
7005
- if (this.action === "message.create") {
7006
- if (this.version && !this.serial) {
7007
- this.serial = this.version;
7008
- }
7009
- if (this.timestamp && !this.createdAt) {
7010
- this.createdAt = this.timestamp;
7011
- }
7089
+ if (!this.version) {
7090
+ this.version = {};
7091
+ }
7092
+ if (!this.version.serial && this.serial) {
7093
+ this.version.serial = this.serial;
7094
+ }
7095
+ if (!this.version.timestamp && this.timestamp) {
7096
+ this.version.timestamp = this.timestamp;
7097
+ }
7098
+ if (!this.annotations) {
7099
+ this.annotations = {
7100
+ summary: {}
7101
+ };
7102
+ } else if (!this.annotations.summary) {
7103
+ this.annotations.summary = {};
7012
7104
  }
7013
7105
  }
7014
7106
  encode(options) {