contentful-management 7.27.0 → 7.30.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 +2 -2
- package/dist/contentful-management.browser.js +378 -25
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.legacy.js +378 -25
- package/dist/contentful-management.legacy.js.map +1 -1
- package/dist/contentful-management.legacy.min.js +1 -1
- package/dist/contentful-management.node.js +350 -23
- package/dist/contentful-management.node.js.map +1 -1
- package/dist/contentful-management.node.min.js +1 -1
- package/dist/es-modules/adapters/REST/endpoints/scheduled-action.js +19 -0
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/create-space-api.js +196 -0
- package/dist/es-modules/entities/scheduled-action.js +153 -20
- package/dist/es-modules/plain/plain-client.js +5 -1
- package/dist/typings/adapters/REST/endpoints/scheduled-action.d.ts +2 -0
- package/dist/typings/common-types.d.ts +17 -0
- package/dist/typings/create-space-api.d.ts +156 -0
- package/dist/typings/entities/api-key.d.ts +20 -0
- package/dist/typings/entities/app-bundle.d.ts +20 -0
- package/dist/typings/entities/app-definition.d.ts +20 -0
- package/dist/typings/entities/app-installation.d.ts +20 -0
- package/dist/typings/entities/app-upload.d.ts +20 -0
- package/dist/typings/entities/asset.d.ts +20 -0
- package/dist/typings/entities/content-type.d.ts +20 -0
- package/dist/typings/entities/editor-interface.d.ts +20 -0
- package/dist/typings/entities/entry.d.ts +20 -0
- package/dist/typings/entities/environment-alias.d.ts +20 -0
- package/dist/typings/entities/environment.d.ts +20 -0
- package/dist/typings/entities/extension.d.ts +20 -0
- package/dist/typings/entities/locale.d.ts +20 -0
- package/dist/typings/entities/organization-membership.d.ts +20 -0
- package/dist/typings/entities/organization.d.ts +20 -0
- package/dist/typings/entities/personal-access-token.d.ts +20 -0
- package/dist/typings/entities/preview-api-key.d.ts +20 -0
- package/dist/typings/entities/release-action.d.ts +20 -0
- package/dist/typings/entities/release.d.ts +1 -0
- package/dist/typings/entities/role.d.ts +20 -0
- package/dist/typings/entities/scheduled-action.d.ts +23 -3
- package/dist/typings/entities/snapshot.d.ts +20 -0
- package/dist/typings/entities/space-member.d.ts +20 -0
- package/dist/typings/entities/space-membership.d.ts +20 -0
- package/dist/typings/entities/space.d.ts +20 -0
- package/dist/typings/entities/tag.d.ts +20 -0
- package/dist/typings/entities/task.d.ts +20 -0
- package/dist/typings/entities/team-membership.d.ts +20 -0
- package/dist/typings/entities/team-space-membership.d.ts +20 -0
- package/dist/typings/entities/team.d.ts +20 -0
- package/dist/typings/entities/usage.d.ts +20 -0
- package/dist/typings/entities/user.d.ts +20 -0
- package/dist/typings/entities/webhook.d.ts +20 -0
- package/dist/typings/export-types.d.ts +1 -1
- package/dist/typings/plain/common-types.d.ts +13 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# [7.
|
|
1
|
+
# [7.30.0](https://github.com/contentful/contentful-management.js/compare/v7.29.0...v7.30.0) (2021-07-16)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* **scheduledActions:** add get and delete support to the spaceClient [SPA-321] ([#887](https://github.com/contentful/contentful-management.js/issues/887)) ([2350b47](https://github.com/contentful/contentful-management.js/commit/2350b47053459694b21b19c71025632fe57815cc))
|
|
7
7
|
|
|
8
8
|
# CHANGELOG
|
|
9
9
|
|
|
@@ -7258,18 +7258,27 @@ var del = function del(http, params) {
|
|
|
7258
7258
|
/*!*****************************************************!*\
|
|
7259
7259
|
!*** ./adapters/REST/endpoints/scheduled-action.ts ***!
|
|
7260
7260
|
\*****************************************************/
|
|
7261
|
-
/*! exports provided: getMany, create, del */
|
|
7261
|
+
/*! exports provided: get, getMany, create, del, update */
|
|
7262
7262
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
7263
7263
|
|
|
7264
7264
|
"use strict";
|
|
7265
7265
|
__webpack_require__.r(__webpack_exports__);
|
|
7266
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; });
|
|
7266
7267
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMany", function() { return getMany; });
|
|
7267
7268
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; });
|
|
7268
7269
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "del", function() { return del; });
|
|
7270
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "update", function() { return update; });
|
|
7269
7271
|
/* harmony import */ var _raw__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./raw */ "./adapters/REST/endpoints/raw.ts");
|
|
7270
7272
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./adapters/REST/endpoints/utils.ts");
|
|
7271
7273
|
|
|
7272
7274
|
|
|
7275
|
+
var get = function get(http, params) {
|
|
7276
|
+
return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/spaces/".concat(params.spaceId, "/scheduled_actions/").concat(params.scheduledActionId), {
|
|
7277
|
+
params: {
|
|
7278
|
+
'environment.sys.id': params.environmentId
|
|
7279
|
+
}
|
|
7280
|
+
});
|
|
7281
|
+
};
|
|
7273
7282
|
var getMany = function getMany(http, params) {
|
|
7274
7283
|
return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/spaces/".concat(params.spaceId, "/scheduled_actions"), {
|
|
7275
7284
|
params: Object(_utils__WEBPACK_IMPORTED_MODULE_1__["normalizeSelect"])(params.query)
|
|
@@ -7285,6 +7294,18 @@ var del = function del(http, params) {
|
|
|
7285
7294
|
}
|
|
7286
7295
|
});
|
|
7287
7296
|
};
|
|
7297
|
+
var update = function update(http, params, data) {
|
|
7298
|
+
var _data$environment;
|
|
7299
|
+
|
|
7300
|
+
return _raw__WEBPACK_IMPORTED_MODULE_0__["put"](http, "/spaces/".concat(params.spaceId, "/scheduled_actions/").concat(params.scheduledActionId), data, {
|
|
7301
|
+
params: {
|
|
7302
|
+
'environment.sys.id': (_data$environment = data.environment) === null || _data$environment === void 0 ? void 0 : _data$environment.sys.id
|
|
7303
|
+
},
|
|
7304
|
+
headers: {
|
|
7305
|
+
'X-Contentful-Version': params.version
|
|
7306
|
+
}
|
|
7307
|
+
});
|
|
7308
|
+
};
|
|
7288
7309
|
|
|
7289
7310
|
/***/ }),
|
|
7290
7311
|
|
|
@@ -8802,7 +8823,7 @@ function createClient(params) {
|
|
|
8802
8823
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8803
8824
|
var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
8804
8825
|
var userAgent = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["getUserAgentHeader"])( // @ts-expect-error
|
|
8805
|
-
"".concat(sdkMain, "/").concat("7.
|
|
8826
|
+
"".concat(sdkMain, "/").concat("7.30.0"), params.application, params.integration, params.feature);
|
|
8806
8827
|
var adapter = Object(_create_adapter__WEBPACK_IMPORTED_MODULE_1__["createAdapter"])(params); // Parameters<?> and ReturnType<?> only return the types of the last overload
|
|
8807
8828
|
// https://github.com/microsoft/TypeScript/issues/26591
|
|
8808
8829
|
// @ts-expect-error
|
|
@@ -13984,6 +14005,22 @@ function createSpaceApi(makeRequest) {
|
|
|
13984
14005
|
* Query for scheduled actions in space.
|
|
13985
14006
|
* @param query - Object with search parameters. The enviroment id field is mandatory. Check the <a href="https://www.contentful.com/developers/docs/references/content-management-api/#/reference/scheduled-actions/scheduled-actions-collection">REST API reference</a> for more details.
|
|
13986
14007
|
* @return Promise for the scheduled actions query
|
|
14008
|
+
*
|
|
14009
|
+
* @example ```javascript
|
|
14010
|
+
* const contentful = require('contentful-management');
|
|
14011
|
+
*
|
|
14012
|
+
* const client = contentful.createClient({
|
|
14013
|
+
* accessToken: '<content_management_api_key>'
|
|
14014
|
+
* })
|
|
14015
|
+
*
|
|
14016
|
+
* client.getSpace('<space_id>')
|
|
14017
|
+
* .then((space) => space.getScheduledActions({
|
|
14018
|
+
* 'environment.sys.id': '<environment_id>',
|
|
14019
|
+
* 'sys.status': 'scheduled'
|
|
14020
|
+
* }))
|
|
14021
|
+
* .then((scheduledActionCollection) => console.log(scheduledActionCollection.items))
|
|
14022
|
+
* .catch(console.error)
|
|
14023
|
+
* ```
|
|
13987
14024
|
*/
|
|
13988
14025
|
getScheduledActions: function getScheduledActions(query) {
|
|
13989
14026
|
var raw = this.toPlainObject();
|
|
@@ -13999,10 +14036,78 @@ function createSpaceApi(makeRequest) {
|
|
|
13999
14036
|
});
|
|
14000
14037
|
},
|
|
14001
14038
|
|
|
14039
|
+
/**
|
|
14040
|
+
* Get a Scheduled Action in the current space by environment and ID.
|
|
14041
|
+
*
|
|
14042
|
+
* @throws if the Scheduled Action cannot be found or the user doesn't have permission to read schedules from the entity of the scheduled action itself.
|
|
14043
|
+
* @returns Promise with the Scheduled Action
|
|
14044
|
+
* @example ```javascript
|
|
14045
|
+
* const contentful = require('contentful-management');
|
|
14046
|
+
*
|
|
14047
|
+
* const client = contentful.createClient({
|
|
14048
|
+
* accessToken: '<content_management_api_key>'
|
|
14049
|
+
* })
|
|
14050
|
+
*
|
|
14051
|
+
* client.getSpace('<space_id>')
|
|
14052
|
+
* .then((space) => space.getScheduledAction({
|
|
14053
|
+
* scheduledActionId: '<scheduled-action-id>',
|
|
14054
|
+
* environmentId: '<environmentId>'
|
|
14055
|
+
* }))
|
|
14056
|
+
* .then((scheduledAction) => console.log(scheduledAction))
|
|
14057
|
+
* .catch(console.error)
|
|
14058
|
+
* ```
|
|
14059
|
+
*/
|
|
14060
|
+
getScheduledAction: function getScheduledAction(_ref) {
|
|
14061
|
+
var scheduledActionId = _ref.scheduledActionId,
|
|
14062
|
+
environmentId = _ref.environmentId;
|
|
14063
|
+
var space = this.toPlainObject();
|
|
14064
|
+
return makeRequest({
|
|
14065
|
+
entityType: 'ScheduledAction',
|
|
14066
|
+
action: 'get',
|
|
14067
|
+
params: {
|
|
14068
|
+
spaceId: space.sys.id,
|
|
14069
|
+
environmentId: environmentId,
|
|
14070
|
+
scheduledActionId: scheduledActionId
|
|
14071
|
+
}
|
|
14072
|
+
}).then(function (scheduledAction) {
|
|
14073
|
+
return wrapScheduledAction(makeRequest, scheduledAction);
|
|
14074
|
+
});
|
|
14075
|
+
},
|
|
14076
|
+
|
|
14002
14077
|
/**
|
|
14003
14078
|
* Creates a scheduled action
|
|
14004
14079
|
* @param data - Object representation of the scheduled action to be created
|
|
14005
14080
|
* @return Promise for the newly created scheduled actions
|
|
14081
|
+
* @example ```javascript
|
|
14082
|
+
* const contentful = require('contentful-management');
|
|
14083
|
+
*
|
|
14084
|
+
* const client = contentful.createClient({
|
|
14085
|
+
* accessToken: '<content_management_api_key>'
|
|
14086
|
+
* })
|
|
14087
|
+
*
|
|
14088
|
+
* client.getSpace('<space_id>')
|
|
14089
|
+
* .then((space) => space.createScheduledAction({
|
|
14090
|
+
* entity: {
|
|
14091
|
+
* sys: {
|
|
14092
|
+
* type: 'Link',
|
|
14093
|
+
* linkType: 'Entry',
|
|
14094
|
+
* id: '<entry_id>'
|
|
14095
|
+
* }
|
|
14096
|
+
* },
|
|
14097
|
+
* environment: {
|
|
14098
|
+
* type: 'Link',
|
|
14099
|
+
* linkType: 'Environment',
|
|
14100
|
+
* id: '<environment_id>'
|
|
14101
|
+
* },
|
|
14102
|
+
* action: 'publish',
|
|
14103
|
+
* scheduledFor: {
|
|
14104
|
+
* dateTime: <ISO_date_string>,
|
|
14105
|
+
* timezone: 'Europe/Berlin'
|
|
14106
|
+
* }
|
|
14107
|
+
* }))
|
|
14108
|
+
* .then((scheduledAction) => console.log(scheduledAction))
|
|
14109
|
+
* .catch(console.error)
|
|
14110
|
+
* ```
|
|
14006
14111
|
*/
|
|
14007
14112
|
createScheduledAction: function createScheduledAction(data) {
|
|
14008
14113
|
var raw = this.toPlainObject();
|
|
@@ -14016,6 +14121,118 @@ function createSpaceApi(makeRequest) {
|
|
|
14016
14121
|
}).then(function (response) {
|
|
14017
14122
|
return wrapScheduledAction(makeRequest, response);
|
|
14018
14123
|
});
|
|
14124
|
+
},
|
|
14125
|
+
|
|
14126
|
+
/**
|
|
14127
|
+
* Update a scheduled action
|
|
14128
|
+
* @param {object} options
|
|
14129
|
+
* @param options.scheduledActionId the id of the scheduled action to update
|
|
14130
|
+
* @param options.version the sys.version of the scheduled action to be updated
|
|
14131
|
+
* @param payload the scheduled actions object with updates, omitting sys object
|
|
14132
|
+
* @returns Promise containing a wrapped scheduled action with helper methods
|
|
14133
|
+
* @example ```javascript
|
|
14134
|
+
* const contentful = require('contentful-management');
|
|
14135
|
+
*
|
|
14136
|
+
* const client = contentful.createClient({
|
|
14137
|
+
* accessToken: '<content_management_api_key>'
|
|
14138
|
+
* })
|
|
14139
|
+
*
|
|
14140
|
+
* client.getSpace('<space_id>')
|
|
14141
|
+
* .then((space) => {
|
|
14142
|
+
* return space.createScheduledAction({
|
|
14143
|
+
* entity: {
|
|
14144
|
+
* sys: {
|
|
14145
|
+
* type: 'Link',
|
|
14146
|
+
* linkType: 'Entry',
|
|
14147
|
+
* id: '<entry_id>'
|
|
14148
|
+
* }
|
|
14149
|
+
* },
|
|
14150
|
+
* environment: {
|
|
14151
|
+
* type: 'Link',
|
|
14152
|
+
* linkType: 'Environment',
|
|
14153
|
+
* id: '<environment_id>'
|
|
14154
|
+
* },
|
|
14155
|
+
* action: 'publish',
|
|
14156
|
+
* scheduledFor: {
|
|
14157
|
+
* dateTime: <ISO_date_string>,
|
|
14158
|
+
* timezone: 'Europe/Berlin'
|
|
14159
|
+
* }
|
|
14160
|
+
* })
|
|
14161
|
+
* .then((scheduledAction) => {
|
|
14162
|
+
* const { _sys, ...payload } = scheduledAction;
|
|
14163
|
+
* return space.updateScheduledAction({
|
|
14164
|
+
* ...payload,
|
|
14165
|
+
* scheduledFor: {
|
|
14166
|
+
* ...payload.scheduledFor,
|
|
14167
|
+
* timezone: 'Europe/Paris'
|
|
14168
|
+
* }
|
|
14169
|
+
* })
|
|
14170
|
+
* })
|
|
14171
|
+
* .then((scheduledAction) => console.log(scheduledAction))
|
|
14172
|
+
* .catch(console.error);
|
|
14173
|
+
* ```
|
|
14174
|
+
*/
|
|
14175
|
+
updateScheduledAction: function updateScheduledAction(_ref2) {
|
|
14176
|
+
var scheduledActionId = _ref2.scheduledActionId,
|
|
14177
|
+
payload = _ref2.payload,
|
|
14178
|
+
version = _ref2.version;
|
|
14179
|
+
var spaceProps = this.toPlainObject();
|
|
14180
|
+
return makeRequest({
|
|
14181
|
+
entityType: 'ScheduledAction',
|
|
14182
|
+
action: 'update',
|
|
14183
|
+
params: {
|
|
14184
|
+
spaceId: spaceProps.sys.id,
|
|
14185
|
+
version: version,
|
|
14186
|
+
scheduledActionId: scheduledActionId
|
|
14187
|
+
},
|
|
14188
|
+
payload: payload
|
|
14189
|
+
}).then(function (response) {
|
|
14190
|
+
return wrapScheduledAction(makeRequest, response);
|
|
14191
|
+
});
|
|
14192
|
+
},
|
|
14193
|
+
|
|
14194
|
+
/**
|
|
14195
|
+
* Cancels a Scheduled Action.
|
|
14196
|
+
* Only cancels actions that have not yet executed.
|
|
14197
|
+
*
|
|
14198
|
+
* @param {object} options
|
|
14199
|
+
* @param options.scheduledActionId the id of the scheduled action to be canceled
|
|
14200
|
+
* @param options.environmentId the environment ID of the scheduled action to be canceled
|
|
14201
|
+
* @throws if the Scheduled Action cannot be found or the user doesn't have permissions in the entity in the action.
|
|
14202
|
+
* @returns Promise containing a wrapped Scheduled Action with helper methods
|
|
14203
|
+
* @example ```javascript
|
|
14204
|
+
* const contentful = require('contentful-management');
|
|
14205
|
+
*
|
|
14206
|
+
* const client = contentful.createClient({
|
|
14207
|
+
* accessToken: '<content_management_api_key>'
|
|
14208
|
+
* })
|
|
14209
|
+
*
|
|
14210
|
+
* // Given that an Scheduled Action is scheduled
|
|
14211
|
+
* client.getSpace('<space_id>')
|
|
14212
|
+
* .then((space) => space.deleteScheduledAction({
|
|
14213
|
+
* environmentId: '<environment-id>',
|
|
14214
|
+
* scheduledActionId: '<scheduled-action-id>'
|
|
14215
|
+
* }))
|
|
14216
|
+
* // The scheduled Action sys.status is now 'canceled'
|
|
14217
|
+
* .then((scheduledAction) => console.log(scheduledAction))
|
|
14218
|
+
* .catch(console.error);
|
|
14219
|
+
* ```
|
|
14220
|
+
*/
|
|
14221
|
+
deleteScheduledAction: function deleteScheduledAction(_ref3) {
|
|
14222
|
+
var scheduledActionId = _ref3.scheduledActionId,
|
|
14223
|
+
environmentId = _ref3.environmentId;
|
|
14224
|
+
var spaceProps = this.toPlainObject();
|
|
14225
|
+
return makeRequest({
|
|
14226
|
+
entityType: 'ScheduledAction',
|
|
14227
|
+
action: 'delete',
|
|
14228
|
+
params: {
|
|
14229
|
+
spaceId: spaceProps.sys.id,
|
|
14230
|
+
environmentId: environmentId,
|
|
14231
|
+
scheduledActionId: scheduledActionId
|
|
14232
|
+
}
|
|
14233
|
+
}).then(function (response) {
|
|
14234
|
+
return wrapScheduledAction(makeRequest, response);
|
|
14235
|
+
});
|
|
14019
14236
|
}
|
|
14020
14237
|
};
|
|
14021
14238
|
}
|
|
@@ -16033,13 +16250,12 @@ var wrapRoleCollection = Object(_common_utils__WEBPACK_IMPORTED_MODULE_3__["wrap
|
|
|
16033
16250
|
/*!**************************************!*\
|
|
16034
16251
|
!*** ./entities/scheduled-action.ts ***!
|
|
16035
16252
|
\**************************************/
|
|
16036
|
-
/*! exports provided:
|
|
16253
|
+
/*! exports provided: default, wrapScheduledAction, wrapScheduledActionCollection */
|
|
16037
16254
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
16038
16255
|
|
|
16039
16256
|
"use strict";
|
|
16040
16257
|
__webpack_require__.r(__webpack_exports__);
|
|
16041
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "
|
|
16042
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return createScheduledActionApi; });
|
|
16258
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getInstanceMethods; });
|
|
16043
16259
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapScheduledAction", function() { return wrapScheduledAction; });
|
|
16044
16260
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapScheduledActionCollection", function() { return wrapScheduledActionCollection; });
|
|
16045
16261
|
/* 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");
|
|
@@ -16047,6 +16263,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
16047
16263
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fast_copy__WEBPACK_IMPORTED_MODULE_1__);
|
|
16048
16264
|
/* harmony import */ var _common_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common-utils */ "./common-utils.ts");
|
|
16049
16265
|
/* harmony import */ var _enhance_with_methods__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../enhance-with-methods */ "./enhance-with-methods.ts");
|
|
16266
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16267
|
+
|
|
16268
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16269
|
+
|
|
16270
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16271
|
+
|
|
16272
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
16273
|
+
|
|
16050
16274
|
|
|
16051
16275
|
|
|
16052
16276
|
|
|
@@ -16065,32 +16289,157 @@ var ScheduledActionStatus;
|
|
|
16065
16289
|
ScheduledActionStatus["canceled"] = "canceled";
|
|
16066
16290
|
})(ScheduledActionStatus || (ScheduledActionStatus = {}));
|
|
16067
16291
|
|
|
16068
|
-
function
|
|
16069
|
-
|
|
16070
|
-
var
|
|
16292
|
+
function getInstanceMethods(makeRequest) {
|
|
16293
|
+
var getParams = function getParams(self) {
|
|
16294
|
+
var _scheduledAction$envi;
|
|
16071
16295
|
|
|
16072
|
-
var
|
|
16073
|
-
return
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
|
|
16079
|
-
environmentId: (_data$environment = data.environment) === null || _data$environment === void 0 ? void 0 : _data$environment.sys.id
|
|
16080
|
-
}
|
|
16081
|
-
}).then(function (data) {
|
|
16082
|
-
return wrapScheduledAction(makeRequest, data);
|
|
16083
|
-
});
|
|
16296
|
+
var scheduledAction = self.toPlainObject();
|
|
16297
|
+
return {
|
|
16298
|
+
spaceId: scheduledAction.sys.space.sys.id,
|
|
16299
|
+
environmentId: (_scheduledAction$envi = scheduledAction.environment) === null || _scheduledAction$envi === void 0 ? void 0 : _scheduledAction$envi.sys.id,
|
|
16300
|
+
scheduledActionId: scheduledAction.sys.id,
|
|
16301
|
+
version: scheduledAction.sys.version
|
|
16302
|
+
};
|
|
16084
16303
|
};
|
|
16085
|
-
|
|
16086
|
-
function createScheduledActionApi(makeRequest) {
|
|
16304
|
+
|
|
16087
16305
|
return {
|
|
16088
|
-
|
|
16306
|
+
/**
|
|
16307
|
+
* Cancels the current Scheduled Action schedule.
|
|
16308
|
+
*
|
|
16309
|
+
* @example ```javascript
|
|
16310
|
+
* const contentful = require('contentful-management');
|
|
16311
|
+
*
|
|
16312
|
+
* const client = contentful.createClient({
|
|
16313
|
+
* accessToken: '<content_management_api_key>'
|
|
16314
|
+
* })
|
|
16315
|
+
*
|
|
16316
|
+
* client.getSpace('<space_id>')
|
|
16317
|
+
* .then((space) => {
|
|
16318
|
+
* return space.createScheduledAction({
|
|
16319
|
+
* entity: {
|
|
16320
|
+
* sys: {
|
|
16321
|
+
* type: 'Link',
|
|
16322
|
+
* linkType: 'Entry',
|
|
16323
|
+
* id: '<entry_id>'
|
|
16324
|
+
* }
|
|
16325
|
+
* },
|
|
16326
|
+
* environment: {
|
|
16327
|
+
* type: 'Link',
|
|
16328
|
+
* linkType: 'Environment',
|
|
16329
|
+
* id: '<environment_id>'
|
|
16330
|
+
* },
|
|
16331
|
+
* action: 'publish',
|
|
16332
|
+
* scheduledFor: {
|
|
16333
|
+
* dateTime: <ISO_date_string>,
|
|
16334
|
+
* timezone: 'Europe/Berlin'
|
|
16335
|
+
* }
|
|
16336
|
+
* })
|
|
16337
|
+
* .then((scheduledAction) => scheduledAction.delete())
|
|
16338
|
+
* .then((deletedScheduledAction) => console.log(deletedScheduledAction))
|
|
16339
|
+
* .catch(console.error);
|
|
16340
|
+
* ```
|
|
16341
|
+
*/
|
|
16342
|
+
delete: function _delete() {
|
|
16343
|
+
var _this = this;
|
|
16344
|
+
|
|
16345
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
16346
|
+
var params;
|
|
16347
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
16348
|
+
while (1) {
|
|
16349
|
+
switch (_context.prev = _context.next) {
|
|
16350
|
+
case 0:
|
|
16351
|
+
params = getParams(_this);
|
|
16352
|
+
return _context.abrupt("return", makeRequest({
|
|
16353
|
+
entityType: 'ScheduledAction',
|
|
16354
|
+
action: 'delete',
|
|
16355
|
+
params: params
|
|
16356
|
+
}).then(function (data) {
|
|
16357
|
+
return wrapScheduledAction(makeRequest, data);
|
|
16358
|
+
}));
|
|
16359
|
+
|
|
16360
|
+
case 2:
|
|
16361
|
+
case "end":
|
|
16362
|
+
return _context.stop();
|
|
16363
|
+
}
|
|
16364
|
+
}
|
|
16365
|
+
}, _callee);
|
|
16366
|
+
}))();
|
|
16367
|
+
},
|
|
16368
|
+
|
|
16369
|
+
/**
|
|
16370
|
+
* Update the current scheduled action. Currently, only changes made to the `scheduledFor` property will be saved.
|
|
16371
|
+
*
|
|
16372
|
+
* @example ```javascript
|
|
16373
|
+
* const contentful = require('contentful-management');
|
|
16374
|
+
*
|
|
16375
|
+
* const client = contentful.createClient({
|
|
16376
|
+
* accessToken: '<content_management_api_key>'
|
|
16377
|
+
* })
|
|
16378
|
+
*
|
|
16379
|
+
* client.getSpace('<space_id>')
|
|
16380
|
+
* .then((space) => {
|
|
16381
|
+
* return space.createScheduledAction({
|
|
16382
|
+
* entity: {
|
|
16383
|
+
* sys: {
|
|
16384
|
+
* type: 'Link',
|
|
16385
|
+
* linkType: 'Entry',
|
|
16386
|
+
* id: '<entry_id>'
|
|
16387
|
+
* }
|
|
16388
|
+
* },
|
|
16389
|
+
* environment: {
|
|
16390
|
+
* type: 'Link',
|
|
16391
|
+
* linkType: 'Environment',
|
|
16392
|
+
* id: '<environment_id>'
|
|
16393
|
+
* },
|
|
16394
|
+
* action: 'publish',
|
|
16395
|
+
* scheduledFor: {
|
|
16396
|
+
* dateTime: <ISO_date_string>,
|
|
16397
|
+
* timezone: 'Europe/Berlin'
|
|
16398
|
+
* }
|
|
16399
|
+
* })
|
|
16400
|
+
* .then((scheduledAction) => {
|
|
16401
|
+
* scheduledAction.scheduledFor.timezone = 'Europe/Paris';
|
|
16402
|
+
* return scheduledAction.update();
|
|
16403
|
+
* })
|
|
16404
|
+
* .then((scheduledAction) => console.log(scheduledAction))
|
|
16405
|
+
* .catch(console.error);
|
|
16406
|
+
* ```
|
|
16407
|
+
*/
|
|
16408
|
+
update: function update() {
|
|
16409
|
+
var _this2 = this;
|
|
16410
|
+
|
|
16411
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
16412
|
+
var params, _this2$toPlainObject, sys, payload;
|
|
16413
|
+
|
|
16414
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
16415
|
+
while (1) {
|
|
16416
|
+
switch (_context2.prev = _context2.next) {
|
|
16417
|
+
case 0:
|
|
16418
|
+
params = getParams(_this2); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16419
|
+
|
|
16420
|
+
_this2$toPlainObject = _this2.toPlainObject(), sys = _this2$toPlainObject.sys, payload = _objectWithoutProperties(_this2$toPlainObject, ["sys"]);
|
|
16421
|
+
return _context2.abrupt("return", makeRequest({
|
|
16422
|
+
entityType: 'ScheduledAction',
|
|
16423
|
+
action: 'update',
|
|
16424
|
+
params: params,
|
|
16425
|
+
payload: payload
|
|
16426
|
+
}).then(function (data) {
|
|
16427
|
+
return wrapScheduledAction(makeRequest, data);
|
|
16428
|
+
}));
|
|
16429
|
+
|
|
16430
|
+
case 3:
|
|
16431
|
+
case "end":
|
|
16432
|
+
return _context2.stop();
|
|
16433
|
+
}
|
|
16434
|
+
}
|
|
16435
|
+
}, _callee2);
|
|
16436
|
+
}))();
|
|
16437
|
+
}
|
|
16089
16438
|
};
|
|
16090
16439
|
}
|
|
16091
16440
|
function wrapScheduledAction(makeRequest, data) {
|
|
16092
16441
|
var scheduledAction = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_1___default()(data));
|
|
16093
|
-
var scheduledActionWithMethods = Object(_enhance_with_methods__WEBPACK_IMPORTED_MODULE_3__["default"])(scheduledAction,
|
|
16442
|
+
var scheduledActionWithMethods = Object(_enhance_with_methods__WEBPACK_IMPORTED_MODULE_3__["default"])(scheduledAction, getInstanceMethods(makeRequest));
|
|
16094
16443
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["freezeSys"])(scheduledActionWithMethods);
|
|
16095
16444
|
}
|
|
16096
16445
|
var wrapScheduledActionCollection = Object(_common_utils__WEBPACK_IMPORTED_MODULE_2__["wrapCollection"])(wrapScheduledAction);
|
|
@@ -17522,6 +17871,8 @@ var createPlainClient = function createPlainClient(makeRequest, defaults) {
|
|
|
17522
17871
|
delete: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ContentType', 'delete'),
|
|
17523
17872
|
publish: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ContentType', 'publish'),
|
|
17524
17873
|
unpublish: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ContentType', 'unpublish'),
|
|
17874
|
+
create: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ContentType', 'create'),
|
|
17875
|
+
createWithId: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ContentType', 'createWithId'),
|
|
17525
17876
|
omitAndDeleteField: function omitAndDeleteField(params, contentType, fieldId) {
|
|
17526
17877
|
return Object(_methods_content_type__WEBPACK_IMPORTED_MODULE_0__["omitAndDeleteField"])(makeRequest, _objectSpread(_objectSpread({}, _objectSpread(_objectSpread({}, defaults), params)), {}, {
|
|
17527
17878
|
fieldId: fieldId
|
|
@@ -17651,9 +18002,11 @@ var createPlainClient = function createPlainClient(makeRequest, defaults) {
|
|
|
17651
18002
|
delete: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'Role', 'delete')
|
|
17652
18003
|
},
|
|
17653
18004
|
scheduledActions: {
|
|
18005
|
+
get: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ScheduledAction', 'get'),
|
|
17654
18006
|
getMany: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ScheduledAction', 'getMany'),
|
|
17655
18007
|
create: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ScheduledAction', 'create'),
|
|
17656
|
-
delete: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ScheduledAction', 'delete')
|
|
18008
|
+
delete: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ScheduledAction', 'delete'),
|
|
18009
|
+
update: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'ScheduledAction', 'update')
|
|
17657
18010
|
},
|
|
17658
18011
|
previewApiKey: {
|
|
17659
18012
|
get: Object(_wrappers_wrap__WEBPACK_IMPORTED_MODULE_1__["wrap"])(wrapParams, 'PreviewApiKey', 'get'),
|