contentful-management 7.5.3 → 7.8.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
- ## [7.5.3](https://github.com/contentful/contentful-management.js/compare/v7.5.2...v7.5.3) (2021-01-28)
1
+ # [7.8.0](https://github.com/contentful/contentful-management.js/compare/v7.7.0...v7.8.0) (2021-02-09)
2
2
 
3
3
 
4
- ### Bug Fixes
4
+ ### Features
5
5
 
6
- * improve generics in raw plain client endpoints ([#661](https://github.com/contentful/contentful-management.js/issues/661)) ([433d883](https://github.com/contentful/contentful-management.js/commit/433d8836e1f5198488197f80974a8aa9f2e00cf8))
6
+ * be able to directly delete an entry by its Id ([#610](https://github.com/contentful/contentful-management.js/issues/610)) ([99f8c40](https://github.com/contentful/contentful-management.js/commit/99f8c40a1893f1f76fc3329cc88f2c239d984333))
@@ -4364,7 +4364,7 @@ function createCMAHttpClient(params) {
4364
4364
  var plainClient = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4365
4365
  var sdkMain = plainClient ? 'contentful-management-plain.js' : 'contentful-management.js';
4366
4366
  var userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])( // @ts-expect-error
4367
- "".concat(sdkMain, "/").concat("7.5.3"), params.application, params.integration, params.feature);
4367
+ "".concat(sdkMain, "/").concat("7.8.0"), params.application, params.integration, params.feature);
4368
4368
  var requiredHeaders = {
4369
4369
  'Content-Type': 'application/vnd.contentful.management.v1+json',
4370
4370
  'X-Contentful-User-Agent': userAgentHeader
@@ -4550,8 +4550,8 @@ function createClientApi(_ref) {
4550
4550
  * .catch(console.error)
4551
4551
  * ```
4552
4552
  */
4553
- getCurrentUser: function getCurrentUser() {
4554
- return _plain_endpoints__WEBPACK_IMPORTED_MODULE_3__["user"].getCurrent(http).then(function (data) {
4553
+ getCurrentUser: function getCurrentUser(params) {
4554
+ return _plain_endpoints__WEBPACK_IMPORTED_MODULE_3__["user"].getCurrent(http, params).then(function (data) {
4555
4555
  return wrapUser(http, data);
4556
4556
  });
4557
4557
  },
@@ -5134,6 +5134,34 @@ function createEnvironmentApi(_ref) {
5134
5134
  });
5135
5135
  },
5136
5136
 
5137
+ /**
5138
+ * Deletes an Entry of this environement
5139
+ * @param id - Entry ID
5140
+ * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
5141
+ * @example ```javascript
5142
+ * const contentful = require('contentful-management')
5143
+ *
5144
+ * const client = contentful.createClient({
5145
+ * accessToken: '<content_management_api_key>'
5146
+ * })
5147
+ *
5148
+ * client.getSpace('<space_id>')
5149
+ * .then((space) => space.getEnvironment('<environment-id>'))
5150
+ * .then((environment) => environment.deleteEntry("4bmLXiuviAZH3jkj5DLRWE"))
5151
+ * .then(() => console.log('Entry deleted.'))
5152
+ * .catch(console.error)
5153
+ * ```
5154
+ */
5155
+ deleteEntry: function deleteEntry(id) {
5156
+ var raw = this.toPlainObject();
5157
+ return _plain_endpoints__WEBPACK_IMPORTED_MODULE_2__["entry"].del(http, {
5158
+ spaceId: raw.sys.space.sys.id,
5159
+ environmentId: raw.sys.id,
5160
+ entryId: id
5161
+ }).then(function () {// noop
5162
+ });
5163
+ },
5164
+
5137
5165
  /**
5138
5166
  * Gets a collection of Entries
5139
5167
  * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
@@ -12042,8 +12070,10 @@ __webpack_require__.r(__webpack_exports__);
12042
12070
  var getForSpace = function getForSpace(http, params) {
12043
12071
  return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/spaces/".concat(params.spaceId, "/users/").concat(params.userId));
12044
12072
  };
12045
- var getCurrent = function getCurrent(http) {
12046
- return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/users/me");
12073
+ var getCurrent = function getCurrent(http, params) {
12074
+ return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/users/me", {
12075
+ params: params === null || params === void 0 ? void 0 : params.query
12076
+ });
12047
12077
  };
12048
12078
  var getManyForSpace = function getManyForSpace(http, params) {
12049
12079
  return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/spaces/".concat(params.spaceId, "/users"), {
@@ -12358,7 +12388,25 @@ var createPlainClient = function createPlainClient(params, defaults) {
12358
12388
  user: {
12359
12389
  getManyForSpace: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrap"])(wrapParams, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getManyForSpace),
12360
12390
  getForSpace: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrap"])(wrapParams, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getForSpace),
12361
- getCurrent: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrapHttp"])(_http, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getCurrent),
12391
+ getCurrent: function (_getCurrent) {
12392
+ function getCurrent() {
12393
+ return _getCurrent.apply(this, arguments);
12394
+ }
12395
+
12396
+ getCurrent.toString = function () {
12397
+ return _getCurrent.toString();
12398
+ };
12399
+
12400
+ return getCurrent;
12401
+ }(function () {
12402
+ var _endpoints$user;
12403
+
12404
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
12405
+ args[_key6] = arguments[_key6];
12406
+ }
12407
+
12408
+ return (_endpoints$user = _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"]).getCurrent.apply(_endpoints$user, [_http].concat(args));
12409
+ }),
12362
12410
  getForOrganization: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrap"])(wrapParams, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getForOrganization),
12363
12411
  getManyForOrganization: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_2__["wrap"])(wrapParams, _endpoints__WEBPACK_IMPORTED_MODULE_1__["user"].getManyForOrganization)
12364
12412
  },
@@ -12417,8 +12465,8 @@ var createPlainClient = function createPlainClient(params, defaults) {
12417
12465
  }(function () {
12418
12466
  var _endpoints$personalAc;
12419
12467
 
12420
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
12421
- args[_key6] = arguments[_key6];
12468
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
12469
+ args[_key7] = arguments[_key7];
12422
12470
  }
12423
12471
 
12424
12472
  return (_endpoints$personalAc = _endpoints__WEBPACK_IMPORTED_MODULE_1__["personalAccessToken"]).create.apply(_endpoints$personalAc, [_http].concat(args));