contentful 11.12.0 → 11.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contentful.browser.js +104 -75
- package/dist/contentful.browser.min.js +1 -1
- package/dist/contentful.cjs +366 -281
- package/dist/stats-browser-min.html +1 -1
- package/package.json +2 -2
|
@@ -1668,7 +1668,6 @@ var contentful = (function (exports) {
|
|
|
1668
1668
|
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
1669
1669
|
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1670
1670
|
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1671
|
-
var AxiosError$1 = AxiosError;
|
|
1672
1671
|
|
|
1673
1672
|
// eslint-disable-next-line strict
|
|
1674
1673
|
var httpAdapter = null;
|
|
@@ -1786,7 +1785,7 @@ var contentful = (function (exports) {
|
|
|
1786
1785
|
return value.toString();
|
|
1787
1786
|
}
|
|
1788
1787
|
if (!useBlob && utils$1$1.isBlob(value)) {
|
|
1789
|
-
throw new AxiosError
|
|
1788
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
1790
1789
|
}
|
|
1791
1790
|
if (utils$1$1.isArrayBuffer(value) || utils$1$1.isTypedArray(value)) {
|
|
1792
1791
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
@@ -1909,8 +1908,8 @@ var contentful = (function (exports) {
|
|
|
1909
1908
|
};
|
|
1910
1909
|
|
|
1911
1910
|
/**
|
|
1912
|
-
* It replaces
|
|
1913
|
-
*
|
|
1911
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
1912
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1914
1913
|
*
|
|
1915
1914
|
* @param {string} val The value to be encoded.
|
|
1916
1915
|
*
|
|
@@ -2029,7 +2028,6 @@ var contentful = (function (exports) {
|
|
|
2029
2028
|
}
|
|
2030
2029
|
}]);
|
|
2031
2030
|
}();
|
|
2032
|
-
var InterceptorManager$1 = InterceptorManager;
|
|
2033
2031
|
var transitionalDefaults = {
|
|
2034
2032
|
silentJSONParsing: true,
|
|
2035
2033
|
forcedJSONParsing: true,
|
|
@@ -2088,8 +2086,8 @@ var contentful = (function (exports) {
|
|
|
2088
2086
|
var utils$3 = /*#__PURE__*/Object.freeze({
|
|
2089
2087
|
__proto__: null,
|
|
2090
2088
|
hasBrowserEnv: hasBrowserEnv,
|
|
2091
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2092
2089
|
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
2090
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2093
2091
|
navigator: _navigator,
|
|
2094
2092
|
origin: origin
|
|
2095
2093
|
});
|
|
@@ -2264,7 +2262,7 @@ var contentful = (function (exports) {
|
|
|
2264
2262
|
} catch (e) {
|
|
2265
2263
|
if (strictJSONParsing) {
|
|
2266
2264
|
if (e.name === 'SyntaxError') {
|
|
2267
|
-
throw AxiosError
|
|
2265
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
2268
2266
|
}
|
|
2269
2267
|
throw e;
|
|
2270
2268
|
}
|
|
@@ -2298,7 +2296,6 @@ var contentful = (function (exports) {
|
|
|
2298
2296
|
utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
|
|
2299
2297
|
defaults$2.headers[method] = {};
|
|
2300
2298
|
});
|
|
2301
|
-
var defaults$1$1 = defaults$2;
|
|
2302
2299
|
|
|
2303
2300
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
2304
2301
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
@@ -2343,14 +2340,42 @@ var contentful = (function (exports) {
|
|
|
2343
2340
|
return parsed;
|
|
2344
2341
|
};
|
|
2345
2342
|
var $internals = Symbol('internals');
|
|
2343
|
+
var isValidHeaderValue = function isValidHeaderValue(value) {
|
|
2344
|
+
return !/[\r\n]/.test(value);
|
|
2345
|
+
};
|
|
2346
|
+
function assertValidHeaderValue(value, header) {
|
|
2347
|
+
if (value === false || value == null) {
|
|
2348
|
+
return;
|
|
2349
|
+
}
|
|
2350
|
+
if (utils$1$1.isArray(value)) {
|
|
2351
|
+
value.forEach(function (v) {
|
|
2352
|
+
return assertValidHeaderValue(v, header);
|
|
2353
|
+
});
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
if (!isValidHeaderValue(String(value))) {
|
|
2357
|
+
throw new Error("Invalid character in header content [\"".concat(header, "\"]"));
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2346
2360
|
function normalizeHeader(header) {
|
|
2347
2361
|
return header && String(header).trim().toLowerCase();
|
|
2348
2362
|
}
|
|
2363
|
+
function stripTrailingCRLF(str) {
|
|
2364
|
+
var end = str.length;
|
|
2365
|
+
while (end > 0) {
|
|
2366
|
+
var charCode = str.charCodeAt(end - 1);
|
|
2367
|
+
if (charCode !== 10 && charCode !== 13) {
|
|
2368
|
+
break;
|
|
2369
|
+
}
|
|
2370
|
+
end -= 1;
|
|
2371
|
+
}
|
|
2372
|
+
return end === str.length ? str : str.slice(0, end);
|
|
2373
|
+
}
|
|
2349
2374
|
function normalizeValue(value) {
|
|
2350
2375
|
if (value === false || value == null) {
|
|
2351
2376
|
return value;
|
|
2352
2377
|
}
|
|
2353
|
-
return utils$1$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
2378
|
+
return utils$1$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
|
|
2354
2379
|
}
|
|
2355
2380
|
function parseTokens(str) {
|
|
2356
2381
|
var tokens = Object.create(null);
|
|
@@ -2411,6 +2436,7 @@ var contentful = (function (exports) {
|
|
|
2411
2436
|
}
|
|
2412
2437
|
var key = utils$1$1.findKey(self, lHeader);
|
|
2413
2438
|
if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
|
|
2439
|
+
assertValidHeaderValue(_value, _header);
|
|
2414
2440
|
self[key || _header] = normalizeValue(_value);
|
|
2415
2441
|
}
|
|
2416
2442
|
}
|
|
@@ -2636,7 +2662,6 @@ var contentful = (function (exports) {
|
|
|
2636
2662
|
};
|
|
2637
2663
|
});
|
|
2638
2664
|
utils$1$1.freezeMethods(AxiosHeaders);
|
|
2639
|
-
var AxiosHeaders$1 = AxiosHeaders;
|
|
2640
2665
|
|
|
2641
2666
|
/**
|
|
2642
2667
|
* Transform the data for a request or a response
|
|
@@ -2647,9 +2672,9 @@ var contentful = (function (exports) {
|
|
|
2647
2672
|
* @returns {*} The resulting transformed data
|
|
2648
2673
|
*/
|
|
2649
2674
|
function transformData(fns, response) {
|
|
2650
|
-
var config = this || defaults$
|
|
2675
|
+
var config = this || defaults$2;
|
|
2651
2676
|
var context = response || config;
|
|
2652
|
-
var headers = AxiosHeaders
|
|
2677
|
+
var headers = AxiosHeaders.from(context.headers);
|
|
2653
2678
|
var data = context.data;
|
|
2654
2679
|
utils$1$1.forEach(fns, function transform(fn) {
|
|
2655
2680
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
@@ -2660,7 +2685,7 @@ var contentful = (function (exports) {
|
|
|
2660
2685
|
function isCancel(value) {
|
|
2661
2686
|
return !!(value && value.__CANCEL__);
|
|
2662
2687
|
}
|
|
2663
|
-
var CanceledError = /*#__PURE__*/function (_AxiosError
|
|
2688
|
+
var CanceledError = /*#__PURE__*/function (_AxiosError) {
|
|
2664
2689
|
/**
|
|
2665
2690
|
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
2666
2691
|
*
|
|
@@ -2673,16 +2698,14 @@ var contentful = (function (exports) {
|
|
|
2673
2698
|
function CanceledError(message, config, request) {
|
|
2674
2699
|
var _this2;
|
|
2675
2700
|
_classCallCheck(this, CanceledError);
|
|
2676
|
-
_this2 = _callSuper$3(this, CanceledError, [message == null ? 'canceled' : message, AxiosError
|
|
2701
|
+
_this2 = _callSuper$3(this, CanceledError, [message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request]);
|
|
2677
2702
|
_this2.name = 'CanceledError';
|
|
2678
2703
|
_this2.__CANCEL__ = true;
|
|
2679
2704
|
return _this2;
|
|
2680
2705
|
}
|
|
2681
|
-
_inherits(CanceledError, _AxiosError
|
|
2706
|
+
_inherits(CanceledError, _AxiosError);
|
|
2682
2707
|
return _createClass(CanceledError);
|
|
2683
|
-
}(AxiosError
|
|
2684
|
-
var CanceledError$1 = CanceledError;
|
|
2685
|
-
|
|
2708
|
+
}(AxiosError);
|
|
2686
2709
|
/**
|
|
2687
2710
|
* Resolve or reject a Promise based on response status.
|
|
2688
2711
|
*
|
|
@@ -2697,7 +2720,7 @@ var contentful = (function (exports) {
|
|
|
2697
2720
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2698
2721
|
resolve(response);
|
|
2699
2722
|
} else {
|
|
2700
|
-
reject(new AxiosError
|
|
2723
|
+
reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
|
|
2701
2724
|
}
|
|
2702
2725
|
}
|
|
2703
2726
|
function parseProtocol(url) {
|
|
@@ -2929,7 +2952,7 @@ var contentful = (function (exports) {
|
|
|
2929
2952
|
return requestedURL;
|
|
2930
2953
|
}
|
|
2931
2954
|
var headersToObject = function headersToObject(thing) {
|
|
2932
|
-
return thing instanceof AxiosHeaders
|
|
2955
|
+
return thing instanceof AxiosHeaders ? _objectSpread$2({}, thing) : thing;
|
|
2933
2956
|
};
|
|
2934
2957
|
|
|
2935
2958
|
/**
|
|
@@ -3038,7 +3061,7 @@ var contentful = (function (exports) {
|
|
|
3038
3061
|
xsrfCookieName = newConfig.xsrfCookieName,
|
|
3039
3062
|
headers = newConfig.headers,
|
|
3040
3063
|
auth = newConfig.auth;
|
|
3041
|
-
newConfig.headers = headers = AxiosHeaders
|
|
3064
|
+
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
3042
3065
|
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
3043
3066
|
|
|
3044
3067
|
// HTTP basic authentication
|
|
@@ -3085,7 +3108,7 @@ var contentful = (function (exports) {
|
|
|
3085
3108
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
3086
3109
|
var _config = resolveConfig(config);
|
|
3087
3110
|
var requestData = _config.data;
|
|
3088
|
-
var requestHeaders = AxiosHeaders
|
|
3111
|
+
var requestHeaders = AxiosHeaders.from(_config.headers).normalize();
|
|
3089
3112
|
var responseType = _config.responseType,
|
|
3090
3113
|
onUploadProgress = _config.onUploadProgress,
|
|
3091
3114
|
onDownloadProgress = _config.onDownloadProgress;
|
|
@@ -3109,7 +3132,7 @@ var contentful = (function (exports) {
|
|
|
3109
3132
|
return;
|
|
3110
3133
|
}
|
|
3111
3134
|
// Prepare the response
|
|
3112
|
-
var responseHeaders = AxiosHeaders
|
|
3135
|
+
var responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
|
|
3113
3136
|
var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
|
|
3114
3137
|
var response = {
|
|
3115
3138
|
data: responseData,
|
|
@@ -3158,7 +3181,7 @@ var contentful = (function (exports) {
|
|
|
3158
3181
|
if (!request) {
|
|
3159
3182
|
return;
|
|
3160
3183
|
}
|
|
3161
|
-
reject(new AxiosError
|
|
3184
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
3162
3185
|
|
|
3163
3186
|
// Clean up request
|
|
3164
3187
|
request = null;
|
|
@@ -3170,7 +3193,7 @@ var contentful = (function (exports) {
|
|
|
3170
3193
|
// (message may be empty; when present, surface it)
|
|
3171
3194
|
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
3172
3195
|
var msg = event && event.message ? event.message : 'Network Error';
|
|
3173
|
-
var err = new AxiosError
|
|
3196
|
+
var err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
3174
3197
|
// attach the underlying event for consumers who want details
|
|
3175
3198
|
err.event = event || null;
|
|
3176
3199
|
reject(err);
|
|
@@ -3184,7 +3207,7 @@ var contentful = (function (exports) {
|
|
|
3184
3207
|
if (_config.timeoutErrorMessage) {
|
|
3185
3208
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3186
3209
|
}
|
|
3187
|
-
reject(new AxiosError
|
|
3210
|
+
reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
|
|
3188
3211
|
|
|
3189
3212
|
// Clean up request
|
|
3190
3213
|
request = null;
|
|
@@ -3235,7 +3258,7 @@ var contentful = (function (exports) {
|
|
|
3235
3258
|
if (!request) {
|
|
3236
3259
|
return;
|
|
3237
3260
|
}
|
|
3238
|
-
reject(!cancel || cancel.type ? new CanceledError
|
|
3261
|
+
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
3239
3262
|
request.abort();
|
|
3240
3263
|
request = null;
|
|
3241
3264
|
};
|
|
@@ -3246,7 +3269,7 @@ var contentful = (function (exports) {
|
|
|
3246
3269
|
}
|
|
3247
3270
|
var protocol = parseProtocol(_config.url);
|
|
3248
3271
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3249
|
-
reject(new AxiosError
|
|
3272
|
+
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
3250
3273
|
return;
|
|
3251
3274
|
}
|
|
3252
3275
|
|
|
@@ -3265,12 +3288,12 @@ var contentful = (function (exports) {
|
|
|
3265
3288
|
aborted = true;
|
|
3266
3289
|
unsubscribe();
|
|
3267
3290
|
var err = reason instanceof Error ? reason : this.reason;
|
|
3268
|
-
controller.abort(err instanceof AxiosError
|
|
3291
|
+
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
3269
3292
|
}
|
|
3270
3293
|
};
|
|
3271
3294
|
var timer = timeout && setTimeout(function () {
|
|
3272
3295
|
timer = null;
|
|
3273
|
-
onabort(new AxiosError
|
|
3296
|
+
onabort(new AxiosError("timeout of ".concat(timeout, "ms exceeded"), AxiosError.ETIMEDOUT));
|
|
3274
3297
|
}, timeout);
|
|
3275
3298
|
var unsubscribe = function unsubscribe() {
|
|
3276
3299
|
if (signals) {
|
|
@@ -3292,14 +3315,13 @@ var contentful = (function (exports) {
|
|
|
3292
3315
|
return signal;
|
|
3293
3316
|
}
|
|
3294
3317
|
};
|
|
3295
|
-
var composeSignals$1 = composeSignals;
|
|
3296
3318
|
var streamChunk = /*#__PURE__*/_regeneratorRuntime.mark(function streamChunk(chunk, chunkSize) {
|
|
3297
3319
|
var len, pos, end;
|
|
3298
3320
|
return _regeneratorRuntime.wrap(function streamChunk$(_context) {
|
|
3299
3321
|
while (1) switch (_context.prev = _context.next) {
|
|
3300
3322
|
case 0:
|
|
3301
3323
|
len = chunk.byteLength;
|
|
3302
|
-
if (!(
|
|
3324
|
+
if (!(len < chunkSize)) {
|
|
3303
3325
|
_context.next = 5;
|
|
3304
3326
|
break;
|
|
3305
3327
|
}
|
|
@@ -3564,14 +3586,16 @@ var contentful = (function (exports) {
|
|
|
3564
3586
|
}()));
|
|
3565
3587
|
var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
|
|
3566
3588
|
var duplexAccessed = false;
|
|
3589
|
+
var body = new ReadableStream$1();
|
|
3567
3590
|
var hasContentType = new Request(platform.origin, {
|
|
3568
|
-
body:
|
|
3591
|
+
body: body,
|
|
3569
3592
|
method: 'POST',
|
|
3570
3593
|
get duplex() {
|
|
3571
3594
|
duplexAccessed = true;
|
|
3572
3595
|
return 'half';
|
|
3573
3596
|
}
|
|
3574
3597
|
}).headers.has('Content-Type');
|
|
3598
|
+
body.cancel();
|
|
3575
3599
|
return duplexAccessed && !hasContentType;
|
|
3576
3600
|
});
|
|
3577
3601
|
var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(function () {
|
|
@@ -3589,7 +3613,7 @@ var contentful = (function (exports) {
|
|
|
3589
3613
|
if (method) {
|
|
3590
3614
|
return method.call(res);
|
|
3591
3615
|
}
|
|
3592
|
-
throw new AxiosError
|
|
3616
|
+
throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
|
|
3593
3617
|
});
|
|
3594
3618
|
});
|
|
3595
3619
|
}();
|
|
@@ -3678,7 +3702,7 @@ var contentful = (function (exports) {
|
|
|
3678
3702
|
_resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
|
|
3679
3703
|
_fetch = envFetch || fetch;
|
|
3680
3704
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
3681
|
-
composedSignal = composeSignals
|
|
3705
|
+
composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
3682
3706
|
request = null;
|
|
3683
3707
|
unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
|
|
3684
3708
|
composedSignal.unsubscribe();
|
|
@@ -3755,7 +3779,7 @@ var contentful = (function (exports) {
|
|
|
3755
3779
|
return new Promise(function (resolve, reject) {
|
|
3756
3780
|
settle(resolve, reject, {
|
|
3757
3781
|
data: responseData,
|
|
3758
|
-
headers: AxiosHeaders
|
|
3782
|
+
headers: AxiosHeaders.from(response.headers),
|
|
3759
3783
|
status: response.status,
|
|
3760
3784
|
statusText: response.statusText,
|
|
3761
3785
|
config: config,
|
|
@@ -3772,11 +3796,11 @@ var contentful = (function (exports) {
|
|
|
3772
3796
|
_context8.next = 41;
|
|
3773
3797
|
break;
|
|
3774
3798
|
}
|
|
3775
|
-
throw Object.assign(new AxiosError
|
|
3799
|
+
throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _context8.t2 && _context8.t2.response), {
|
|
3776
3800
|
cause: _context8.t2.cause || _context8.t2
|
|
3777
3801
|
});
|
|
3778
3802
|
case 41:
|
|
3779
|
-
throw AxiosError
|
|
3803
|
+
throw AxiosError.from(_context8.t2, _context8.t2 && _context8.t2.code, config, request, _context8.t2 && _context8.t2.response);
|
|
3780
3804
|
case 42:
|
|
3781
3805
|
case "end":
|
|
3782
3806
|
return _context8.stop();
|
|
@@ -3887,7 +3911,7 @@ var contentful = (function (exports) {
|
|
|
3887
3911
|
if (!isResolvedHandle(nameOrAdapter)) {
|
|
3888
3912
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3889
3913
|
if (adapter === undefined) {
|
|
3890
|
-
throw new AxiosError
|
|
3914
|
+
throw new AxiosError("Unknown adapter '".concat(id, "'"));
|
|
3891
3915
|
}
|
|
3892
3916
|
}
|
|
3893
3917
|
if (adapter && (utils$1$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
@@ -3903,7 +3927,7 @@ var contentful = (function (exports) {
|
|
|
3903
3927
|
return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
|
|
3904
3928
|
});
|
|
3905
3929
|
var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
|
|
3906
|
-
throw new AxiosError
|
|
3930
|
+
throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
|
|
3907
3931
|
}
|
|
3908
3932
|
return adapter;
|
|
3909
3933
|
}
|
|
@@ -3936,7 +3960,7 @@ var contentful = (function (exports) {
|
|
|
3936
3960
|
config.cancelToken.throwIfRequested();
|
|
3937
3961
|
}
|
|
3938
3962
|
if (config.signal && config.signal.aborted) {
|
|
3939
|
-
throw new CanceledError
|
|
3963
|
+
throw new CanceledError(null, config);
|
|
3940
3964
|
}
|
|
3941
3965
|
}
|
|
3942
3966
|
|
|
@@ -3949,20 +3973,20 @@ var contentful = (function (exports) {
|
|
|
3949
3973
|
*/
|
|
3950
3974
|
function dispatchRequest(config) {
|
|
3951
3975
|
throwIfCancellationRequested(config);
|
|
3952
|
-
config.headers = AxiosHeaders
|
|
3976
|
+
config.headers = AxiosHeaders.from(config.headers);
|
|
3953
3977
|
|
|
3954
3978
|
// Transform request data
|
|
3955
3979
|
config.data = transformData.call(config, config.transformRequest);
|
|
3956
3980
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
3957
3981
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
3958
3982
|
}
|
|
3959
|
-
var adapter = adapters.getAdapter(config.adapter || defaults$
|
|
3983
|
+
var adapter = adapters.getAdapter(config.adapter || defaults$2.adapter, config);
|
|
3960
3984
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
3961
3985
|
throwIfCancellationRequested(config);
|
|
3962
3986
|
|
|
3963
3987
|
// Transform response data
|
|
3964
3988
|
response.data = transformData.call(config, config.transformResponse, response);
|
|
3965
|
-
response.headers = AxiosHeaders
|
|
3989
|
+
response.headers = AxiosHeaders.from(response.headers);
|
|
3966
3990
|
return response;
|
|
3967
3991
|
}, function onAdapterRejection(reason) {
|
|
3968
3992
|
if (!isCancel(reason)) {
|
|
@@ -3971,13 +3995,13 @@ var contentful = (function (exports) {
|
|
|
3971
3995
|
// Transform response data
|
|
3972
3996
|
if (reason && reason.response) {
|
|
3973
3997
|
reason.response.data = transformData.call(config, config.transformResponse, reason.response);
|
|
3974
|
-
reason.response.headers = AxiosHeaders
|
|
3998
|
+
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
3975
3999
|
}
|
|
3976
4000
|
}
|
|
3977
4001
|
return Promise.reject(reason);
|
|
3978
4002
|
});
|
|
3979
4003
|
}
|
|
3980
|
-
var VERSION = "1.
|
|
4004
|
+
var VERSION = "1.15.0";
|
|
3981
4005
|
var validators$1 = {};
|
|
3982
4006
|
|
|
3983
4007
|
// eslint-disable-next-line func-names
|
|
@@ -4005,7 +4029,7 @@ var contentful = (function (exports) {
|
|
|
4005
4029
|
// eslint-disable-next-line func-names
|
|
4006
4030
|
return function (value, opt, opts) {
|
|
4007
4031
|
if (validator === false) {
|
|
4008
|
-
throw new AxiosError
|
|
4032
|
+
throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
|
|
4009
4033
|
}
|
|
4010
4034
|
if (version && !deprecatedWarnings[opt]) {
|
|
4011
4035
|
deprecatedWarnings[opt] = true;
|
|
@@ -4035,7 +4059,7 @@ var contentful = (function (exports) {
|
|
|
4035
4059
|
|
|
4036
4060
|
function assertOptions(options, schema, allowUnknown) {
|
|
4037
4061
|
if (_typeof$2(options) !== 'object') {
|
|
4038
|
-
throw new AxiosError
|
|
4062
|
+
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
4039
4063
|
}
|
|
4040
4064
|
var keys = Object.keys(options);
|
|
4041
4065
|
var i = keys.length;
|
|
@@ -4046,12 +4070,12 @@ var contentful = (function (exports) {
|
|
|
4046
4070
|
var value = options[opt];
|
|
4047
4071
|
var result = value === undefined || _validator(value, opt, options);
|
|
4048
4072
|
if (result !== true) {
|
|
4049
|
-
throw new AxiosError
|
|
4073
|
+
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
4050
4074
|
}
|
|
4051
4075
|
continue;
|
|
4052
4076
|
}
|
|
4053
4077
|
if (allowUnknown !== true) {
|
|
4054
|
-
throw new AxiosError
|
|
4078
|
+
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
|
4055
4079
|
}
|
|
4056
4080
|
}
|
|
4057
4081
|
}
|
|
@@ -4073,8 +4097,8 @@ var contentful = (function (exports) {
|
|
|
4073
4097
|
_classCallCheck(this, Axios);
|
|
4074
4098
|
this.defaults = instanceConfig || {};
|
|
4075
4099
|
this.interceptors = {
|
|
4076
|
-
request: new InterceptorManager
|
|
4077
|
-
response: new InterceptorManager
|
|
4100
|
+
request: new InterceptorManager(),
|
|
4101
|
+
response: new InterceptorManager()
|
|
4078
4102
|
};
|
|
4079
4103
|
}
|
|
4080
4104
|
|
|
@@ -4090,7 +4114,7 @@ var contentful = (function (exports) {
|
|
|
4090
4114
|
key: "request",
|
|
4091
4115
|
value: (function () {
|
|
4092
4116
|
var _request2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(configOrUrl, config) {
|
|
4093
|
-
var dummy, stack;
|
|
4117
|
+
var dummy, stack, firstNewlineIndex, secondNewlineIndex, stackWithoutTwoTopLines;
|
|
4094
4118
|
return _regeneratorRuntime.wrap(function _callee8$(_context9) {
|
|
4095
4119
|
while (1) switch (_context9.prev = _context9.next) {
|
|
4096
4120
|
case 0:
|
|
@@ -4107,13 +4131,24 @@ var contentful = (function (exports) {
|
|
|
4107
4131
|
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
4108
4132
|
|
|
4109
4133
|
// slice off the Error: ... line
|
|
4110
|
-
stack =
|
|
4134
|
+
stack = function () {
|
|
4135
|
+
if (!dummy.stack) {
|
|
4136
|
+
return '';
|
|
4137
|
+
}
|
|
4138
|
+
var firstNewlineIndex = dummy.stack.indexOf('\n');
|
|
4139
|
+
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
4140
|
+
}();
|
|
4111
4141
|
try {
|
|
4112
4142
|
if (!_context9.t0.stack) {
|
|
4113
4143
|
_context9.t0.stack = stack;
|
|
4114
4144
|
// match without the 2 top stack lines
|
|
4115
|
-
} else if (stack
|
|
4116
|
-
|
|
4145
|
+
} else if (stack) {
|
|
4146
|
+
firstNewlineIndex = stack.indexOf('\n');
|
|
4147
|
+
secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
4148
|
+
stackWithoutTwoTopLines = secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
|
|
4149
|
+
if (!String(_context9.t0.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
4150
|
+
_context9.t0.stack += '\n' + stack;
|
|
4151
|
+
}
|
|
4117
4152
|
}
|
|
4118
4153
|
} catch (e) {
|
|
4119
4154
|
// ignore the case where "stack" is an un-writable property
|
|
@@ -4187,7 +4222,7 @@ var contentful = (function (exports) {
|
|
|
4187
4222
|
headers && utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
|
|
4188
4223
|
delete headers[method];
|
|
4189
4224
|
});
|
|
4190
|
-
config.headers = AxiosHeaders
|
|
4225
|
+
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
4191
4226
|
|
|
4192
4227
|
// filter out skipped interceptors
|
|
4193
4228
|
var requestInterceptorChain = [];
|
|
@@ -4267,8 +4302,6 @@ var contentful = (function (exports) {
|
|
|
4267
4302
|
};
|
|
4268
4303
|
});
|
|
4269
4304
|
utils$1$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
4270
|
-
/*eslint func-names:0*/
|
|
4271
|
-
|
|
4272
4305
|
function generateHTTPMethod(isForm) {
|
|
4273
4306
|
return function httpMethod(url, data, config) {
|
|
4274
4307
|
return this.request(mergeConfig(config || {}, {
|
|
@@ -4284,7 +4317,6 @@ var contentful = (function (exports) {
|
|
|
4284
4317
|
Axios.prototype[method] = generateHTTPMethod();
|
|
4285
4318
|
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
4286
4319
|
});
|
|
4287
|
-
var Axios$1 = Axios;
|
|
4288
4320
|
|
|
4289
4321
|
/**
|
|
4290
4322
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
@@ -4333,7 +4365,7 @@ var contentful = (function (exports) {
|
|
|
4333
4365
|
// Cancellation has already been requested
|
|
4334
4366
|
return;
|
|
4335
4367
|
}
|
|
4336
|
-
token.reason = new CanceledError
|
|
4368
|
+
token.reason = new CanceledError(message, config, request);
|
|
4337
4369
|
resolvePromise(token.reason);
|
|
4338
4370
|
});
|
|
4339
4371
|
}
|
|
@@ -4413,8 +4445,6 @@ var contentful = (function (exports) {
|
|
|
4413
4445
|
}
|
|
4414
4446
|
}]);
|
|
4415
4447
|
}();
|
|
4416
|
-
var CancelToken$1 = CancelToken;
|
|
4417
|
-
|
|
4418
4448
|
/**
|
|
4419
4449
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
4420
4450
|
*
|
|
@@ -4529,7 +4559,6 @@ var contentful = (function (exports) {
|
|
|
4529
4559
|
value = _ref23[1];
|
|
4530
4560
|
HttpStatusCode[value] = key;
|
|
4531
4561
|
});
|
|
4532
|
-
var HttpStatusCode$1 = HttpStatusCode;
|
|
4533
4562
|
|
|
4534
4563
|
/**
|
|
4535
4564
|
* Create an instance of Axios
|
|
@@ -4539,11 +4568,11 @@ var contentful = (function (exports) {
|
|
|
4539
4568
|
* @returns {Axios} A new instance of Axios
|
|
4540
4569
|
*/
|
|
4541
4570
|
function createInstance(defaultConfig) {
|
|
4542
|
-
var context = new Axios
|
|
4543
|
-
var instance = bind$3(Axios
|
|
4571
|
+
var context = new Axios(defaultConfig);
|
|
4572
|
+
var instance = bind$3(Axios.prototype.request, context);
|
|
4544
4573
|
|
|
4545
4574
|
// Copy axios.prototype to instance
|
|
4546
|
-
utils$1$1.extend(instance, Axios
|
|
4575
|
+
utils$1$1.extend(instance, Axios.prototype, context, {
|
|
4547
4576
|
allOwnKeys: true
|
|
4548
4577
|
});
|
|
4549
4578
|
|
|
@@ -4560,20 +4589,20 @@ var contentful = (function (exports) {
|
|
|
4560
4589
|
}
|
|
4561
4590
|
|
|
4562
4591
|
// Create the default instance to be exported
|
|
4563
|
-
var axios = createInstance(defaults$
|
|
4592
|
+
var axios = createInstance(defaults$2);
|
|
4564
4593
|
|
|
4565
4594
|
// Expose Axios class to allow class inheritance
|
|
4566
|
-
axios.Axios = Axios
|
|
4595
|
+
axios.Axios = Axios;
|
|
4567
4596
|
|
|
4568
4597
|
// Expose Cancel & CancelToken
|
|
4569
|
-
axios.CanceledError = CanceledError
|
|
4570
|
-
axios.CancelToken = CancelToken
|
|
4598
|
+
axios.CanceledError = CanceledError;
|
|
4599
|
+
axios.CancelToken = CancelToken;
|
|
4571
4600
|
axios.isCancel = isCancel;
|
|
4572
4601
|
axios.VERSION = VERSION;
|
|
4573
4602
|
axios.toFormData = toFormData;
|
|
4574
4603
|
|
|
4575
4604
|
// Expose AxiosError class
|
|
4576
|
-
axios.AxiosError = AxiosError
|
|
4605
|
+
axios.AxiosError = AxiosError;
|
|
4577
4606
|
|
|
4578
4607
|
// alias for CanceledError for backward compatibility
|
|
4579
4608
|
axios.Cancel = axios.CanceledError;
|
|
@@ -4589,12 +4618,12 @@ var contentful = (function (exports) {
|
|
|
4589
4618
|
|
|
4590
4619
|
// Expose mergeConfig
|
|
4591
4620
|
axios.mergeConfig = mergeConfig;
|
|
4592
|
-
axios.AxiosHeaders = AxiosHeaders
|
|
4621
|
+
axios.AxiosHeaders = AxiosHeaders;
|
|
4593
4622
|
axios.formToJSON = function (thing) {
|
|
4594
4623
|
return formDataToJSON(utils$1$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4595
4624
|
};
|
|
4596
4625
|
axios.getAdapter = adapters.getAdapter;
|
|
4597
|
-
axios.HttpStatusCode = HttpStatusCode
|
|
4626
|
+
axios.HttpStatusCode = HttpStatusCode;
|
|
4598
4627
|
axios.default = axios;
|
|
4599
4628
|
var axios_1 = axios;
|
|
4600
4629
|
var axios$1 = /*@__PURE__*/getDefaultExportFromCjs(axios_1);
|
|
@@ -9222,7 +9251,7 @@ var contentful = (function (exports) {
|
|
|
9222
9251
|
}
|
|
9223
9252
|
var responseClone = index(response);
|
|
9224
9253
|
var allIncludes = Object.keys(responseClone.includes || {}).reduce(function (all, type) {
|
|
9225
|
-
return [].concat(_toConsumableArray(all), _toConsumableArray(
|
|
9254
|
+
return [].concat(_toConsumableArray(all), _toConsumableArray(responseClone.includes[type]));
|
|
9226
9255
|
}, []);
|
|
9227
9256
|
var allEntries = [].concat(_toConsumableArray(responseClone.items), _toConsumableArray(allIncludes)).filter(function (entity) {
|
|
9228
9257
|
return Boolean(entity.sys);
|