contentful-management 11.54.4 → 11.55.0-canary.2
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 +182 -80
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +158 -55
- 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 +10 -0
- package/dist/es-modules/adapters/REST/endpoints/index.js +2 -0
- package/dist/es-modules/adapters/REST/endpoints/release-entry.js +41 -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 +6 -0
- package/dist/typings/adapters/REST/endpoints/index.d.ts +2 -0
- package/dist/typings/adapters/REST/endpoints/release-entry.d.ts +5 -0
- package/dist/typings/common-types.d.ts +69 -10
- 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 +19 -1
- package/dist/typings/plain/common-types.d.ts +67 -8
- package/dist/typings/plain/wrappers/wrap.d.ts +2 -0
- package/package.json +6 -2
|
@@ -7,6 +7,11 @@ import copy from 'fast-copy';
|
|
|
7
7
|
import * as raw from './raw';
|
|
8
8
|
import { normalizeSelect } from './utils';
|
|
9
9
|
export const get = (http, params, rawData, headers) => {
|
|
10
|
+
if (params.releaseId) {
|
|
11
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
12
|
+
'release[lte]': params.releaseId
|
|
13
|
+
});
|
|
14
|
+
}
|
|
10
15
|
return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}`, {
|
|
11
16
|
params: normalizeSelect(params.query),
|
|
12
17
|
headers: _objectSpread({}, headers)
|
|
@@ -19,6 +24,11 @@ export const getPublished = (http, params, rawData, headers) => {
|
|
|
19
24
|
});
|
|
20
25
|
};
|
|
21
26
|
export const getMany = (http, params, rawData, headers) => {
|
|
27
|
+
if (params.releaseId) {
|
|
28
|
+
params.query = _objectSpread(_objectSpread({}, params.query), {}, {
|
|
29
|
+
'release[lte]': params.releaseId
|
|
30
|
+
});
|
|
31
|
+
}
|
|
22
32
|
return raw.get(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries`, {
|
|
23
33
|
params: normalizeSelect(params.query),
|
|
24
34
|
headers: _objectSpread({}, headers)
|
|
@@ -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,41 @@
|
|
|
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
|
+
};
|
|
@@ -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.55.0-canary.2"}`, 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
|
|
@@ -2401,7 +2401,7 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
2401
2401
|
* })
|
|
2402
2402
|
*
|
|
2403
2403
|
* client.getSpace('<space_id>')
|
|
2404
|
-
* .then((space) => space.getEnvironment('<
|
|
2404
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
2405
2405
|
* .then((environment) => environment.getResourceTypes({limit: 10}))
|
|
2406
2406
|
* .then((installations) => console.log(installations.items))
|
|
2407
2407
|
* .catch(console.error)
|
|
@@ -343,6 +343,12 @@ export const createPlainClient = (makeRequest, defaults) => {
|
|
|
343
343
|
getManyForOrganization: wrap(wrapParams, 'Usage', 'getManyForOrganization')
|
|
344
344
|
},
|
|
345
345
|
release: {
|
|
346
|
+
entry: {
|
|
347
|
+
get: wrap(wrapParams, 'ReleaseEntry', 'get'),
|
|
348
|
+
getMany: wrap(wrapParams, 'ReleaseEntry', 'getMany'),
|
|
349
|
+
update: wrap(wrapParams, 'ReleaseEntry', 'update'),
|
|
350
|
+
patch: wrap(wrapParams, 'ReleaseEntry', 'patch')
|
|
351
|
+
},
|
|
346
352
|
archive: wrap(wrapParams, 'Release', 'archive'),
|
|
347
353
|
get: wrap(wrapParams, 'Release', 'get'),
|
|
348
354
|
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,5 @@
|
|
|
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'>;
|
|
@@ -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';
|
|
@@ -1488,14 +1488,14 @@ export type MRActions = {
|
|
|
1488
1488
|
return: CollectionProp<EntryProps<any>>;
|
|
1489
1489
|
};
|
|
1490
1490
|
getMany: {
|
|
1491
|
-
params: GetSpaceEnvironmentParams & QueryParams
|
|
1492
|
-
|
|
1491
|
+
params: GetSpaceEnvironmentParams & QueryParams & {
|
|
1492
|
+
releaseId?: string;
|
|
1493
|
+
};
|
|
1494
|
+
return: CollectionProp<EntryProps<any, any>>;
|
|
1493
1495
|
};
|
|
1494
1496
|
get: {
|
|
1495
|
-
params:
|
|
1496
|
-
|
|
1497
|
-
} & QueryParams;
|
|
1498
|
-
return: EntryProps<any>;
|
|
1497
|
+
params: GetReleaseEntryParams & QueryParams;
|
|
1498
|
+
return: EntryProps<any, any>;
|
|
1499
1499
|
};
|
|
1500
1500
|
patch: {
|
|
1501
1501
|
params: GetSpaceEnvironmentParams & {
|
|
@@ -1815,14 +1815,14 @@ export type MRActions = {
|
|
|
1815
1815
|
};
|
|
1816
1816
|
create: {
|
|
1817
1817
|
params: GetSpaceEnvironmentParams;
|
|
1818
|
-
payload: ReleasePayload;
|
|
1818
|
+
payload: ReleasePayload | ReleasePayloadV2;
|
|
1819
1819
|
return: ReleaseProps;
|
|
1820
1820
|
};
|
|
1821
1821
|
update: {
|
|
1822
1822
|
params: GetReleaseParams & {
|
|
1823
1823
|
version: number;
|
|
1824
1824
|
};
|
|
1825
|
-
payload: ReleasePayload;
|
|
1825
|
+
payload: ReleasePayload | ReleasePayloadV2;
|
|
1826
1826
|
return: ReleaseProps;
|
|
1827
1827
|
};
|
|
1828
1828
|
delete: {
|
|
@@ -1853,6 +1853,49 @@ export type MRActions = {
|
|
|
1853
1853
|
return: ReleaseActionProps<'validate'>;
|
|
1854
1854
|
};
|
|
1855
1855
|
};
|
|
1856
|
+
ReleaseEntry: {
|
|
1857
|
+
get: {
|
|
1858
|
+
params: GetReleaseEntryParams;
|
|
1859
|
+
return: EntryProps<any, any>;
|
|
1860
|
+
};
|
|
1861
|
+
getMany: {
|
|
1862
|
+
params: GetManyReleaseEntryParams;
|
|
1863
|
+
return: CollectionProp<EntryProps<any, any>>;
|
|
1864
|
+
};
|
|
1865
|
+
update: {
|
|
1866
|
+
params: UpdateReleaseEntryParams & {
|
|
1867
|
+
entryId: string;
|
|
1868
|
+
};
|
|
1869
|
+
payload: EntryProps<any>;
|
|
1870
|
+
headers?: RawAxiosRequestHeaders;
|
|
1871
|
+
return: EntryProps<any, {
|
|
1872
|
+
release: {
|
|
1873
|
+
sys: {
|
|
1874
|
+
type: 'Link';
|
|
1875
|
+
linkType: 'Entry' | 'Asset';
|
|
1876
|
+
id: string;
|
|
1877
|
+
};
|
|
1878
|
+
};
|
|
1879
|
+
}>;
|
|
1880
|
+
};
|
|
1881
|
+
patch: {
|
|
1882
|
+
params: PatchReleaseEntryParams & {
|
|
1883
|
+
entryId: string;
|
|
1884
|
+
version: number;
|
|
1885
|
+
};
|
|
1886
|
+
payload: OpPatch[];
|
|
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
|
+
};
|
|
1856
1899
|
ReleaseAction: {
|
|
1857
1900
|
get: {
|
|
1858
1901
|
params: GetReleaseParams & {
|
|
@@ -2549,7 +2592,20 @@ export type GetFunctionLogParams = GetManyFunctionLogParams & {
|
|
|
2549
2592
|
export type GetOrganizationParams = {
|
|
2550
2593
|
organizationId: string;
|
|
2551
2594
|
};
|
|
2552
|
-
export type GetReleaseParams =
|
|
2595
|
+
export type GetReleaseParams = ReleaseEnvironmentParams & {
|
|
2596
|
+
releaseId: string;
|
|
2597
|
+
};
|
|
2598
|
+
export type GetReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2599
|
+
releaseId?: string;
|
|
2600
|
+
entryId: string;
|
|
2601
|
+
};
|
|
2602
|
+
export type GetManyReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2603
|
+
releaseId: string;
|
|
2604
|
+
};
|
|
2605
|
+
export type UpdateReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2606
|
+
releaseId: string;
|
|
2607
|
+
};
|
|
2608
|
+
export type PatchReleaseEntryParams = GetSpaceEnvironmentParams & {
|
|
2553
2609
|
releaseId: string;
|
|
2554
2610
|
};
|
|
2555
2611
|
export type GetSnapshotForContentTypeParams = GetSpaceEnvironmentParams & {
|
|
@@ -2698,4 +2754,7 @@ export type GetUserParams = {
|
|
|
2698
2754
|
export declare enum ScheduledActionReferenceFilters {
|
|
2699
2755
|
contentTypeAnnotationNotIn = "sys.contentType.metadata.annotations.ContentType[nin]"
|
|
2700
2756
|
}
|
|
2757
|
+
export type ReleaseEnvironmentParams = GetSpaceEnvironmentParams & {
|
|
2758
|
+
releaseSchemaVersion?: 'Release.v1' | 'Release.v2';
|
|
2759
|
+
};
|
|
2701
2760
|
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
|
|
@@ -1358,7 +1358,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
1358
1358
|
*/
|
|
1359
1359
|
updateRelease({ releaseId, payload, version, }: {
|
|
1360
1360
|
releaseId: string;
|
|
1361
|
-
payload: ReleasePayload;
|
|
1361
|
+
payload: ReleasePayload | ReleasePayloadV2;
|
|
1362
1362
|
version: number;
|
|
1363
1363
|
}): Promise<import("./entities/release").Release>;
|
|
1364
1364
|
/**
|
|
@@ -1590,7 +1590,7 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
1590
1590
|
* })
|
|
1591
1591
|
*
|
|
1592
1592
|
* client.getSpace('<space_id>')
|
|
1593
|
-
* .then((space) => space.getEnvironment('<
|
|
1593
|
+
* .then((space) => space.getEnvironment('<environment-id>'))
|
|
1594
1594
|
* .then((environment) => environment.getResourceTypes({limit: 10}))
|
|
1595
1595
|
* .then((installations) => console.log(installations.items))
|
|
1596
1596
|
* .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>>;
|
|
@@ -18,6 +18,8 @@ export interface ReleaseQueryOptions {
|
|
|
18
18
|
'sys.createdBy.sys.id[in]'?: string;
|
|
19
19
|
/** Comma-separated filter (inclusion) by Release status (active, archived) */
|
|
20
20
|
'sys.status[in]'?: ReleaseStatus;
|
|
21
|
+
/** Determines the Release API version to use. 'Release.v1' refers to Launch, 'Release.v2' refers to Releases. */
|
|
22
|
+
'sys.schemaVersion'?: 'Release.v1' | 'Release.v2';
|
|
21
23
|
/** Comma-separated filter (exclusion) by Release status (active, archived) */
|
|
22
24
|
'sys.status[nin]'?: ReleaseStatus;
|
|
23
25
|
/** Find releases using full text phrase and term matching */
|
|
@@ -55,6 +57,7 @@ export type ReleaseSysProps = {
|
|
|
55
57
|
createdAt: ISO8601Timestamp;
|
|
56
58
|
updatedAt: ISO8601Timestamp;
|
|
57
59
|
lastAction?: Link<'ReleaseAction'>;
|
|
60
|
+
schemaVersion?: 'Release.v2';
|
|
58
61
|
};
|
|
59
62
|
export type ReleaseReferenceFilters = ScheduledActionReferenceFilters;
|
|
60
63
|
export declare const ReleaseReferenceFilters: typeof ScheduledActionReferenceFilters;
|
|
@@ -72,9 +75,24 @@ export interface ReleaseProps {
|
|
|
72
75
|
metadata?: ReleaseMetadata;
|
|
73
76
|
}
|
|
74
77
|
export interface ReleasePayload extends MakeRequestPayload {
|
|
78
|
+
sys?: {
|
|
79
|
+
type: 'Release';
|
|
80
|
+
schemaVersion?: 'Release.v1' | undefined;
|
|
81
|
+
};
|
|
75
82
|
title: string;
|
|
76
83
|
entities: BaseCollection<Link<Entity>>;
|
|
77
84
|
}
|
|
85
|
+
export interface ReleasePayloadV2 extends MakeRequestPayload {
|
|
86
|
+
sys?: {
|
|
87
|
+
type: 'Release';
|
|
88
|
+
schemaVersion: 'Release.v2';
|
|
89
|
+
};
|
|
90
|
+
title: string;
|
|
91
|
+
entities: BaseCollection<{
|
|
92
|
+
entity: Link<Entity>;
|
|
93
|
+
} & ReleaseValidatePayload>;
|
|
94
|
+
startDate?: ISO8601Timestamp;
|
|
95
|
+
}
|
|
78
96
|
export interface ReleaseValidatePayload {
|
|
79
97
|
action?: 'publish';
|
|
80
98
|
}
|
|
@@ -95,7 +113,7 @@ export interface ReleaseApiMethods {
|
|
|
95
113
|
* */
|
|
96
114
|
unarchive(): Promise<Release>;
|
|
97
115
|
/** Updates a Release and returns the updated Release object */
|
|
98
|
-
update(payload: ReleasePayload): Promise<Release>;
|
|
116
|
+
update(payload: ReleasePayload | ReleasePayloadV2): Promise<Release>;
|
|
99
117
|
/** Deletes a Release and all ReleaseActions linked to it (non-reversible) */
|
|
100
118
|
delete(): Promise<void>;
|
|
101
119
|
/** Publishes a Release and waits until the asynchronous action is completed */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RawAxiosRequestConfig, RawAxiosRequestHeaders } from 'axios';
|
|
2
2
|
import type { OpPatch } from 'json-patch';
|
|
3
|
-
import type { BasicCursorPaginationOptions, CollectionProp, CursorPaginatedCollectionProp, EnvironmentTemplateParams, GetBulkActionParams, GetContentTypeParams, GetEnvironmentTemplateParams, GetOrganizationMembershipParams, GetOrganizationParams, GetReleaseParams, GetSnapshotForContentTypeParams, GetSnapshotForEntryParams, GetSpaceEnvironmentParams, GetSpaceParams, KeyValueMap, QueryParams } from '../common-types';
|
|
3
|
+
import type { BasicCursorPaginationOptions, CollectionProp, CursorPaginatedCollectionProp, EnvironmentTemplateParams, GetBulkActionParams, GetContentTypeParams, GetEnvironmentTemplateParams, GetManyReleaseEntryParams, GetOrganizationMembershipParams, GetOrganizationParams, GetReleaseEntryParams, GetReleaseParams, GetSnapshotForContentTypeParams, GetSnapshotForEntryParams, GetSpaceEnvironmentParams, GetSpaceParams, KeyValueMap, PatchReleaseEntryParams, QueryParams, ReleaseEnvironmentParams, UpdateReleaseEntryParams } from '../common-types';
|
|
4
4
|
import type { AccessTokenProps, CreatePersonalAccessTokenProps as CreatePATProps } from '../entities/access-token';
|
|
5
5
|
import type { ApiKeyProps, CreateApiKeyProps } from '../entities/api-key';
|
|
6
6
|
import type { AssetFileProp, AssetProcessingForLocale, AssetProps, CreateAssetProps } from '../entities/asset';
|
|
@@ -14,7 +14,7 @@ import type { CreateOrganizationInvitationProps, OrganizationInvitationProps } f
|
|
|
14
14
|
import type { OrganizationMembershipProps } from '../entities/organization-membership';
|
|
15
15
|
import type { CreatePersonalAccessTokenProps, PersonalAccessTokenProps } from '../entities/personal-access-token';
|
|
16
16
|
import type { PreviewApiKeyProps } from '../entities/preview-api-key';
|
|
17
|
-
import type { ReleasePayload, ReleaseProps, ReleaseQueryOptions, ReleaseValidatePayload } from '../entities/release';
|
|
17
|
+
import type { ReleasePayload, ReleasePayloadV2, ReleaseProps, ReleaseQueryOptions, ReleaseValidatePayload } from '../entities/release';
|
|
18
18
|
import type { ReleaseActionProps, ReleaseActionQueryOptions } from '../entities/release-action';
|
|
19
19
|
import type { CreateUpdateScheduledActionProps, ScheduledActionProps } from '../entities/scheduled-action';
|
|
20
20
|
import type { SnapshotProps } from '../entities/snapshot';
|
|
@@ -162,10 +162,26 @@ export type PlainClientAPI = {
|
|
|
162
162
|
user: UserPlainClientAPI;
|
|
163
163
|
entry: {
|
|
164
164
|
getPublished<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<EntryProps<T>>>;
|
|
165
|
-
getMany<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
getMany<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams & {
|
|
166
|
+
releaseId?: string;
|
|
167
|
+
}>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<CollectionProp<EntryProps<T, {
|
|
168
|
+
release: {
|
|
169
|
+
sys: {
|
|
170
|
+
type: 'Link';
|
|
171
|
+
linkType: 'Entry' | 'Asset';
|
|
172
|
+
id: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
}>>>;
|
|
176
|
+
get<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetReleaseEntryParams>, rawData?: unknown, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T, {
|
|
177
|
+
release: {
|
|
178
|
+
sys: {
|
|
179
|
+
type: 'Link';
|
|
180
|
+
linkType: 'Entry' | 'Asset';
|
|
181
|
+
id: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
}>>;
|
|
169
185
|
update<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetSpaceEnvironmentParams & {
|
|
170
186
|
entryId: string;
|
|
171
187
|
}>, rawData: EntryProps<T>, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T>>;
|
|
@@ -266,6 +282,49 @@ export type PlainClientAPI = {
|
|
|
266
282
|
};
|
|
267
283
|
usage: UsagePlainClientAPI;
|
|
268
284
|
release: {
|
|
285
|
+
entry: {
|
|
286
|
+
get<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetReleaseEntryParams>): Promise<EntryProps<T, {
|
|
287
|
+
release: {
|
|
288
|
+
sys: {
|
|
289
|
+
type: 'Link';
|
|
290
|
+
linkType: 'Entry' | 'Asset';
|
|
291
|
+
id: string;
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
}>>;
|
|
295
|
+
getMany<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<GetManyReleaseEntryParams>): Promise<CollectionProp<EntryProps<T, {
|
|
296
|
+
release: {
|
|
297
|
+
sys: {
|
|
298
|
+
type: 'Link';
|
|
299
|
+
linkType: 'Entry' | 'Asset';
|
|
300
|
+
id: string;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
}>>>;
|
|
304
|
+
update<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<UpdateReleaseEntryParams & {
|
|
305
|
+
entryId: string;
|
|
306
|
+
}>, rawData: EntryProps<T>, headers?: RawAxiosRequestHeaders): Promise<EntryProps<T, {
|
|
307
|
+
release: {
|
|
308
|
+
sys: {
|
|
309
|
+
type: 'Link';
|
|
310
|
+
linkType: 'Entry' | 'Asset';
|
|
311
|
+
id: string;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
}>>;
|
|
315
|
+
patch<T extends KeyValueMap = KeyValueMap>(params: OptionalDefaults<PatchReleaseEntryParams & {
|
|
316
|
+
entryId: string;
|
|
317
|
+
version: number;
|
|
318
|
+
}>, rawData: OpPatch[], headers?: RawAxiosRequestHeaders): Promise<EntryProps<T, {
|
|
319
|
+
release: {
|
|
320
|
+
sys: {
|
|
321
|
+
type: 'Link';
|
|
322
|
+
linkType: 'Entry' | 'Asset';
|
|
323
|
+
id: string;
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
}>>;
|
|
327
|
+
};
|
|
269
328
|
archive(params: OptionalDefaults<GetReleaseParams & {
|
|
270
329
|
version: number;
|
|
271
330
|
}>): Promise<ReleaseProps>;
|
|
@@ -273,10 +332,10 @@ export type PlainClientAPI = {
|
|
|
273
332
|
query(params: OptionalDefaults<GetSpaceEnvironmentParams> & {
|
|
274
333
|
query?: ReleaseQueryOptions;
|
|
275
334
|
}): Promise<CursorPaginatedCollectionProp<ReleaseProps>>;
|
|
276
|
-
create(params: OptionalDefaults<
|
|
335
|
+
create(params: OptionalDefaults<ReleaseEnvironmentParams>, data: ReleasePayload | ReleasePayloadV2): Promise<ReleaseProps>;
|
|
277
336
|
update(params: OptionalDefaults<GetReleaseParams & {
|
|
278
337
|
version: number;
|
|
279
|
-
}>, data: ReleasePayload): Promise<ReleaseProps>;
|
|
338
|
+
}>, data: ReleasePayload | ReleasePayloadV2): Promise<ReleaseProps>;
|
|
280
339
|
delete(params: OptionalDefaults<GetReleaseParams>): Promise<void>;
|
|
281
340
|
publish(params: OptionalDefaults<GetReleaseParams & {
|
|
282
341
|
version: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-management",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.55.0-canary.2",
|
|
4
4
|
"description": "Client for Contentful's Content Management API",
|
|
5
5
|
"homepage": "https://www.contentful.com/developers/documentation/content-management-api/",
|
|
6
6
|
"main": "./dist/contentful-management.node.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"test:types": "npx vitest --project types --run",
|
|
46
46
|
"test:unit-watch": "npx vitest --project unit",
|
|
47
47
|
"test:integration": "npx vitest --project integration --run --no-file-parallelism",
|
|
48
|
-
"test:integration-watch": "npx vitest --project integration --no-file-parallelism",
|
|
48
|
+
"test:integration-watch": "npx vitest --project integration --no-file-parallelism entry-integration",
|
|
49
49
|
"test:browser": "npx playwright install && npx vitest --project browser-unit --run && npx vitest --project browser-integration --run",
|
|
50
50
|
"test:version": "grep -r \"0.0.0-determined-by-semantic-release\" ./dist > /dev/null && echo \"version 0.0.0-determined-by-semantic-release found in output\" && exit 1 || exit 0",
|
|
51
51
|
"test:size": "size-limit",
|
|
@@ -142,6 +142,10 @@
|
|
|
142
142
|
"name": "beta",
|
|
143
143
|
"channel": "beta",
|
|
144
144
|
"prerelease": true
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "canary",
|
|
148
|
+
"prerelease": true
|
|
145
149
|
}
|
|
146
150
|
],
|
|
147
151
|
"plugins": [
|