contentful 10.6.21 → 10.6.22
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/README.md
CHANGED
|
@@ -235,7 +235,7 @@ The configuration options belong to two categories: request config and response
|
|
|
235
235
|
| `httpAgent` | `undefined` | Custom agent to perform HTTP requests. Find further information in the [axios request config documentation](https://github.com/axios/axios#request-config). |
|
|
236
236
|
| `httpsAgent` | `undefined` | Custom agent to perform HTTPS requests. Find further information in the [axios request config documentation](https://github.com/axios/axios#request-config). |
|
|
237
237
|
| `adapter` | `undefined` | Custom adapter to handle making the requests. Find further information in the [axios request config documentation](https://github.com/axios/axios#request-config). |
|
|
238
|
-
| `headers` | `{}` | Additional headers to attach to the requests. We add/overwrite the following headers: <ul><li><b>Content-Type:</b> `application/vnd.contentful.
|
|
238
|
+
| `headers` | `{}` | Additional headers to attach to the requests. We add/overwrite the following headers: <ul><li><b>Content-Type:</b> `application/vnd.contentful.delivery.v1+json`</li><li><b>X-Contentful-User-Agent:</b> `sdk contentful.js/1.2.3; platform node.js/1.2.3; os macOS/1.2.3` (Automatically generated)</li></ul> |
|
|
239
239
|
| `proxy` | `undefined` | Axios proxy configuration. See the [axios request config documentation](https://github.com/axios/axios#request-config) for further information about the supported values. |
|
|
240
240
|
| `retryOnError` | `true` | By default, this library is retrying requests which resulted in a 500 server error and 429 rate limit response. Set this to `false` to disable this behavior. |
|
|
241
241
|
| `application` | `undefined` | Application name and version e.g myApp/version. |
|
|
@@ -318,7 +318,7 @@ eval("\n\nvar GetIntrinsic = __webpack_require__(/*! get-intrinsic */ \"../node_
|
|
|
318
318
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
319
319
|
|
|
320
320
|
"use strict";
|
|
321
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createClient: function() { return /* binding */ createClient; }\n/* harmony export */ });\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! axios */ \"../node_modules/axios/lib/axios.js\");\n/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! contentful-sdk-core */ \"../node_modules/contentful-sdk-core/dist/index.es-modules.js\");\n/* harmony import */ var _create_global_options__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./create-global-options */ \"./create-global-options.ts\");\n/* harmony import */ var _make_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./make-client */ \"./make-client.ts\");\n/* harmony import */ var _utils_validate_params__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/validate-params */ \"./utils/validate-params.ts\");\n/**\n * Contentful Delivery API SDK. Allows you to create instances of a client\n * with access to the Contentful Content Delivery API.\n */\n\n\n\n\n\n/**\n * Create a client instance\n * @param params - Client initialization parameters\n * @category Client\n * @example\n * ```typescript\n * const contentful = require('contentful')\n * const client = contentful.createClient({\n * accessToken: 'myAccessToken',\n * space: 'mySpaceId'\n * })\n * ```\n */\nfunction createClient(params) {\n if (!params.accessToken) {\n throw new TypeError('Expected parameter accessToken');\n }\n if (!params.space) {\n throw new TypeError('Expected parameter space');\n }\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_3__.validateResolveLinksParam)(params);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_3__.validateRemoveUnresolvedParam)(params);\n const defaultConfig = {\n resolveLinks: true,\n removeUnresolved: false,\n defaultHostname: 'cdn.contentful.com',\n environment: 'master',\n };\n const config = {\n ...defaultConfig,\n ...params,\n };\n const userAgentHeader = (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.getUserAgentHeader)(`contentful.js/${\"10.6.
|
|
321
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createClient: function() { return /* binding */ createClient; }\n/* harmony export */ });\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! axios */ \"../node_modules/axios/lib/axios.js\");\n/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! contentful-sdk-core */ \"../node_modules/contentful-sdk-core/dist/index.es-modules.js\");\n/* harmony import */ var _create_global_options__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./create-global-options */ \"./create-global-options.ts\");\n/* harmony import */ var _make_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./make-client */ \"./make-client.ts\");\n/* harmony import */ var _utils_validate_params__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/validate-params */ \"./utils/validate-params.ts\");\n/**\n * Contentful Delivery API SDK. Allows you to create instances of a client\n * with access to the Contentful Content Delivery API.\n */\n\n\n\n\n\n/**\n * Create a client instance\n * @param params - Client initialization parameters\n * @category Client\n * @example\n * ```typescript\n * const contentful = require('contentful')\n * const client = contentful.createClient({\n * accessToken: 'myAccessToken',\n * space: 'mySpaceId'\n * })\n * ```\n */\nfunction createClient(params) {\n if (!params.accessToken) {\n throw new TypeError('Expected parameter accessToken');\n }\n if (!params.space) {\n throw new TypeError('Expected parameter space');\n }\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_3__.validateResolveLinksParam)(params);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_3__.validateRemoveUnresolvedParam)(params);\n const defaultConfig = {\n resolveLinks: true,\n removeUnresolved: false,\n defaultHostname: 'cdn.contentful.com',\n environment: 'master',\n };\n const config = {\n ...defaultConfig,\n ...params,\n };\n const userAgentHeader = (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.getUserAgentHeader)(`contentful.js/${\"10.6.22\"}`, config.application, config.integration);\n config.headers = {\n ...config.headers,\n 'Content-Type': 'application/vnd.contentful.delivery.v1+json',\n 'X-Contentful-User-Agent': userAgentHeader,\n };\n const http = (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createHttpClient)(axios__WEBPACK_IMPORTED_MODULE_4__[\"default\"], config);\n if (!http.defaults.baseURL) {\n throw new Error('Please define a baseURL');\n }\n const getGlobalOptions = (0,_create_global_options__WEBPACK_IMPORTED_MODULE_1__.createGlobalOptions)({\n space: config.space,\n environment: config.environment,\n spaceBaseUrl: http.defaults.baseURL,\n environmentBaseUrl: `${http.defaults.baseURL}environments/${config.environment}`,\n });\n // Append environment to baseURL\n http.defaults.baseURL = getGlobalOptions({}).environmentBaseUrl;\n return (0,_make_client__WEBPACK_IMPORTED_MODULE_2__.makeClient)({\n http,\n getGlobalOptions,\n });\n}\n\n\n//# sourceURL=webpack://contentful/./contentful.ts?");
|
|
322
322
|
|
|
323
323
|
/***/ }),
|
|
324
324
|
|
|
@@ -329,7 +329,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
329
329
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
330
330
|
|
|
331
331
|
"use strict";
|
|
332
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ createContentfulApi; }\n/* harmony export */ });\n/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! contentful-sdk-core */ \"../node_modules/contentful-sdk-core/dist/index.es-modules.js\");\n/* harmony import */ var _paged_sync__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./paged-sync */ \"./paged-sync.ts\");\n/* harmony import */ var _utils_normalize_search_parameters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/normalize-search-parameters */ \"./utils/normalize-search-parameters.ts\");\n/* harmony import */ var _utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/normalize-select */ \"./utils/normalize-select.ts\");\n/* harmony import */ var _utils_resolve_circular__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/resolve-circular */ \"./utils/resolve-circular.ts\");\n/* harmony import */ var _utils_validate_timestamp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/validate-timestamp */ \"./utils/validate-timestamp.ts\");\n/* harmony import */ var _utils_validate_params__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/validate-params */ \"./utils/validate-params.ts\");\n/* harmony import */ var _utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/validate-search-parameters */ \"./utils/validate-search-parameters.ts\");\n/**\n * Contentful Delivery API Client. Contains methods which allow access to the\n * different kinds of entities present in Contentful (Entries, Assets, etc).\n */\n\n\n\n\n\n\n\n\nconst ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;\nclass NotFoundError extends Error {\n sys;\n details;\n constructor(id, environment, space) {\n super('The resource could not be found.');\n this.sys = {\n type: 'Error',\n id: 'NotFound',\n };\n this.details = {\n type: 'Entry',\n id,\n environment,\n space,\n };\n }\n}\nfunction createContentfulApi({ http, getGlobalOptions }, options) {\n const notFoundError = (id = 'unknown') => {\n return new NotFoundError(id, getGlobalOptions().environment, getGlobalOptions().space);\n };\n const getBaseUrl = (context) => {\n let baseUrl = context === 'space' ? getGlobalOptions().spaceBaseUrl : getGlobalOptions().environmentBaseUrl;\n if (!baseUrl) {\n throw new Error('Please define baseUrl for ' + context);\n }\n if (!baseUrl.endsWith('/')) {\n baseUrl += '/';\n }\n return baseUrl;\n };\n async function get({ context, path, config }) {\n const baseUrl = getBaseUrl(context);\n try {\n const response = await http.get(baseUrl + path, config);\n return response.data;\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function post({ context, path, data, config }) {\n const baseUrl = getBaseUrl(context);\n try {\n const response = await http.post(baseUrl + path, data, config);\n return response.data;\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function getSpace() {\n return get({ context: 'space', path: '' });\n }\n async function getContentType(id) {\n return get({\n context: 'environment',\n path: `content_types/${id}`,\n });\n }\n async function getContentTypes(query = {}) {\n return get({\n context: 'environment',\n path: 'content_types',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query }),\n });\n }\n async function getEntry(id, query = {}) {\n return makeGetEntry(id, query, options);\n }\n async function getEntries(query = {}) {\n return makeGetEntries(query, options);\n }\n async function makeGetEntry(id, query, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n const { withAllLocales } = options;\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateLocaleParam)(query, withAllLocales);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateResolveLinksParam)(query);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateRemoveUnresolvedParam)(query);\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n return internalGetEntry(id, withAllLocales ? { ...query, locale: '*' } : query, options);\n }\n async function internalGetEntry(id, query, options) {\n if (!id) {\n throw notFoundError(id);\n }\n try {\n const response = await internalGetEntries({ 'sys.id': id, ...query }, options);\n if (response.items.length > 0) {\n return response.items[0];\n }\n else {\n throw notFoundError(id);\n }\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function makeGetEntries(query, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n const { withAllLocales } = options;\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateLocaleParam)(query, withAllLocales);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateResolveLinksParam)(query);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateRemoveUnresolvedParam)(query);\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n return internalGetEntries(withAllLocales\n ? {\n ...query,\n locale: '*',\n }\n : query, options);\n }\n async function internalGetEntries(query, options) {\n const { withoutLinkResolution, withoutUnresolvableLinks } = options;\n try {\n const entries = await get({\n context: 'environment',\n path: 'entries',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_search_parameters__WEBPACK_IMPORTED_MODULE_2__[\"default\"])((0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query)) }),\n });\n return (0,_utils_resolve_circular__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(entries, {\n resolveLinks: !withoutLinkResolution ?? true,\n removeUnresolved: withoutUnresolvableLinks ?? false,\n });\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function getAsset(id, query = {}) {\n return makeGetAsset(id, query, options);\n }\n async function getAssets(query = {}) {\n return makeGetAssets(query, options);\n }\n async function makeGetAssets(query, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n const { withAllLocales } = options;\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateLocaleParam)(query, withAllLocales);\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n const localeSpecificQuery = withAllLocales ? { ...query, locale: '*' } : query;\n return internalGetAssets(localeSpecificQuery);\n }\n async function internalGetAsset(id, query) {\n try {\n return get({\n context: 'environment',\n path: `assets/${id}`,\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query) }),\n });\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function makeGetAsset(id, query, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n const { withAllLocales } = options;\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateLocaleParam)(query, withAllLocales);\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n const localeSpecificQuery = withAllLocales ? { ...query, locale: '*' } : query;\n return internalGetAsset(id, localeSpecificQuery);\n }\n async function internalGetAssets(query) {\n try {\n return get({\n context: 'environment',\n path: 'assets',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_search_parameters__WEBPACK_IMPORTED_MODULE_2__[\"default\"])((0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query)) }),\n });\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function getTag(id) {\n return get({\n context: 'environment',\n path: `tags/${id}`,\n });\n }\n async function getTags(query = {}) {\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n return get({\n context: 'environment',\n path: 'tags',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_search_parameters__WEBPACK_IMPORTED_MODULE_2__[\"default\"])((0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query)) }),\n });\n }\n async function createAssetKey(expiresAt) {\n try {\n const now = Math.floor(Date.now() / 1000);\n const currentMaxLifetime = now + ASSET_KEY_MAX_LIFETIME;\n (0,_utils_validate_timestamp__WEBPACK_IMPORTED_MODULE_5__[\"default\"])('expiresAt', expiresAt, { maximum: currentMaxLifetime, now });\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n return post({\n context: 'environment',\n path: 'asset_keys',\n data: { expiresAt },\n });\n }\n async function getLocales(query = {}) {\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n return get({\n context: 'environment',\n path: 'locales',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query) }),\n });\n }\n async function sync(query, syncOptions = { paginate: true }) {\n return makePagedSync(query, syncOptions, options);\n }\n async function makePagedSync(query, syncOptions, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateResolveLinksParam)(query);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateRemoveUnresolvedParam)(query);\n const combinedOptions = {\n ...syncOptions,\n ...options,\n };\n switchToEnvironment(http);\n return (0,_paged_sync__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(http, query, combinedOptions);\n }\n function parseEntries(data) {\n return makeParseEntries(data, options);\n }\n function makeParseEntries(data, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n return internalParseEntries(data, options);\n }\n function internalParseEntries(data, options) {\n const { withoutLinkResolution, withoutUnresolvableLinks } = options;\n return (0,_utils_resolve_circular__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(data, {\n resolveLinks: !withoutLinkResolution ?? true,\n removeUnresolved: withoutUnresolvableLinks ?? false,\n });\n }\n /*\n * Switches BaseURL to use /environments path\n * */\n function switchToEnvironment(http) {\n http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;\n }\n return {\n version: \"10.6.21\",\n getSpace,\n getContentType,\n getContentTypes,\n getAsset,\n getAssets,\n getTag,\n getTags,\n getLocales,\n parseEntries,\n sync,\n getEntry,\n getEntries,\n createAssetKey,\n };\n}\n\n\n//# sourceURL=webpack://contentful/./create-contentful-api.ts?");
|
|
332
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ createContentfulApi; }\n/* harmony export */ });\n/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! contentful-sdk-core */ \"../node_modules/contentful-sdk-core/dist/index.es-modules.js\");\n/* harmony import */ var _paged_sync__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./paged-sync */ \"./paged-sync.ts\");\n/* harmony import */ var _utils_normalize_search_parameters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/normalize-search-parameters */ \"./utils/normalize-search-parameters.ts\");\n/* harmony import */ var _utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/normalize-select */ \"./utils/normalize-select.ts\");\n/* harmony import */ var _utils_resolve_circular__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/resolve-circular */ \"./utils/resolve-circular.ts\");\n/* harmony import */ var _utils_validate_timestamp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/validate-timestamp */ \"./utils/validate-timestamp.ts\");\n/* harmony import */ var _utils_validate_params__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/validate-params */ \"./utils/validate-params.ts\");\n/* harmony import */ var _utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/validate-search-parameters */ \"./utils/validate-search-parameters.ts\");\n/**\n * Contentful Delivery API Client. Contains methods which allow access to the\n * different kinds of entities present in Contentful (Entries, Assets, etc).\n */\n\n\n\n\n\n\n\n\nconst ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;\nclass NotFoundError extends Error {\n sys;\n details;\n constructor(id, environment, space) {\n super('The resource could not be found.');\n this.sys = {\n type: 'Error',\n id: 'NotFound',\n };\n this.details = {\n type: 'Entry',\n id,\n environment,\n space,\n };\n }\n}\nfunction createContentfulApi({ http, getGlobalOptions }, options) {\n const notFoundError = (id = 'unknown') => {\n return new NotFoundError(id, getGlobalOptions().environment, getGlobalOptions().space);\n };\n const getBaseUrl = (context) => {\n let baseUrl = context === 'space' ? getGlobalOptions().spaceBaseUrl : getGlobalOptions().environmentBaseUrl;\n if (!baseUrl) {\n throw new Error('Please define baseUrl for ' + context);\n }\n if (!baseUrl.endsWith('/')) {\n baseUrl += '/';\n }\n return baseUrl;\n };\n async function get({ context, path, config }) {\n const baseUrl = getBaseUrl(context);\n try {\n const response = await http.get(baseUrl + path, config);\n return response.data;\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function post({ context, path, data, config }) {\n const baseUrl = getBaseUrl(context);\n try {\n const response = await http.post(baseUrl + path, data, config);\n return response.data;\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function getSpace() {\n return get({ context: 'space', path: '' });\n }\n async function getContentType(id) {\n return get({\n context: 'environment',\n path: `content_types/${id}`,\n });\n }\n async function getContentTypes(query = {}) {\n return get({\n context: 'environment',\n path: 'content_types',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query }),\n });\n }\n async function getEntry(id, query = {}) {\n return makeGetEntry(id, query, options);\n }\n async function getEntries(query = {}) {\n return makeGetEntries(query, options);\n }\n async function makeGetEntry(id, query, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n const { withAllLocales } = options;\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateLocaleParam)(query, withAllLocales);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateResolveLinksParam)(query);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateRemoveUnresolvedParam)(query);\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n return internalGetEntry(id, withAllLocales ? { ...query, locale: '*' } : query, options);\n }\n async function internalGetEntry(id, query, options) {\n if (!id) {\n throw notFoundError(id);\n }\n try {\n const response = await internalGetEntries({ 'sys.id': id, ...query }, options);\n if (response.items.length > 0) {\n return response.items[0];\n }\n else {\n throw notFoundError(id);\n }\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function makeGetEntries(query, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n const { withAllLocales } = options;\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateLocaleParam)(query, withAllLocales);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateResolveLinksParam)(query);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateRemoveUnresolvedParam)(query);\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n return internalGetEntries(withAllLocales\n ? {\n ...query,\n locale: '*',\n }\n : query, options);\n }\n async function internalGetEntries(query, options) {\n const { withoutLinkResolution, withoutUnresolvableLinks } = options;\n try {\n const entries = await get({\n context: 'environment',\n path: 'entries',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_search_parameters__WEBPACK_IMPORTED_MODULE_2__[\"default\"])((0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query)) }),\n });\n return (0,_utils_resolve_circular__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(entries, {\n resolveLinks: !withoutLinkResolution ?? true,\n removeUnresolved: withoutUnresolvableLinks ?? false,\n });\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function getAsset(id, query = {}) {\n return makeGetAsset(id, query, options);\n }\n async function getAssets(query = {}) {\n return makeGetAssets(query, options);\n }\n async function makeGetAssets(query, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n const { withAllLocales } = options;\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateLocaleParam)(query, withAllLocales);\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n const localeSpecificQuery = withAllLocales ? { ...query, locale: '*' } : query;\n return internalGetAssets(localeSpecificQuery);\n }\n async function internalGetAsset(id, query) {\n try {\n return get({\n context: 'environment',\n path: `assets/${id}`,\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query) }),\n });\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function makeGetAsset(id, query, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n const { withAllLocales } = options;\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateLocaleParam)(query, withAllLocales);\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n const localeSpecificQuery = withAllLocales ? { ...query, locale: '*' } : query;\n return internalGetAsset(id, localeSpecificQuery);\n }\n async function internalGetAssets(query) {\n try {\n return get({\n context: 'environment',\n path: 'assets',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_search_parameters__WEBPACK_IMPORTED_MODULE_2__[\"default\"])((0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query)) }),\n });\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n }\n async function getTag(id) {\n return get({\n context: 'environment',\n path: `tags/${id}`,\n });\n }\n async function getTags(query = {}) {\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n return get({\n context: 'environment',\n path: 'tags',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_search_parameters__WEBPACK_IMPORTED_MODULE_2__[\"default\"])((0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query)) }),\n });\n }\n async function createAssetKey(expiresAt) {\n try {\n const now = Math.floor(Date.now() / 1000);\n const currentMaxLifetime = now + ASSET_KEY_MAX_LIFETIME;\n (0,_utils_validate_timestamp__WEBPACK_IMPORTED_MODULE_5__[\"default\"])('expiresAt', expiresAt, { maximum: currentMaxLifetime, now });\n }\n catch (error) {\n (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.errorHandler)(error);\n }\n return post({\n context: 'environment',\n path: 'asset_keys',\n data: { expiresAt },\n });\n }\n async function getLocales(query = {}) {\n (0,_utils_validate_search_parameters__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(query);\n return get({\n context: 'environment',\n path: 'locales',\n config: (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.createRequestConfig)({ query: (0,_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(query) }),\n });\n }\n async function sync(query, syncOptions = { paginate: true }) {\n return makePagedSync(query, syncOptions, options);\n }\n async function makePagedSync(query, syncOptions, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateResolveLinksParam)(query);\n (0,_utils_validate_params__WEBPACK_IMPORTED_MODULE_6__.validateRemoveUnresolvedParam)(query);\n const combinedOptions = {\n ...syncOptions,\n ...options,\n };\n switchToEnvironment(http);\n return (0,_paged_sync__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(http, query, combinedOptions);\n }\n function parseEntries(data) {\n return makeParseEntries(data, options);\n }\n function makeParseEntries(data, options = {\n withAllLocales: false,\n withoutLinkResolution: false,\n withoutUnresolvableLinks: false,\n }) {\n return internalParseEntries(data, options);\n }\n function internalParseEntries(data, options) {\n const { withoutLinkResolution, withoutUnresolvableLinks } = options;\n return (0,_utils_resolve_circular__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(data, {\n resolveLinks: !withoutLinkResolution ?? true,\n removeUnresolved: withoutUnresolvableLinks ?? false,\n });\n }\n /*\n * Switches BaseURL to use /environments path\n * */\n function switchToEnvironment(http) {\n http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;\n }\n return {\n version: \"10.6.22\",\n getSpace,\n getContentType,\n getContentTypes,\n getAsset,\n getAssets,\n getTag,\n getTags,\n getLocales,\n parseEntries,\n sync,\n getEntry,\n getEntries,\n createAssetKey,\n };\n}\n\n\n//# sourceURL=webpack://contentful/./create-contentful-api.ts?");
|
|
333
333
|
|
|
334
334
|
/***/ }),
|
|
335
335
|
|
|
@@ -834,7 +834,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
834
834
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
835
835
|
|
|
836
836
|
"use strict";
|
|
837
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../utils.js */ \"../node_modules/axios/lib/utils.js\");\n/* harmony import */ var _helpers_buildURL_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers/buildURL.js */ \"../node_modules/axios/lib/helpers/buildURL.js\");\n/* harmony import */ var _InterceptorManager_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./InterceptorManager.js */ \"../node_modules/axios/lib/core/InterceptorManager.js\");\n/* harmony import */ var _dispatchRequest_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./dispatchRequest.js */ \"../node_modules/axios/lib/core/dispatchRequest.js\");\n/* harmony import */ var _mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mergeConfig.js */ \"../node_modules/axios/lib/core/mergeConfig.js\");\n/* harmony import */ var _buildFullPath_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./buildFullPath.js */ \"../node_modules/axios/lib/core/buildFullPath.js\");\n/* harmony import */ var _helpers_validator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers/validator.js */ \"../node_modules/axios/lib/helpers/validator.js\");\n/* harmony import */ var _AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./AxiosHeaders.js */ \"../node_modules/axios/lib/core/AxiosHeaders.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst validators = _helpers_validator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new _InterceptorManager_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](),\n response: new _InterceptorManager_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = (0,_mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n _helpers_validator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (_utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n _helpers_validator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && _utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].merge(\n headers.common,\n headers[config.method]\n );\n\n headers && _utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = _AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [_dispatchRequest_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = _dispatchRequest_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = (0,_mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(this.defaults, config);\n const fullPath = (0,_buildFullPath_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(config.baseURL, config.url);\n return (0,_helpers_buildURL_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\n_utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request((0,_mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\n_utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request((0,_mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Axios);\n\n\n//# sourceURL=webpack://contentful/../node_modules/axios/lib/core/Axios.js?");
|
|
837
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../utils.js */ \"../node_modules/axios/lib/utils.js\");\n/* harmony import */ var _helpers_buildURL_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers/buildURL.js */ \"../node_modules/axios/lib/helpers/buildURL.js\");\n/* harmony import */ var _InterceptorManager_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./InterceptorManager.js */ \"../node_modules/axios/lib/core/InterceptorManager.js\");\n/* harmony import */ var _dispatchRequest_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./dispatchRequest.js */ \"../node_modules/axios/lib/core/dispatchRequest.js\");\n/* harmony import */ var _mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mergeConfig.js */ \"../node_modules/axios/lib/core/mergeConfig.js\");\n/* harmony import */ var _buildFullPath_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./buildFullPath.js */ \"../node_modules/axios/lib/core/buildFullPath.js\");\n/* harmony import */ var _helpers_validator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers/validator.js */ \"../node_modules/axios/lib/helpers/validator.js\");\n/* harmony import */ var _AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./AxiosHeaders.js */ \"../node_modules/axios/lib/core/AxiosHeaders.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst validators = _helpers_validator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new _InterceptorManager_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](),\n response: new _InterceptorManager_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = (0,_mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n _helpers_validator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (_utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n _helpers_validator_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && _utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].merge(\n headers.common,\n headers[config.method]\n );\n\n headers && _utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = _AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [_dispatchRequest_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = _dispatchRequest_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = (0,_mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(this.defaults, config);\n const fullPath = (0,_buildFullPath_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(config.baseURL, config.url);\n return (0,_helpers_buildURL_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\n_utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request((0,_mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\n_utils_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request((0,_mergeConfig_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Axios);\n\n\n//# sourceURL=webpack://contentful/../node_modules/axios/lib/core/Axios.js?");
|
|
838
838
|
|
|
839
839
|
/***/ }),
|
|
840
840
|
|
|
@@ -933,7 +933,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
933
933
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
934
934
|
|
|
935
935
|
"use strict";
|
|
936
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ \"../node_modules/axios/lib/utils.js\");\n/* harmony import */ var _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../core/AxiosError.js */ \"../node_modules/axios/lib/core/AxiosError.js\");\n/* harmony import */ var _transitional_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transitional.js */ \"../node_modules/axios/lib/defaults/transitional.js\");\n/* harmony import */ var _helpers_toFormData_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers/toFormData.js */ \"../node_modules/axios/lib/helpers/toFormData.js\");\n/* harmony import */ var _helpers_toURLEncodedForm_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helpers/toURLEncodedForm.js */ \"../node_modules/axios/lib/helpers/toURLEncodedForm.js\");\n/* harmony import */ var _platform_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../platform/index.js */ \"../node_modules/axios/lib/platform/index.js\");\n/* harmony import */ var _helpers_formDataToJSON_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../helpers/formDataToJSON.js */ \"../node_modules/axios/lib/helpers/formDataToJSON.js\");\n\n\n\n\n\n\n\n\n\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (_utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: _transitional_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n\n adapter: ['xhr', 'http'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isObject(data);\n\n if (isObjectPayload && _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isFormData(data);\n\n if (isFormData) {\n
|
|
936
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ \"../node_modules/axios/lib/utils.js\");\n/* harmony import */ var _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../core/AxiosError.js */ \"../node_modules/axios/lib/core/AxiosError.js\");\n/* harmony import */ var _transitional_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transitional.js */ \"../node_modules/axios/lib/defaults/transitional.js\");\n/* harmony import */ var _helpers_toFormData_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers/toFormData.js */ \"../node_modules/axios/lib/helpers/toFormData.js\");\n/* harmony import */ var _helpers_toURLEncodedForm_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helpers/toURLEncodedForm.js */ \"../node_modules/axios/lib/helpers/toURLEncodedForm.js\");\n/* harmony import */ var _platform_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../platform/index.js */ \"../node_modules/axios/lib/platform/index.js\");\n/* harmony import */ var _helpers_formDataToJSON_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../helpers/formDataToJSON.js */ \"../node_modules/axios/lib/helpers/formDataToJSON.js\");\n\n\n\n\n\n\n\n\n\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (_utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: _transitional_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n\n adapter: ['xhr', 'http'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isObject(data);\n\n if (isObjectPayload && _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify((0,_helpers_formDataToJSON_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(data)) : data;\n }\n\n if (_utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isArrayBuffer(data) ||\n _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isBuffer(data) ||\n _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isStream(data) ||\n _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isFile(data) ||\n _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isBlob(data)\n ) {\n return data;\n }\n if (_utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isArrayBufferView(data)) {\n return data.buffer;\n }\n if (_utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return (0,_helpers_toURLEncodedForm_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(data, this.formSerializer).toString();\n }\n\n if ((isFileList = _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return (0,_helpers_toFormData_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (data && _utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].from(e, _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"].ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: _platform_index_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].classes.FormData,\n Blob: _platform_index_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\n_utils_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (defaults);\n\n\n//# sourceURL=webpack://contentful/../node_modules/axios/lib/defaults/index.js?");
|
|
937
937
|
|
|
938
938
|
/***/ }),
|
|
939
939
|
|
|
@@ -955,7 +955,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n\n\n/* harmony default export
|
|
|
955
955
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
956
956
|
|
|
957
957
|
"use strict";
|
|
958
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ VERSION: function() { return /* binding */ VERSION; }\n/* harmony export */ });\nconst VERSION = \"1.6.
|
|
958
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ VERSION: function() { return /* binding */ VERSION; }\n/* harmony export */ });\nconst VERSION = \"1.6.7\";\n\n//# sourceURL=webpack://contentful/../node_modules/axios/lib/env/data.js?");
|
|
959
959
|
|
|
960
960
|
/***/ }),
|
|
961
961
|
|