contentful-management 8.0.0 → 8.1.3

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
@@ -102,24 +102,12 @@ You can use the es6 import with the library as follow
102
102
 
103
103
  ```js
104
104
  // import createClient directly
105
- import { createClient } from 'contentful-management'
106
- const client = createClient({
107
- // This is the access token for this space. Normally you get the token in the Contentful web app
108
- accessToken: 'YOUR_ACCESS_TOKEN',
109
- })
110
- //....
111
- ```
112
-
113
- OR
114
-
115
- ```js
116
- // import everything from contentful
117
- import * as contentful from 'contentful-management'
105
+ import contentful from 'contentful-management'
118
106
  const client = contentful.createClient({
119
107
  // This is the access token for this space. Normally you get the token in the Contentful web app
120
108
  accessToken: 'YOUR_ACCESS_TOKEN',
121
109
  })
122
- // ....
110
+ //....
123
111
  ```
124
112
 
125
113
  ## Your first request
@@ -327,7 +315,7 @@ Interceptor called on every response. Takes Axios response object as an arg. Def
327
315
 
328
316
  #### apiAdapter (default: `new RestAdapter(configuration)`)
329
317
 
330
- An [`Adapter`](https://github.com/contentful/contentful-management.js/blob/2350b47053459694b21b19c71025632fe57815cc/lib/common-types.ts#L493-L495)
318
+ An [`Adapter`](https://github.com/contentful/contentful-management.js/blob/2350b47053459694b21b19c71025632fe57815cc/lib/common-types.ts#L493-L495)
331
319
  that can be utilized to issue requests. It defaults to a [`RestAdapter`](https://github.com/contentful/contentful-management.js/blob/b50534c629a8ddc81637170a07bc63477d136cec/lib/adapters/REST/rest-adapter.ts)
332
320
  initialized with provided configuration.
333
321
 
@@ -337,9 +325,11 @@ initialized with provided configuration.
337
325
  > information it needs to issue the request (e.g., host or auth headers)
338
326
 
339
327
  #### throttle (default: `0`)
328
+
340
329
  Maximum number of requests per second.
341
- - `1`-`30` (fixed number of limit),
342
- - `'auto'` (calculated limit based on your plan),
330
+
331
+ - `1`-`30` (fixed number of limit),
332
+ - `'auto'` (calculated limit based on your plan),
343
333
  - `'0%'` - `'100%'` (calculated % limit based on your plan)
344
334
 
345
335
  ### Reference documentation
@@ -625,10 +625,6 @@ Axios.prototype.request = function request(configOrUrl, config) {
625
625
  config = configOrUrl || {};
626
626
  }
627
627
 
628
- if (!config.url) {
629
- throw new Error('Provided config url is not valid');
630
- }
631
-
632
628
  config = mergeConfig(this.defaults, config);
633
629
 
634
630
  // Set config.method
@@ -711,9 +707,6 @@ Axios.prototype.request = function request(configOrUrl, config) {
711
707
  };
712
708
 
713
709
  Axios.prototype.getUri = function getUri(config) {
714
- if (!config.url) {
715
- throw new Error('Provided config url is not valid');
716
- }
717
710
  config = mergeConfig(this.defaults, config);
718
711
  return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
719
712
  };
@@ -1365,7 +1358,7 @@ module.exports = defaults;
1365
1358
  /***/ (function(module, exports) {
1366
1359
 
1367
1360
  module.exports = {
1368
- "version": "0.25.0"
1361
+ "version": "0.26.0"
1369
1362
  };
1370
1363
 
1371
1364
  /***/ }),
@@ -6616,7 +6609,11 @@ var getMany = function getMany(http, params) {
6616
6609
  };
6617
6610
  var upsert = function upsert(http, params, rawData, headers) {
6618
6611
  var data = fast_copy__WEBPACK_IMPORTED_MODULE_2___default()(rawData);
6619
- return _raw__WEBPACK_IMPORTED_MODULE_0__["put"](http, getAppInstallationUrl(params), data, _objectSpread({}, headers));
6612
+ return _raw__WEBPACK_IMPORTED_MODULE_0__["put"](http, getAppInstallationUrl(params), data, {
6613
+ headers: _objectSpread(_objectSpread({}, headers), params.acceptAllTerms && {
6614
+ 'X-Contentful-Marketplace': 'i-accept-end-user-license-agreement,i-accept-marketplace-terms-of-service,i-accept-privacy-policy'
6615
+ })
6616
+ });
6620
6617
  };
6621
6618
  var del = function del(http, params) {
6622
6619
  return _raw__WEBPACK_IMPORTED_MODULE_0__["del"](http, getAppInstallationUrl(params));
@@ -10135,7 +10132,7 @@ function createClient(params) {
10135
10132
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10136
10133
  var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
10137
10134
  var userAgent = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["getUserAgentHeader"])( // @ts-expect-error
10138
- "".concat(sdkMain, "/").concat("8.0.0"), params.application, params.integration, params.feature);
10135
+ "".concat(sdkMain, "/").concat("8.1.3"), params.application, params.integration, params.feature);
10139
10136
  var adapter = Object(_create_adapter__WEBPACK_IMPORTED_MODULE_1__["createAdapter"])(params); // Parameters<?> and ReturnType<?> only return the types of the last overload
10140
10137
  // https://github.com/microsoft/TypeScript/issues/26591
10141
10138
  // @ts-expect-error
@@ -12843,6 +12840,7 @@ function createEnvironmentApi(makeRequest) {
12843
12840
  * Creates an App Installation
12844
12841
  * @param appDefinitionId - AppDefinition ID
12845
12842
  * @param data - AppInstallation data
12843
+ * @param options.acceptAllTerms - Flag for accepting Apps' Marketplace EULA, Terms, and Privacy policy (need to pass `{acceptAllTerms: true}` to install a marketplace app)
12846
12844
  * @return Promise for an App Installation
12847
12845
  * @example ```javascript
12848
12846
  * const contentful = require('contentful-management')
@@ -12863,6 +12861,9 @@ function createEnvironmentApi(makeRequest) {
12863
12861
  * ```
12864
12862
  */
12865
12863
  createAppInstallation: function createAppInstallation(appDefinitionId, data) {
12864
+ var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
12865
+ acceptAllTerms = _ref.acceptAllTerms;
12866
+
12866
12867
  var raw = this.toPlainObject();
12867
12868
  return makeRequest({
12868
12869
  entityType: 'AppInstallation',
@@ -12870,7 +12871,8 @@ function createEnvironmentApi(makeRequest) {
12870
12871
  params: {
12871
12872
  spaceId: raw.sys.space.sys.id,
12872
12873
  environmentId: raw.sys.id,
12873
- appDefinitionId: appDefinitionId
12874
+ appDefinitionId: appDefinitionId,
12875
+ acceptAllTerms: acceptAllTerms
12874
12876
  },
12875
12877
  payload: data
12876
12878
  }).then(function (payload) {
@@ -13299,10 +13301,10 @@ function createEnvironmentApi(makeRequest) {
13299
13301
  * .catch(console.error)
13300
13302
  * ```
13301
13303
  */
13302
- updateRelease: function updateRelease(_ref) {
13303
- var releaseId = _ref.releaseId,
13304
- payload = _ref.payload,
13305
- version = _ref.version;
13304
+ updateRelease: function updateRelease(_ref2) {
13305
+ var releaseId = _ref2.releaseId,
13306
+ payload = _ref2.payload,
13307
+ version = _ref2.version;
13306
13308
  var raw = this.toPlainObject();
13307
13309
  return makeRequest({
13308
13310
  entityType: 'Release',
@@ -13369,9 +13371,9 @@ function createEnvironmentApi(makeRequest) {
13369
13371
  * .catch(console.error)
13370
13372
  * ```
13371
13373
  */
13372
- publishRelease: function publishRelease(_ref2) {
13373
- var releaseId = _ref2.releaseId,
13374
- version = _ref2.version;
13374
+ publishRelease: function publishRelease(_ref3) {
13375
+ var releaseId = _ref3.releaseId,
13376
+ version = _ref3.version;
13375
13377
  var raw = this.toPlainObject();
13376
13378
  return makeRequest({
13377
13379
  entityType: 'Release',
@@ -13406,9 +13408,9 @@ function createEnvironmentApi(makeRequest) {
13406
13408
  * .catch(console.error)
13407
13409
  * ```
13408
13410
  */
13409
- unpublishRelease: function unpublishRelease(_ref3) {
13410
- var releaseId = _ref3.releaseId,
13411
- version = _ref3.version;
13411
+ unpublishRelease: function unpublishRelease(_ref4) {
13412
+ var releaseId = _ref4.releaseId,
13413
+ version = _ref4.version;
13412
13414
  var raw = this.toPlainObject();
13413
13415
  return makeRequest({
13414
13416
  entityType: 'Release',
@@ -13444,9 +13446,9 @@ function createEnvironmentApi(makeRequest) {
13444
13446
  * .catch(console.error)
13445
13447
  * ```
13446
13448
  */
13447
- validateRelease: function validateRelease(_ref4) {
13448
- var releaseId = _ref4.releaseId,
13449
- payload = _ref4.payload;
13449
+ validateRelease: function validateRelease(_ref5) {
13450
+ var releaseId = _ref5.releaseId,
13451
+ payload = _ref5.payload;
13450
13452
  var raw = this.toPlainObject();
13451
13453
  return makeRequest({
13452
13454
  entityType: 'Release',
@@ -13481,9 +13483,9 @@ function createEnvironmentApi(makeRequest) {
13481
13483
  * .catch(console.error)
13482
13484
  * ```
13483
13485
  */
13484
- getReleaseAction: function getReleaseAction(_ref5) {
13485
- var actionId = _ref5.actionId,
13486
- releaseId = _ref5.releaseId;
13486
+ getReleaseAction: function getReleaseAction(_ref6) {
13487
+ var actionId = _ref6.actionId,
13488
+ releaseId = _ref6.releaseId;
13487
13489
  var raw = this.toPlainObject();
13488
13490
  return makeRequest({
13489
13491
  entityType: 'ReleaseAction',
@@ -13519,9 +13521,9 @@ function createEnvironmentApi(makeRequest) {
13519
13521
  * .catch(console.error)
13520
13522
  * ```
13521
13523
  */
13522
- getReleaseActions: function getReleaseActions(_ref6) {
13523
- var releaseId = _ref6.releaseId,
13524
- query = _ref6.query;
13524
+ getReleaseActions: function getReleaseActions(_ref7) {
13525
+ var releaseId = _ref7.releaseId,
13526
+ query = _ref7.query;
13525
13527
  var raw = this.toPlainObject();
13526
13528
  return makeRequest({
13527
13529
  entityType: 'ReleaseAction',