contentful-management 11.57.2 → 11.58.0-canary.1
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 +14 -0
- package/dist/contentful-management.browser.js +211 -65
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +210 -65
- 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/entry.js +31 -6
- package/dist/es-modules/adapters/REST/endpoints/index.js +2 -0
- package/dist/es-modules/adapters/REST/endpoints/release-entry.js +63 -0
- package/dist/es-modules/adapters/REST/endpoints/release.js +24 -0
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/create-environment-api.js +4 -4
- package/dist/es-modules/plain/plain-client.js +8 -0
- package/dist/typings/adapters/REST/endpoints/index.d.ts +2 -0
- package/dist/typings/adapters/REST/endpoints/release-entry.d.ts +7 -0
- package/dist/typings/common-types.d.ts +136 -19
- package/dist/typings/create-entry-api.d.ts +1 -1
- package/dist/typings/create-environment-api.d.ts +8 -8
- package/dist/typings/entities/entry.d.ts +3 -3
- package/dist/typings/entities/release.d.ts +18 -1
- package/dist/typings/plain/common-types.d.ts +92 -17
- package/dist/typings/plain/wrappers/wrap.d.ts +2 -0
- package/package.json +6 -2
|
@@ -5,8 +5,15 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
import copy from 'fast-copy';
|
|
7
7
|
import * as raw from './raw';
|
|
8
|
+
import { createWithId as createWithIdReleaseEntry } from './release-entry';
|
|
8
9
|
import { normalizeSelect } from './utils';
|
|
10
|
+
import * as releaseEntry from './release-entry';
|
|
9
11
|
export const get = (http, params, rawData, headers) => {
|
|
12
|
+
if (params.releaseId) {
|
|
13
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
14
|
+
'release[lte]': params.releaseId
|
|
15
|
+
});
|
|
16
|
+
}
|
|
10
17
|
return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, {
|
|
11
18
|
params: normalizeSelect(params.query),
|
|
12
19
|
headers: _objectSpread({}, headers)
|
|
@@ -19,12 +26,20 @@ export const getPublished = (http, params, rawData, headers) => {
|
|
|
19
26
|
});
|
|
20
27
|
};
|
|
21
28
|
export const getMany = (http, params, rawData, headers) => {
|
|
29
|
+
if (params.releaseId) {
|
|
30
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
31
|
+
'release[lte]': params.releaseId
|
|
32
|
+
});
|
|
33
|
+
}
|
|
22
34
|
return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries`, {
|
|
23
35
|
params: normalizeSelect(params.query),
|
|
24
36
|
headers: _objectSpread({}, headers)
|
|
25
37
|
});
|
|
26
38
|
};
|
|
27
39
|
export const patch = (http, params, data, headers) => {
|
|
40
|
+
if (params.releaseId) {
|
|
41
|
+
return releaseEntry.patch(http, params, data, headers !== null && headers !== void 0 ? headers : {});
|
|
42
|
+
}
|
|
28
43
|
return raw.patch(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
|
|
29
44
|
headers: _objectSpread({
|
|
30
45
|
'X-Contentful-Version': params.version,
|
|
@@ -34,6 +49,9 @@ export const patch = (http, params, data, headers) => {
|
|
|
34
49
|
};
|
|
35
50
|
export const update = (http, params, rawData, headers) => {
|
|
36
51
|
var _rawData$sys$version;
|
|
52
|
+
if (params.releaseId) {
|
|
53
|
+
return releaseEntry.update(http, params, rawData, headers !== null && headers !== void 0 ? headers : {});
|
|
54
|
+
}
|
|
37
55
|
const data = copy(rawData);
|
|
38
56
|
delete data.sys;
|
|
39
57
|
return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
|
|
@@ -86,6 +104,9 @@ export const unarchive = (http, params) => {
|
|
|
86
104
|
return raw.del(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}/archived`);
|
|
87
105
|
};
|
|
88
106
|
export const create = (http, params, rawData) => {
|
|
107
|
+
if (params.releaseId) {
|
|
108
|
+
return releaseEntry.create(http, params, rawData, {});
|
|
109
|
+
}
|
|
89
110
|
const data = copy(rawData);
|
|
90
111
|
return raw.post(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries`, data, {
|
|
91
112
|
headers: {
|
|
@@ -94,12 +115,16 @@ export const create = (http, params, rawData) => {
|
|
|
94
115
|
});
|
|
95
116
|
};
|
|
96
117
|
export const createWithId = (http, params, rawData) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
118
|
+
if (params.releaseId) {
|
|
119
|
+
return createWithIdReleaseEntry(http, params, rawData, {});
|
|
120
|
+
} else {
|
|
121
|
+
const data = copy(rawData);
|
|
122
|
+
return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, data, {
|
|
123
|
+
headers: {
|
|
124
|
+
'X-Contentful-Content-Type': params.contentTypeId
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
103
128
|
};
|
|
104
129
|
export const references = (http, params) => {
|
|
105
130
|
const {
|
|
@@ -39,6 +39,7 @@ import * as OAuthApplication from './oauth-application';
|
|
|
39
39
|
import * as PersonalAccessToken from './personal-access-token';
|
|
40
40
|
import * as PreviewApiKey from './preview-api-key';
|
|
41
41
|
import * as Release from './release';
|
|
42
|
+
import * as ReleaseEntry from './release-entry';
|
|
42
43
|
import * as ReleaseAction from './release-action';
|
|
43
44
|
import * as Resource from './resource';
|
|
44
45
|
import * as ResourceProvider from './resource-provider';
|
|
@@ -106,6 +107,7 @@ export default {
|
|
|
106
107
|
AccessToken,
|
|
107
108
|
PreviewApiKey,
|
|
108
109
|
Release,
|
|
110
|
+
ReleaseEntry,
|
|
109
111
|
ReleaseAction,
|
|
110
112
|
Resource,
|
|
111
113
|
ResourceProvider,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
import copy from 'fast-copy';
|
|
7
|
+
import * as raw from './raw';
|
|
8
|
+
export const get = (http, params) => {
|
|
9
|
+
//TODO: not fully implemented yet, only the get method
|
|
10
|
+
return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}/entries/${params.entryId}`);
|
|
11
|
+
};
|
|
12
|
+
export const getMany = (http, params) => {
|
|
13
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
14
|
+
'sys.schemaVersion': 'Release.V2'
|
|
15
|
+
});
|
|
16
|
+
return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}/entries`);
|
|
17
|
+
};
|
|
18
|
+
export const update = (http, params, rawData, headers) => {
|
|
19
|
+
var _rawData$sys$version;
|
|
20
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
21
|
+
'sys.schemaVersion': 'Release.V2'
|
|
22
|
+
});
|
|
23
|
+
const data = copy(rawData);
|
|
24
|
+
delete data.sys;
|
|
25
|
+
return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}/entries/${params.entryId}`, data, {
|
|
26
|
+
headers: _objectSpread({
|
|
27
|
+
'X-Contentful-Version': (_rawData$sys$version = rawData.sys.version) !== null && _rawData$sys$version !== void 0 ? _rawData$sys$version : 0
|
|
28
|
+
}, headers)
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export const patch = (http, params, data, headers) => {
|
|
32
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
33
|
+
'sys.schemaVersion': 'Release.V2'
|
|
34
|
+
});
|
|
35
|
+
return raw.patch(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}/entries/${params.entryId}`, data, {
|
|
36
|
+
headers: _objectSpread({
|
|
37
|
+
'X-Contentful-Version': params.version,
|
|
38
|
+
'Content-Type': 'application/json-patch+json'
|
|
39
|
+
}, headers)
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export const create = (http, params, rawData, headers) => {
|
|
43
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
44
|
+
'sys.schemaVersion': 'Release.V2'
|
|
45
|
+
});
|
|
46
|
+
const data = copy(rawData);
|
|
47
|
+
return raw.post(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}/entries`, data, {
|
|
48
|
+
headers: _objectSpread({
|
|
49
|
+
'X-Contentful-Content-Type': params.contentTypeId
|
|
50
|
+
}, headers)
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
export const createWithId = (http, params, rawData, headers) => {
|
|
54
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
55
|
+
'sys.schemaVersion': 'Release.V2'
|
|
56
|
+
});
|
|
57
|
+
const data = copy(rawData);
|
|
58
|
+
return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}/entries/${params.entryId}`, data, {
|
|
59
|
+
headers: _objectSpread({
|
|
60
|
+
'X-Contentful-Content-Type': params.contentTypeId
|
|
61
|
+
}, headers)
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -8,14 +8,38 @@ export const get = (http, params) => {
|
|
|
8
8
|
return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}`);
|
|
9
9
|
};
|
|
10
10
|
export const query = (http, params) => {
|
|
11
|
+
var _ref, _params$query$sysSch, _params$query;
|
|
12
|
+
// Set the schema version in the query if provided in params or query options
|
|
13
|
+
const releaseSchemaVersion = (_ref = (_params$query$sysSch = (_params$query = params.query) === null || _params$query === void 0 ? void 0 : _params$query['sys.schemaVersion']) !== null && _params$query$sysSch !== void 0 ? _params$query$sysSch : params.releaseSchemaVersion) !== null && _ref !== void 0 ? _ref : undefined;
|
|
14
|
+
if (releaseSchemaVersion !== undefined) {
|
|
15
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
16
|
+
'sys.schemaVersion': releaseSchemaVersion
|
|
17
|
+
});
|
|
18
|
+
}
|
|
11
19
|
return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases`, {
|
|
12
20
|
params: params.query
|
|
13
21
|
});
|
|
14
22
|
};
|
|
15
23
|
export const create = (http, params, payload) => {
|
|
24
|
+
var _payload$sys$schemaVe, _payload$sys;
|
|
25
|
+
const releaseSchemaVersion = (_payload$sys$schemaVe = (_payload$sys = payload.sys) === null || _payload$sys === void 0 ? void 0 : _payload$sys.schemaVersion) !== null && _payload$sys$schemaVe !== void 0 ? _payload$sys$schemaVe : params.releaseSchemaVersion;
|
|
26
|
+
if (releaseSchemaVersion === 'Release.v2') {
|
|
27
|
+
payload.sys = _objectSpread(_objectSpread({}, payload.sys), {}, {
|
|
28
|
+
type: 'Release',
|
|
29
|
+
schemaVersion: 'Release.v2'
|
|
30
|
+
});
|
|
31
|
+
}
|
|
16
32
|
return raw.post(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases`, payload);
|
|
17
33
|
};
|
|
18
34
|
export const update = (http, params, payload, headers) => {
|
|
35
|
+
var _payload$sys$schemaVe2, _payload$sys2;
|
|
36
|
+
const releaseSchemaVersion = (_payload$sys$schemaVe2 = (_payload$sys2 = payload.sys) === null || _payload$sys2 === void 0 ? void 0 : _payload$sys2.schemaVersion) !== null && _payload$sys$schemaVe2 !== void 0 ? _payload$sys$schemaVe2 : params.releaseSchemaVersion;
|
|
37
|
+
if (releaseSchemaVersion === 'Release.v2') {
|
|
38
|
+
payload.sys = _objectSpread(_objectSpread({}, payload.sys), {}, {
|
|
39
|
+
type: 'Release',
|
|
40
|
+
schemaVersion: 'Release.v2'
|
|
41
|
+
});
|
|
42
|
+
}
|
|
19
43
|
return raw.put(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/releases/${params.releaseId}`, payload, {
|
|
20
44
|
headers: _objectSpread({
|
|
21
45
|
'X-Contentful-Version': params.version
|
|
@@ -47,7 +47,7 @@ function createClient(params, opts = {}) {
|
|
|
47
47
|
const sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
48
48
|
const userAgent = getUserAgentHeader(
|
|
49
49
|
// @ts-expect-error
|
|
50
|
-
`${sdkMain}/${"11.
|
|
50
|
+
`${sdkMain}/${"11.58.0-canary.1"}`, params.application, params.integration, params.feature);
|
|
51
51
|
const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
|
|
52
52
|
userAgent
|
|
53
53
|
}));
|
|
@@ -389,7 +389,7 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
389
389
|
*
|
|
390
390
|
* // Using Thenables
|
|
391
391
|
* client.getSpace('<space_id>')
|
|
392
|
-
* .then((space) => space.getEnvironment('<
|
|
392
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
393
393
|
* .then((environment) => environment.createUnpublishBulkAction(payload))
|
|
394
394
|
* .then((bulkAction) => console.log(bulkAction.waitProcessing()))
|
|
395
395
|
* .catch(console.error)
|
|
@@ -397,7 +397,7 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
397
397
|
* // Using async/await
|
|
398
398
|
* try {
|
|
399
399
|
* const space = await clientgetSpace('<space_id>')
|
|
400
|
-
* const environment = await space.getEnvironment('<
|
|
400
|
+
* const environment = await space.getEnvironment('<environment-id>')
|
|
401
401
|
* const bulkActionInProgress = await environment.createUnpublishBulkAction(payload)
|
|
402
402
|
*
|
|
403
403
|
* // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
|
|
@@ -851,7 +851,7 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
851
851
|
*
|
|
852
852
|
* // Get entry references
|
|
853
853
|
* client.getSpace('<space_id>')
|
|
854
|
-
* .then((space) => space.getEnvironment('<
|
|
854
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
855
855
|
* .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
|
|
856
856
|
* .then((entry) => console.log(entry.includes))
|
|
857
857
|
* // or
|
|
@@ -2436,7 +2436,7 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
2436
2436
|
* })
|
|
2437
2437
|
*
|
|
2438
2438
|
* client.getSpace('<space_id>')
|
|
2439
|
-
* .then((space) => space.getEnvironment('<
|
|
2439
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
2440
2440
|
* .then((environment) => environment.getResourceTypes({limit: 10}))
|
|
2441
2441
|
* .then((installations) => console.log(installations.items))
|
|
2442
2442
|
* .catch(console.error)
|
|
@@ -346,6 +346,14 @@ export const createPlainClient = (makeRequest, defaults) => {
|
|
|
346
346
|
getManyForOrganization: wrap(wrapParams, 'Usage', 'getManyForOrganization')
|
|
347
347
|
},
|
|
348
348
|
release: {
|
|
349
|
+
entry: {
|
|
350
|
+
get: wrap(wrapParams, 'ReleaseEntry', 'get'),
|
|
351
|
+
getMany: wrap(wrapParams, 'ReleaseEntry', 'getMany'),
|
|
352
|
+
update: wrap(wrapParams, 'ReleaseEntry', 'update'),
|
|
353
|
+
patch: wrap(wrapParams, 'ReleaseEntry', 'patch'),
|
|
354
|
+
create: wrap(wrapParams, 'ReleaseEntry', 'create'),
|
|
355
|
+
createWithId: wrap(wrapParams, 'ReleaseEntry', 'createWithId')
|
|
356
|
+
},
|
|
349
357
|
archive: wrap(wrapParams, 'Release', 'archive'),
|
|
350
358
|
get: wrap(wrapParams, 'Release', 'get'),
|
|
351
359
|
query: wrap(wrapParams, 'Release', 'query'),
|
|
@@ -39,6 +39,7 @@ import * as OAuthApplication from './oauth-application';
|
|
|
39
39
|
import * as PersonalAccessToken from './personal-access-token';
|
|
40
40
|
import * as PreviewApiKey from './preview-api-key';
|
|
41
41
|
import * as Release from './release';
|
|
42
|
+
import * as ReleaseEntry from './release-entry';
|
|
42
43
|
import * as ReleaseAction from './release-action';
|
|
43
44
|
import * as Resource from './resource';
|
|
44
45
|
import * as ResourceProvider from './resource-provider';
|
|
@@ -106,6 +107,7 @@ declare const _default: {
|
|
|
106
107
|
AccessToken: typeof AccessToken;
|
|
107
108
|
PreviewApiKey: typeof PreviewApiKey;
|
|
108
109
|
Release: typeof Release;
|
|
110
|
+
ReleaseEntry: typeof ReleaseEntry;
|
|
109
111
|
ReleaseAction: typeof ReleaseAction;
|
|
110
112
|
Resource: typeof Resource;
|
|
111
113
|
ResourceProvider: typeof ResourceProvider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RestEndpoint } from '../types';
|
|
2
|
+
export declare const get: RestEndpoint<'ReleaseEntry', 'get'>;
|
|
3
|
+
export declare const getMany: RestEndpoint<'ReleaseEntry', 'getMany'>;
|
|
4
|
+
export declare const update: RestEndpoint<'ReleaseEntry', 'update'>;
|
|
5
|
+
export declare const patch: RestEndpoint<'ReleaseEntry', 'patch'>;
|
|
6
|
+
export declare const create: RestEndpoint<'ReleaseEntry', 'create'>;
|
|
7
|
+
export declare const createWithId: RestEndpoint<'ReleaseEntry', 'createWithId'>;
|
|
@@ -28,7 +28,7 @@ import type { CreateOrganizationInvitationProps, OrganizationInvitationProps } f
|
|
|
28
28
|
import type { OrganizationMembershipProps } from './entities/organization-membership';
|
|
29
29
|
import type { CreatePersonalAccessTokenProps, PersonalAccessTokenProps } from './entities/personal-access-token';
|
|
30
30
|
import type { PreviewApiKeyProps } from './entities/preview-api-key';
|
|
31
|
-
import type { ReleasePayload, ReleaseProps, ReleaseQueryOptions, ReleaseValidatePayload } from './entities/release';
|
|
31
|
+
import type { ReleasePayload, ReleasePayloadV2, ReleaseProps, ReleaseQueryOptions, ReleaseValidatePayload } from './entities/release';
|
|
32
32
|
import type { ReleaseAction, ReleaseActionProps, ReleaseActionQueryOptions } from './entities/release-action';
|
|
33
33
|
import type { CreateRoleProps, RoleProps } from './entities/role';
|
|
34
34
|
import type { ScheduledActionProps } from './entities/scheduled-action';
|
|
@@ -454,6 +454,12 @@ type MRInternal<UA extends boolean> = {
|
|
|
454
454
|
(opts: MROpts<'ReleaseAction', 'get', UA>): MRReturn<'ReleaseAction', 'get'>;
|
|
455
455
|
(opts: MROpts<'ReleaseAction', 'getMany', UA>): MRReturn<'ReleaseAction', 'getMany'>;
|
|
456
456
|
(opts: MROpts<'ReleaseAction', 'queryForRelease', UA>): MRReturn<'ReleaseAction', 'queryForRelease'>;
|
|
457
|
+
(opts: MROpts<'ReleaseEntry', 'get', UA>): MRReturn<'ReleaseEntry', 'get'>;
|
|
458
|
+
(opts: MROpts<'ReleaseEntry', 'getMany', UA>): MRReturn<'ReleaseEntry', 'getMany'>;
|
|
459
|
+
(opts: MROpts<'ReleaseEntry', 'update', UA>): MRReturn<'ReleaseEntry', 'update'>;
|
|
460
|
+
(opts: MROpts<'ReleaseEntry', 'patch', UA>): MRReturn<'ReleaseEntry', 'patch'>;
|
|
461
|
+
(opts: MROpts<'ReleaseEntry', 'create', UA>): MRReturn<'ReleaseEntry', 'create'>;
|
|
462
|
+
(opts: MROpts<'ReleaseEntry', 'createWithId', UA>): MRReturn<'ReleaseEntry', 'createWithId'>;
|
|
457
463
|
(opts: MROpts<'Resource', 'getMany', UA>): MRReturn<'Resource', 'getMany'>;
|
|
458
464
|
(opts: MROpts<'ResourceProvider', 'get', UA>): MRReturn<'ResourceProvider', 'get'>;
|
|
459
465
|
(opts: MROpts<'ResourceProvider', 'upsert', UA>): MRReturn<'ResourceProvider', 'upsert'>;
|
|
@@ -1504,28 +1510,21 @@ export type MRActions = {
|
|
|
1504
1510
|
return: CollectionProp<EntryProps<any>>;
|
|
1505
1511
|
};
|
|
1506
1512
|
getMany: {
|
|
1507
|
-
params:
|
|
1508
|
-
return: CollectionProp<EntryProps<any>>;
|
|
1513
|
+
params: GetManyEntryParams & QueryParams;
|
|
1514
|
+
return: CollectionProp<EntryProps<any, any>>;
|
|
1509
1515
|
};
|
|
1510
1516
|
get: {
|
|
1511
|
-
params:
|
|
1512
|
-
|
|
1513
|
-
} & QueryParams;
|
|
1514
|
-
return: EntryProps<any>;
|
|
1517
|
+
params: GetEntryParams & QueryParams;
|
|
1518
|
+
return: EntryProps<any, any>;
|
|
1515
1519
|
};
|
|
1516
1520
|
patch: {
|
|
1517
|
-
params:
|
|
1518
|
-
entryId: string;
|
|
1519
|
-
version: number;
|
|
1520
|
-
};
|
|
1521
|
+
params: PatchEntryParams & QueryParams;
|
|
1521
1522
|
payload: OpPatch[];
|
|
1522
1523
|
headers?: RawAxiosRequestHeaders;
|
|
1523
1524
|
return: EntryProps<any>;
|
|
1524
1525
|
};
|
|
1525
1526
|
update: {
|
|
1526
|
-
params:
|
|
1527
|
-
entryId: string;
|
|
1528
|
-
};
|
|
1527
|
+
params: UpdateEntryParams & QueryParams;
|
|
1529
1528
|
payload: EntryProps<any>;
|
|
1530
1529
|
headers?: RawAxiosRequestHeaders;
|
|
1531
1530
|
return: EntryProps<any>;
|
|
@@ -1564,7 +1563,8 @@ export type MRActions = {
|
|
|
1564
1563
|
create: {
|
|
1565
1564
|
params: GetSpaceEnvironmentParams & {
|
|
1566
1565
|
contentTypeId: string;
|
|
1567
|
-
|
|
1566
|
+
releaseId?: string;
|
|
1567
|
+
} & QueryParams;
|
|
1568
1568
|
payload: CreateEntryProps<any>;
|
|
1569
1569
|
return: EntryProps<any>;
|
|
1570
1570
|
};
|
|
@@ -1572,9 +1572,10 @@ export type MRActions = {
|
|
|
1572
1572
|
params: GetSpaceEnvironmentParams & {
|
|
1573
1573
|
entryId: string;
|
|
1574
1574
|
contentTypeId: string;
|
|
1575
|
+
releaseId?: string;
|
|
1575
1576
|
};
|
|
1576
1577
|
payload: CreateEntryProps<any>;
|
|
1577
|
-
return: EntryProps<any>;
|
|
1578
|
+
return: EntryProps<any, any>;
|
|
1578
1579
|
};
|
|
1579
1580
|
references: {
|
|
1580
1581
|
params: GetSpaceEnvironmentParams & {
|
|
@@ -1831,14 +1832,14 @@ export type MRActions = {
|
|
|
1831
1832
|
};
|
|
1832
1833
|
create: {
|
|
1833
1834
|
params: GetSpaceEnvironmentParams;
|
|
1834
|
-
payload: ReleasePayload;
|
|
1835
|
+
payload: ReleasePayload | ReleasePayloadV2;
|
|
1835
1836
|
return: ReleaseProps;
|
|
1836
1837
|
};
|
|
1837
1838
|
update: {
|
|
1838
1839
|
params: GetReleaseParams & {
|
|
1839
1840
|
version: number;
|
|
1840
1841
|
};
|
|
1841
|
-
payload: ReleasePayload;
|
|
1842
|
+
payload: ReleasePayload | ReleasePayloadV2;
|
|
1842
1843
|
return: ReleaseProps;
|
|
1843
1844
|
};
|
|
1844
1845
|
delete: {
|
|
@@ -1869,6 +1870,81 @@ export type MRActions = {
|
|
|
1869
1870
|
return: ReleaseActionProps<'validate'>;
|
|
1870
1871
|
};
|
|
1871
1872
|
};
|
|
1873
|
+
ReleaseEntry: {
|
|
1874
|
+
get: {
|
|
1875
|
+
params: GetReleaseEntryParams;
|
|
1876
|
+
return: EntryProps<any, any>;
|
|
1877
|
+
};
|
|
1878
|
+
getMany: {
|
|
1879
|
+
params: GetManyReleaseEntryParams;
|
|
1880
|
+
return: CollectionProp<EntryProps<any, any>>;
|
|
1881
|
+
};
|
|
1882
|
+
update: {
|
|
1883
|
+
params: UpdateReleaseEntryParams & {
|
|
1884
|
+
entryId: string;
|
|
1885
|
+
};
|
|
1886
|
+
payload: EntryProps<any>;
|
|
1887
|
+
headers?: RawAxiosRequestHeaders;
|
|
1888
|
+
return: EntryProps<any, {
|
|
1889
|
+
release: {
|
|
1890
|
+
sys: {
|
|
1891
|
+
type: 'Link';
|
|
1892
|
+
linkType: 'Entry' | 'Asset';
|
|
1893
|
+
id: string;
|
|
1894
|
+
};
|
|
1895
|
+
};
|
|
1896
|
+
}>;
|
|
1897
|
+
};
|
|
1898
|
+
patch: {
|
|
1899
|
+
params: PatchReleaseEntryParams & {
|
|
1900
|
+
entryId: string;
|
|
1901
|
+
version: number;
|
|
1902
|
+
};
|
|
1903
|
+
payload: OpPatch[];
|
|
1904
|
+
headers?: RawAxiosRequestHeaders;
|
|
1905
|
+
return: EntryProps<any, {
|
|
1906
|
+
release: {
|
|
1907
|
+
sys: {
|
|
1908
|
+
type: 'Link';
|
|
1909
|
+
linkType: 'Entry' | 'Asset';
|
|
1910
|
+
id: string;
|
|
1911
|
+
};
|
|
1912
|
+
};
|
|
1913
|
+
}>;
|
|
1914
|
+
};
|
|
1915
|
+
create: {
|
|
1916
|
+
params: CreateReleaseEntryParams;
|
|
1917
|
+
payload: CreateEntryProps<any>;
|
|
1918
|
+
headers?: RawAxiosRequestHeaders;
|
|
1919
|
+
return: EntryProps<any, {
|
|
1920
|
+
release: {
|
|
1921
|
+
sys: {
|
|
1922
|
+
type: 'Link';
|
|
1923
|
+
linkType: 'Entry' | 'Asset';
|
|
1924
|
+
id: string;
|
|
1925
|
+
};
|
|
1926
|
+
};
|
|
1927
|
+
}>;
|
|
1928
|
+
};
|
|
1929
|
+
createWithId: {
|
|
1930
|
+
params: GetSpaceEnvironmentParams & {
|
|
1931
|
+
releaseId: string;
|
|
1932
|
+
entryId: string;
|
|
1933
|
+
contentTypeId: string;
|
|
1934
|
+
};
|
|
1935
|
+
payload: CreateEntryProps<any>;
|
|
1936
|
+
headers?: RawAxiosRequestHeaders;
|
|
1937
|
+
return: EntryProps<any, {
|
|
1938
|
+
release: {
|
|
1939
|
+
sys: {
|
|
1940
|
+
type: 'Link';
|
|
1941
|
+
linkType: 'Entry' | 'Asset';
|
|
1942
|
+
id: string;
|
|
1943
|
+
};
|
|
1944
|
+
};
|
|
1945
|
+
}>;
|
|
1946
|
+
};
|
|
1947
|
+
};
|
|
1872
1948
|
ReleaseAction: {
|
|
1873
1949
|
get: {
|
|
1874
1950
|
params: GetReleaseParams & {
|
|
@@ -2547,6 +2623,19 @@ export type GetEditorInterfaceParams = GetSpaceEnvironmentParams & {
|
|
|
2547
2623
|
};
|
|
2548
2624
|
export type GetEntryParams = GetSpaceEnvironmentParams & {
|
|
2549
2625
|
entryId: string;
|
|
2626
|
+
releaseId?: string;
|
|
2627
|
+
};
|
|
2628
|
+
export type GetManyEntryParams = GetSpaceEnvironmentParams & {
|
|
2629
|
+
releaseId?: string;
|
|
2630
|
+
};
|
|
2631
|
+
export type PatchEntryParams = GetSpaceEnvironmentParams & {
|
|
2632
|
+
entryId: string;
|
|
2633
|
+
version: number;
|
|
2634
|
+
releaseId?: string;
|
|
2635
|
+
};
|
|
2636
|
+
export type UpdateEntryParams = GetSpaceEnvironmentParams & {
|
|
2637
|
+
entryId: string;
|
|
2638
|
+
releaseId?: string;
|
|
2550
2639
|
};
|
|
2551
2640
|
export type GetExtensionParams = GetSpaceEnvironmentParams & {
|
|
2552
2641
|
extensionId: string;
|
|
@@ -2570,9 +2659,34 @@ export type GetFunctionLogParams = GetManyFunctionLogParams & {
|
|
|
2570
2659
|
export type GetOrganizationParams = {
|
|
2571
2660
|
organizationId: string;
|
|
2572
2661
|
};
|
|
2573
|
-
export type GetReleaseParams =
|
|
2662
|
+
export type GetReleaseParams = ReleaseEnvironmentParams & {
|
|
2574
2663
|
releaseId: string;
|
|
2575
2664
|
};
|
|
2665
|
+
export type GetReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2666
|
+
releaseId?: string;
|
|
2667
|
+
entryId: string;
|
|
2668
|
+
};
|
|
2669
|
+
export type GetManyReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2670
|
+
releaseId: string;
|
|
2671
|
+
};
|
|
2672
|
+
export type UpdateReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2673
|
+
releaseId: string;
|
|
2674
|
+
entryId: string;
|
|
2675
|
+
};
|
|
2676
|
+
export type PatchReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2677
|
+
releaseId: string;
|
|
2678
|
+
entryId: string;
|
|
2679
|
+
version: number;
|
|
2680
|
+
};
|
|
2681
|
+
export type CreateReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2682
|
+
releaseId: string;
|
|
2683
|
+
contentTypeId: string;
|
|
2684
|
+
};
|
|
2685
|
+
export type CreateWithIdReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2686
|
+
releaseId: string;
|
|
2687
|
+
entryId: string;
|
|
2688
|
+
contentTypeId: string;
|
|
2689
|
+
};
|
|
2576
2690
|
export type GetSnapshotForContentTypeParams = GetSpaceEnvironmentParams & {
|
|
2577
2691
|
contentTypeId: string;
|
|
2578
2692
|
};
|
|
@@ -2719,4 +2833,7 @@ export type GetUserParams = {
|
|
|
2719
2833
|
export declare enum ScheduledActionReferenceFilters {
|
|
2720
2834
|
contentTypeAnnotationNotIn = "sys.contentType.metadata.annotations.ContentType[nin]"
|
|
2721
2835
|
}
|
|
2836
|
+
export type ReleaseEnvironmentParams = GetSpaceEnvironmentParams & {
|
|
2837
|
+
releaseSchemaVersion?: 'Release.v1' | 'Release.v2';
|
|
2838
|
+
};
|
|
2722
2839
|
export {};
|
|
@@ -327,5 +327,5 @@ export default function createEntryApi(makeRequest: MakeRequest): {
|
|
|
327
327
|
/**
|
|
328
328
|
* Recursively collects references of an entry and their descendants
|
|
329
329
|
*/
|
|
330
|
-
references: (options?: EntryReferenceOptionsProps) => Promise<import("./common-types").Collection<Entry, EntryProps<import("./common-types").KeyValueMap>>>;
|
|
330
|
+
references: (options?: EntryReferenceOptionsProps) => Promise<import("./common-types").Collection<Entry, EntryProps<import("./common-types").KeyValueMap, unknown>>>;
|
|
331
331
|
};
|
|
@@ -8,7 +8,7 @@ import type { AssetFileProp, AssetProps, CreateAssetFromFilesOptions, CreateAsse
|
|
|
8
8
|
import type { CreateAssetKeyProps } from './entities/asset-key';
|
|
9
9
|
import type { BulkAction, BulkActionPayload, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionValidatePayload } from './entities/bulk-action';
|
|
10
10
|
import type { ReleaseActionQueryOptions } from './entities/release-action';
|
|
11
|
-
import type { ReleasePayload, ReleaseQueryOptions, ReleaseValidatePayload } from './entities/release';
|
|
11
|
+
import type { ReleasePayload, ReleaseQueryOptions, ReleaseValidatePayload, ReleasePayloadV2 } from './entities/release';
|
|
12
12
|
import type { ContentTypeProps, CreateContentTypeProps } from './entities/content-type';
|
|
13
13
|
import type { CreateEntryProps, EntryProps, EntryReferenceOptionsProps, EntryReferenceProps } from './entities/entry';
|
|
14
14
|
import type { CreateExtensionProps } from './entities/extension';
|
|
@@ -269,7 +269,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
269
269
|
*
|
|
270
270
|
* // Using Thenables
|
|
271
271
|
* client.getSpace('<space_id>')
|
|
272
|
-
* .then((space) => space.getEnvironment('<
|
|
272
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
273
273
|
* .then((environment) => environment.createUnpublishBulkAction(payload))
|
|
274
274
|
* .then((bulkAction) => console.log(bulkAction.waitProcessing()))
|
|
275
275
|
* .catch(console.error)
|
|
@@ -277,7 +277,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
277
277
|
* // Using async/await
|
|
278
278
|
* try {
|
|
279
279
|
* const space = await clientgetSpace('<space_id>')
|
|
280
|
-
* const environment = await space.getEnvironment('<
|
|
280
|
+
* const environment = await space.getEnvironment('<environment-id>')
|
|
281
281
|
* const bulkActionInProgress = await environment.createUnpublishBulkAction(payload)
|
|
282
282
|
*
|
|
283
283
|
* // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
|
|
@@ -486,7 +486,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
486
486
|
* .catch(console.error)
|
|
487
487
|
* ```
|
|
488
488
|
*/
|
|
489
|
-
getEntries(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap>>>;
|
|
489
|
+
getEntries(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap, unknown>>>;
|
|
490
490
|
/**
|
|
491
491
|
* Gets a collection of published Entries
|
|
492
492
|
* @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
|
|
@@ -505,7 +505,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
505
505
|
* .catch(console.error)
|
|
506
506
|
* ```
|
|
507
507
|
*/
|
|
508
|
-
getPublishedEntries(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap>>>;
|
|
508
|
+
getPublishedEntries(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap, unknown>>>;
|
|
509
509
|
/**
|
|
510
510
|
* Creates a Entry
|
|
511
511
|
* @param contentTypeId - The Content Type ID of the newly created Entry
|
|
@@ -574,7 +574,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
574
574
|
*
|
|
575
575
|
* // Get entry references
|
|
576
576
|
* client.getSpace('<space_id>')
|
|
577
|
-
* .then((space) => space.getEnvironment('<
|
|
577
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
578
578
|
* .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
|
|
579
579
|
* .then((entry) => console.log(entry.includes))
|
|
580
580
|
* // or
|
|
@@ -1380,7 +1380,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
1380
1380
|
*/
|
|
1381
1381
|
updateRelease({ releaseId, payload, version, }: {
|
|
1382
1382
|
releaseId: string;
|
|
1383
|
-
payload: ReleasePayload;
|
|
1383
|
+
payload: ReleasePayload | ReleasePayloadV2;
|
|
1384
1384
|
version: number;
|
|
1385
1385
|
}): Promise<import("./entities/release").Release>;
|
|
1386
1386
|
/**
|
|
@@ -1612,7 +1612,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
1612
1612
|
* })
|
|
1613
1613
|
*
|
|
1614
1614
|
* client.getSpace('<space_id>')
|
|
1615
|
-
* .then((space) => space.getEnvironment('<
|
|
1615
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
1616
1616
|
* .then((environment) => environment.getResourceTypes({limit: 10}))
|
|
1617
1617
|
* .then((installations) => console.log(installations.items))
|
|
1618
1618
|
* .catch(console.error)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CollectionProp, DefaultElements, EntryMetaSysProps, KeyValueMap, MakeRequest, MetadataProps } from '../common-types';
|
|
2
2
|
import type { ContentfulEntryApi } from '../create-entry-api';
|
|
3
3
|
import type { AssetProps } from './asset';
|
|
4
|
-
export type EntryProps<T = KeyValueMap> = {
|
|
5
|
-
sys: EntryMetaSysProps;
|
|
4
|
+
export type EntryProps<T = KeyValueMap, S = unknown> = {
|
|
5
|
+
sys: EntryMetaSysProps & S;
|
|
6
6
|
metadata?: MetadataProps;
|
|
7
7
|
fields: T;
|
|
8
8
|
};
|
|
@@ -50,4 +50,4 @@ export declare function wrapEntry(makeRequest: MakeRequest, data: EntryProps): E
|
|
|
50
50
|
* Data is also mixed in with link getters if links exist and includes were requested
|
|
51
51
|
* @private
|
|
52
52
|
*/
|
|
53
|
-
export declare const wrapEntryCollection: (makeRequest: MakeRequest, data: CollectionProp<EntryProps<KeyValueMap>>) => import("../common-types").Collection<Entry, EntryProps<KeyValueMap>>;
|
|
53
|
+
export declare const wrapEntryCollection: (makeRequest: MakeRequest, data: CollectionProp<EntryProps<KeyValueMap, unknown>>) => import("../common-types").Collection<Entry, EntryProps<KeyValueMap, unknown>>;
|