contentful-management 7.5.2 → 7.7.0

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.
@@ -124,6 +124,31 @@ var enhanceError = __webpack_require__(/*! ../core/enhanceError */ "../node_modu
124
124
 
125
125
  var isHttps = /https:?/;
126
126
 
127
+ /**
128
+ *
129
+ * @param {http.ClientRequestArgs} options
130
+ * @param {AxiosProxyConfig} proxy
131
+ * @param {string} location
132
+ */
133
+ function setProxy(options, proxy, location) {
134
+ options.hostname = proxy.host;
135
+ options.host = proxy.host;
136
+ options.port = proxy.port;
137
+ options.path = location;
138
+
139
+ // Basic proxy authorization
140
+ if (proxy.auth) {
141
+ var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
142
+ options.headers['Proxy-Authorization'] = 'Basic ' + base64;
143
+ }
144
+
145
+ // If a proxy is used, any redirects must also pass through the proxy
146
+ options.beforeRedirect = function beforeRedirect(redirection) {
147
+ redirection.headers.host = redirection.host;
148
+ setProxy(redirection, proxy, redirection.href);
149
+ };
150
+ }
151
+
127
152
  /*eslint consistent-return:0*/
128
153
  module.exports = function httpAdapter(config) {
129
154
  return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
@@ -234,11 +259,11 @@ module.exports = function httpAdapter(config) {
234
259
  });
235
260
  }
236
261
 
237
-
238
262
  if (shouldProxy) {
239
263
  proxy = {
240
264
  host: parsedProxyUrl.hostname,
241
- port: parsedProxyUrl.port
265
+ port: parsedProxyUrl.port,
266
+ protocol: parsedProxyUrl.protocol
242
267
  };
243
268
 
244
269
  if (parsedProxyUrl.auth) {
@@ -253,17 +278,8 @@ module.exports = function httpAdapter(config) {
253
278
  }
254
279
 
255
280
  if (proxy) {
256
- options.hostname = proxy.host;
257
- options.host = proxy.host;
258
281
  options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
259
- options.port = proxy.port;
260
- options.path = protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path;
261
-
262
- // Basic proxy authorization
263
- if (proxy.auth) {
264
- var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
265
- options.headers['Proxy-Authorization'] = 'Basic ' + base64;
266
- }
282
+ setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
267
283
  }
268
284
 
269
285
  var transport;
@@ -645,6 +661,9 @@ axios.all = function all(promises) {
645
661
  };
646
662
  axios.spread = __webpack_require__(/*! ./helpers/spread */ "../node_modules/axios/lib/helpers/spread.js");
647
663
 
664
+ // Expose isAxiosError
665
+ axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "../node_modules/axios/lib/helpers/isAxiosError.js");
666
+
648
667
  module.exports = axios;
649
668
 
650
669
  // Allow use of default import syntax in TypeScript
@@ -1646,6 +1665,29 @@ module.exports = function isAbsoluteURL(url) {
1646
1665
  };
1647
1666
 
1648
1667
 
1668
+ /***/ }),
1669
+
1670
+ /***/ "../node_modules/axios/lib/helpers/isAxiosError.js":
1671
+ /*!*********************************************************!*\
1672
+ !*** ../node_modules/axios/lib/helpers/isAxiosError.js ***!
1673
+ \*********************************************************/
1674
+ /*! no static exports found */
1675
+ /***/ (function(module, exports, __webpack_require__) {
1676
+
1677
+ "use strict";
1678
+
1679
+
1680
+ /**
1681
+ * Determines whether the payload is an error thrown by Axios
1682
+ *
1683
+ * @param {*} payload The value to test
1684
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
1685
+ */
1686
+ module.exports = function isAxiosError(payload) {
1687
+ return (typeof payload === 'object') && (payload.isAxiosError === true);
1688
+ };
1689
+
1690
+
1649
1691
  /***/ }),
1650
1692
 
1651
1693
  /***/ "../node_modules/axios/lib/helpers/isURLSameOrigin.js":
@@ -2648,7 +2690,7 @@ function wrap(protocols) {
2648
2690
  var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
2649
2691
 
2650
2692
  // Executes a request, following redirects
2651
- wrappedProtocol.request = function (input, options, callback) {
2693
+ function request(input, options, callback) {
2652
2694
  // Parse parameters
2653
2695
  if (typeof input === "string") {
2654
2696
  var urlStr = input;
@@ -2683,14 +2725,20 @@ function wrap(protocols) {
2683
2725
  assert.equal(options.protocol, protocol, "protocol mismatch");
2684
2726
  debug("options", options);
2685
2727
  return new RedirectableRequest(options, callback);
2686
- };
2728
+ }
2687
2729
 
2688
2730
  // Executes a GET request, following redirects
2689
- wrappedProtocol.get = function (input, options, callback) {
2690
- var request = wrappedProtocol.request(input, options, callback);
2691
- request.end();
2692
- return request;
2693
- };
2731
+ function get(input, options, callback) {
2732
+ var wrappedRequest = wrappedProtocol.request(input, options, callback);
2733
+ wrappedRequest.end();
2734
+ return wrappedRequest;
2735
+ }
2736
+
2737
+ // Expose the properties on the wrapped protocol
2738
+ Object.defineProperties(wrappedProtocol, {
2739
+ request: { value: request, configurable: true, enumerable: true, writable: true },
2740
+ get: { value: get, configurable: true, enumerable: true, writable: true },
2741
+ });
2694
2742
  });
2695
2743
  return exports;
2696
2744
  }
@@ -2755,7 +2803,7 @@ module.exports.wrap = wrap;
2755
2803
  /*! exports provided: _args, _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _spec, _where, author, browser, bugs, bundlesize, dependencies, description, devDependencies, homepage, jsdelivr, keywords, license, main, name, repository, scripts, typings, unpkg, version, default */
2756
2804
  /***/ (function(module) {
2757
2805
 
2758
- module.exports = JSON.parse("{\"_args\":[[\"axios@0.21.0\",\"/home/circleci/project\"]],\"_from\":\"axios@0.21.0\",\"_id\":\"axios@0.21.0\",\"_inBundle\":false,\"_integrity\":\"sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==\",\"_location\":\"/axios\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"axios@0.21.0\",\"name\":\"axios\",\"escapedName\":\"axios\",\"rawSpec\":\"0.21.0\",\"saveSpec\":null,\"fetchSpec\":\"0.21.0\"},\"_requiredBy\":[\"/\"],\"_resolved\":\"https://registry.npmjs.org/axios/-/axios-0.21.0.tgz\",\"_spec\":\"0.21.0\",\"_where\":\"/home/circleci/project\",\"author\":{\"name\":\"Matt Zabriskie\"},\"browser\":{\"./lib/adapters/http.js\":\"./lib/adapters/xhr.js\"},\"bugs\":{\"url\":\"https://github.com/axios/axios/issues\"},\"bundlesize\":[{\"path\":\"./dist/axios.min.js\",\"threshold\":\"5kB\"}],\"dependencies\":{\"follow-redirects\":\"^1.10.0\"},\"description\":\"Promise based HTTP client for the browser and node.js\",\"devDependencies\":{\"bundlesize\":\"^0.17.0\",\"coveralls\":\"^3.0.0\",\"es6-promise\":\"^4.2.4\",\"grunt\":\"^1.0.2\",\"grunt-banner\":\"^0.6.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-clean\":\"^1.1.0\",\"grunt-contrib-watch\":\"^1.0.0\",\"grunt-eslint\":\"^20.1.0\",\"grunt-karma\":\"^2.0.0\",\"grunt-mocha-test\":\"^0.13.3\",\"grunt-ts\":\"^6.0.0-beta.19\",\"grunt-webpack\":\"^1.0.18\",\"istanbul-instrumenter-loader\":\"^1.0.0\",\"jasmine-core\":\"^2.4.1\",\"karma\":\"^1.3.0\",\"karma-chrome-launcher\":\"^2.2.0\",\"karma-coverage\":\"^1.1.1\",\"karma-firefox-launcher\":\"^1.1.0\",\"karma-jasmine\":\"^1.1.1\",\"karma-jasmine-ajax\":\"^0.1.13\",\"karma-opera-launcher\":\"^1.0.0\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-sauce-launcher\":\"^1.2.0\",\"karma-sinon\":\"^1.0.5\",\"karma-sourcemap-loader\":\"^0.3.7\",\"karma-webpack\":\"^1.7.0\",\"load-grunt-tasks\":\"^3.5.2\",\"minimist\":\"^1.2.0\",\"mocha\":\"^5.2.0\",\"sinon\":\"^4.5.0\",\"typescript\":\"^2.8.1\",\"url-search-params\":\"^0.10.0\",\"webpack\":\"^1.13.1\",\"webpack-dev-server\":\"^1.14.1\"},\"homepage\":\"https://github.com/axios/axios\",\"jsdelivr\":\"dist/axios.min.js\",\"keywords\":[\"xhr\",\"http\",\"ajax\",\"promise\",\"node\"],\"license\":\"MIT\",\"main\":\"index.js\",\"name\":\"axios\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/axios/axios.git\"},\"scripts\":{\"build\":\"NODE_ENV=production grunt build\",\"coveralls\":\"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\",\"examples\":\"node ./examples/server.js\",\"fix\":\"eslint --fix lib/**/*.js\",\"postversion\":\"git push && git push --tags\",\"preversion\":\"npm test\",\"start\":\"node ./sandbox/server.js\",\"test\":\"grunt test && bundlesize\",\"version\":\"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json\"},\"typings\":\"./index.d.ts\",\"unpkg\":\"dist/axios.min.js\",\"version\":\"0.21.0\"}");
2806
+ module.exports = JSON.parse("{\"_args\":[[\"axios@0.21.1\",\"/home/circleci/project\"]],\"_from\":\"axios@0.21.1\",\"_id\":\"axios@0.21.1\",\"_inBundle\":false,\"_integrity\":\"sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==\",\"_location\":\"/axios\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"axios@0.21.1\",\"name\":\"axios\",\"escapedName\":\"axios\",\"rawSpec\":\"0.21.1\",\"saveSpec\":null,\"fetchSpec\":\"0.21.1\"},\"_requiredBy\":[\"/\"],\"_resolved\":\"https://registry.npmjs.org/axios/-/axios-0.21.1.tgz\",\"_spec\":\"0.21.1\",\"_where\":\"/home/circleci/project\",\"author\":{\"name\":\"Matt Zabriskie\"},\"browser\":{\"./lib/adapters/http.js\":\"./lib/adapters/xhr.js\"},\"bugs\":{\"url\":\"https://github.com/axios/axios/issues\"},\"bundlesize\":[{\"path\":\"./dist/axios.min.js\",\"threshold\":\"5kB\"}],\"dependencies\":{\"follow-redirects\":\"^1.10.0\"},\"description\":\"Promise based HTTP client for the browser and node.js\",\"devDependencies\":{\"bundlesize\":\"^0.17.0\",\"coveralls\":\"^3.0.0\",\"es6-promise\":\"^4.2.4\",\"grunt\":\"^1.0.2\",\"grunt-banner\":\"^0.6.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-clean\":\"^1.1.0\",\"grunt-contrib-watch\":\"^1.0.0\",\"grunt-eslint\":\"^20.1.0\",\"grunt-karma\":\"^2.0.0\",\"grunt-mocha-test\":\"^0.13.3\",\"grunt-ts\":\"^6.0.0-beta.19\",\"grunt-webpack\":\"^1.0.18\",\"istanbul-instrumenter-loader\":\"^1.0.0\",\"jasmine-core\":\"^2.4.1\",\"karma\":\"^1.3.0\",\"karma-chrome-launcher\":\"^2.2.0\",\"karma-coverage\":\"^1.1.1\",\"karma-firefox-launcher\":\"^1.1.0\",\"karma-jasmine\":\"^1.1.1\",\"karma-jasmine-ajax\":\"^0.1.13\",\"karma-opera-launcher\":\"^1.0.0\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-sauce-launcher\":\"^1.2.0\",\"karma-sinon\":\"^1.0.5\",\"karma-sourcemap-loader\":\"^0.3.7\",\"karma-webpack\":\"^1.7.0\",\"load-grunt-tasks\":\"^3.5.2\",\"minimist\":\"^1.2.0\",\"mocha\":\"^5.2.0\",\"sinon\":\"^4.5.0\",\"typescript\":\"^2.8.1\",\"url-search-params\":\"^0.10.0\",\"webpack\":\"^1.13.1\",\"webpack-dev-server\":\"^1.14.1\"},\"homepage\":\"https://github.com/axios/axios\",\"jsdelivr\":\"dist/axios.min.js\",\"keywords\":[\"xhr\",\"http\",\"ajax\",\"promise\",\"node\"],\"license\":\"MIT\",\"main\":\"index.js\",\"name\":\"axios\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/axios/axios.git\"},\"scripts\":{\"build\":\"NODE_ENV=production grunt build\",\"coveralls\":\"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\",\"examples\":\"node ./examples/server.js\",\"fix\":\"eslint --fix lib/**/*.js\",\"postversion\":\"git push && git push --tags\",\"preversion\":\"npm test\",\"start\":\"node ./sandbox/server.js\",\"test\":\"grunt test && bundlesize\",\"version\":\"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json\"},\"typings\":\"./index.d.ts\",\"unpkg\":\"dist/axios.min.js\",\"version\":\"0.21.1\"}");
2759
2807
 
2760
2808
  /***/ }),
2761
2809
 
@@ -4369,8 +4417,7 @@ function copy(object, options) {
4369
4417
  }
4370
4418
  // blobs
4371
4419
  if (realm.Blob && object instanceof realm.Blob) {
4372
- clone = new Blob([object], { type: object.type });
4373
- return clone;
4420
+ return object.slice(0, object.size, object.type);
4374
4421
  }
4375
4422
  // buffers (node-only)
4376
4423
  if (realm.Buffer && realm.Buffer.isBuffer(object)) {
@@ -4413,6 +4460,10 @@ function copy(object, options) {
4413
4460
  };
4414
4461
  return handleCopy(object, createCache());
4415
4462
  }
4463
+ // Adding reference to allow usage in CommonJS libraries compiled using TSC, which
4464
+ // expects there to be a default property on the exported object. See
4465
+ // [#37](https://github.com/planttheidea/fast-copy/issues/37) for details.
4466
+ copy.default = copy;
4416
4467
  /**
4417
4468
  * @function strictCopy
4418
4469
  *
@@ -5904,7 +5955,7 @@ const defaultHostParameters = {
5904
5955
  function createCMAHttpClient(params, plainClient = false) {
5905
5956
  const sdkMain = plainClient ? 'contentful-management-plain.js' : 'contentful-management.js';
5906
5957
  const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])( // @ts-expect-error
5907
- `${sdkMain}/${"7.5.2"}`, params.application, params.integration, params.feature);
5958
+ `${sdkMain}/${"7.7.0"}`, params.application, params.integration, params.feature);
5908
5959
  const requiredHeaders = {
5909
5960
  'Content-Type': 'application/vnd.contentful.management.v1+json',
5910
5961
  'X-Contentful-User-Agent': userAgentHeader
@@ -6084,8 +6135,8 @@ function createClientApi({
6084
6135
  * .catch(console.error)
6085
6136
  * ```
6086
6137
  */
6087
- getCurrentUser: function getCurrentUser() {
6088
- return _plain_endpoints__WEBPACK_IMPORTED_MODULE_3__["user"].getCurrent(http).then(data => wrapUser(http, data));
6138
+ getCurrentUser: function getCurrentUser(params) {
6139
+ return _plain_endpoints__WEBPACK_IMPORTED_MODULE_3__["user"].getCurrent(http, params).then(data => wrapUser(http, data));
6089
6140
  },
6090
6141
 
6091
6142
  /**
@@ -13063,7 +13114,9 @@ __webpack_require__.r(__webpack_exports__);
13063
13114
  const getForSpace = (http, params) => {
13064
13115
  return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, `/spaces/${params.spaceId}/users/${params.userId}`);
13065
13116
  };
13066
- const getCurrent = http => _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, `/users/me`);
13117
+ const getCurrent = (http, params) => _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, `/users/me`, {
13118
+ params: params === null || params === void 0 ? void 0 : params.query
13119
+ });
13067
13120
  const getManyForSpace = (http, params) => {
13068
13121
  return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, `/spaces/${params.spaceId}/users`, {
13069
13122
  params: params.query
@@ -13310,7 +13363,19 @@ const createPlainClient = (params, defaults) => {
13310
13363
  user: {
13311
13364
  getManyForSpace: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrap"])(wrapParams, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getManyForSpace),
13312
13365
  getForSpace: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrap"])(wrapParams, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getForSpace),
13313
- getCurrent: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrapHttp"])(_http, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getCurrent),
13366
+ getCurrent: function (_getCurrent) {
13367
+ function getCurrent() {
13368
+ return _getCurrent.apply(this, arguments);
13369
+ }
13370
+
13371
+ getCurrent.toString = function () {
13372
+ return _getCurrent.toString();
13373
+ };
13374
+
13375
+ return getCurrent;
13376
+ }((...args) => {
13377
+ return _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getCurrent(_http, ...args);
13378
+ }),
13314
13379
  getForOrganization: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrap"])(wrapParams, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getForOrganization),
13315
13380
  getManyForOrganization: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrap"])(wrapParams, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getManyForOrganization)
13316
13381
  },