contentful-management 7.45.2 → 7.45.6
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/dist/contentful-management.browser.js +111 -72
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.legacy.js +111 -72
- package/dist/contentful-management.legacy.js.map +1 -1
- package/dist/contentful-management.legacy.min.js +1 -1
- package/dist/contentful-management.node.js +633 -578
- 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 +4 -3
- package/dist/es-modules/constants/editor-interface-defaults/sidebar-defaults.js +1 -8
- package/dist/es-modules/contentful-management.js +2 -1
- package/dist/es-modules/create-entry-api.js +1 -1
- package/dist/es-modules/create-environment-api.js +9 -4
- package/dist/es-modules/create-space-api.js +12 -8
- package/dist/es-modules/entities/scheduled-action.js +12 -8
- package/dist/typings/common-types.d.ts +4 -0
- package/dist/typings/contentful-management.d.ts +1 -0
- package/dist/typings/create-environment-api.d.ts +4 -3
- package/dist/typings/create-space-api.d.ts +12 -8
- package/dist/typings/entities/entry.d.ts +6 -2
- package/dist/typings/entities/preview-api-key.d.ts +1 -0
- package/dist/typings/plain/common-types.d.ts +4 -0
- package/package.json +8 -7
|
@@ -76,7 +76,8 @@ export var references = function references(http, params) {
|
|
|
76
76
|
var spaceId = params.spaceId,
|
|
77
77
|
environmentId = params.environmentId,
|
|
78
78
|
entryId = params.entryId,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
maxDepth = params.maxDepth,
|
|
80
|
+
include = params.include;
|
|
81
|
+
var level = include || maxDepth || 2;
|
|
82
|
+
return raw.get(http, "/spaces/".concat(spaceId, "/environments/").concat(environmentId, "/entries/").concat(entryId, "/references?include=").concat(level));
|
|
82
83
|
};
|
|
@@ -9,7 +9,6 @@ var SidebarWidgetTypes = {
|
|
|
9
9
|
VERSIONS: 'versions-widget',
|
|
10
10
|
INFO_PANEL: 'info-panel',
|
|
11
11
|
JOBS: 'jobs-widget',
|
|
12
|
-
TASKS: 'content-workflows-tasks-widget',
|
|
13
12
|
COMMENTS_PANEL: 'comments-panel'
|
|
14
13
|
};
|
|
15
14
|
var Publication = {
|
|
@@ -24,12 +23,6 @@ var Releases = {
|
|
|
24
23
|
name: 'Release',
|
|
25
24
|
description: 'Built-in - View release, add to it, etc.'
|
|
26
25
|
};
|
|
27
|
-
var Tasks = {
|
|
28
|
-
widgetId: SidebarWidgetTypes.TASKS,
|
|
29
|
-
widgetNamespace: WidgetNamespace.SIDEBAR_BUILTIN,
|
|
30
|
-
name: 'Tasks',
|
|
31
|
-
description: 'Built-in - Assign tasks to be completed before publishing. Currently only supported for master environment.'
|
|
32
|
-
};
|
|
33
26
|
var ContentPreview = {
|
|
34
27
|
widgetId: SidebarWidgetTypes.CONTENT_PREVIEW,
|
|
35
28
|
widgetNamespace: WidgetNamespace.SIDEBAR_BUILTIN,
|
|
@@ -60,5 +53,5 @@ var Users = {
|
|
|
60
53
|
name: 'Users',
|
|
61
54
|
description: 'Built-in - Displays users on the same entry.'
|
|
62
55
|
};
|
|
63
|
-
export var SidebarEntryConfiguration = [Publication, Releases,
|
|
56
|
+
export var SidebarEntryConfiguration = [Publication, Releases, ContentPreview, Links, Translation, Versions, Users];
|
|
64
57
|
export var SidebarAssetConfiguration = [Publication, Releases, Links, Translation, Users];
|
|
@@ -19,12 +19,13 @@ export { isDraft, isPublished, isUpdated } from './plain/checks';
|
|
|
19
19
|
export { createClient };
|
|
20
20
|
export { RestAdapter } from './adapters/REST/rest-adapter';
|
|
21
21
|
export { editorInterfaceDefaults };
|
|
22
|
+
export * from './export-types';
|
|
22
23
|
|
|
23
24
|
function createClient(params) {
|
|
24
25
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25
26
|
var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
26
27
|
var userAgent = getUserAgentHeader( // @ts-expect-error
|
|
27
|
-
"".concat(sdkMain, "/").concat("7.45.
|
|
28
|
+
"".concat(sdkMain, "/").concat("7.45.6"), params.application, params.integration, params.feature);
|
|
28
29
|
var adapter = createAdapter(params); // Parameters<?> and ReturnType<?> only return the types of the last overload
|
|
29
30
|
// https://github.com/microsoft/TypeScript/issues/26591
|
|
30
31
|
// @ts-expect-error
|
|
@@ -579,7 +579,7 @@ export default function createEntryApi(makeRequest) {
|
|
|
579
579
|
spaceId: raw.sys.space.sys.id,
|
|
580
580
|
environmentId: raw.sys.environment.sys.id,
|
|
581
581
|
entryId: raw.sys.id,
|
|
582
|
-
maxDepth: options === null || options === void 0 ? void 0 : options.maxDepth
|
|
582
|
+
maxDepth: (options === null || options === void 0 ? void 0 : options.include) || (options === null || options === void 0 ? void 0 : options.maxDepth)
|
|
583
583
|
}
|
|
584
584
|
}).then(function (response) {
|
|
585
585
|
return wrapEntryCollection(makeRequest, response);
|
|
@@ -812,7 +812,8 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
812
812
|
/**
|
|
813
813
|
* Get entry references
|
|
814
814
|
* @param entryId - Entry ID
|
|
815
|
-
* @param {Object} options.
|
|
815
|
+
* @param {Object} options.include - Level of the entry descendants from 1 up to 10 maximum
|
|
816
|
+
* @param {Object} options.maxDepth - alias for `include`. Deprecated, please use `include`
|
|
816
817
|
* @returns Promise of Entry references
|
|
817
818
|
* @example ```javascript
|
|
818
819
|
* const contentful = require('contentful-management');
|
|
@@ -824,10 +825,10 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
824
825
|
* // Get entry references
|
|
825
826
|
* client.getSpace('<space_id>')
|
|
826
827
|
* .then((space) => space.getEnvironment('<environment_id>'))
|
|
827
|
-
* .then((environment) => environment.getEntryReferences('<entry_id>', {
|
|
828
|
+
* .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
|
|
828
829
|
* .then((entry) => console.log(entry.includes))
|
|
829
830
|
* // or
|
|
830
|
-
* .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({
|
|
831
|
+
* .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({include: number}))
|
|
831
832
|
* .catch(console.error)
|
|
832
833
|
* ```
|
|
833
834
|
*/
|
|
@@ -840,7 +841,11 @@ export default function createEnvironmentApi(makeRequest) {
|
|
|
840
841
|
spaceId: raw.sys.space.sys.id,
|
|
841
842
|
environmentId: raw.sys.id,
|
|
842
843
|
entryId: entryId,
|
|
843
|
-
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* @deprecated use `include` instead
|
|
847
|
+
*/
|
|
848
|
+
maxDepth: (options === null || options === void 0 ? void 0 : options.include) || (options === null || options === void 0 ? void 0 : options.maxDepth)
|
|
844
849
|
}
|
|
845
850
|
}).then(function (response) {
|
|
846
851
|
return wrapEntryCollection(makeRequest, response);
|
|
@@ -1355,13 +1355,15 @@ export default function createSpaceApi(makeRequest) {
|
|
|
1355
1355
|
* }
|
|
1356
1356
|
* },
|
|
1357
1357
|
* environment: {
|
|
1358
|
-
*
|
|
1359
|
-
*
|
|
1360
|
-
*
|
|
1358
|
+
* sys: {
|
|
1359
|
+
* type: 'Link',
|
|
1360
|
+
* linkType: 'Environment',
|
|
1361
|
+
* id: '<environment_id>'
|
|
1362
|
+
* }
|
|
1361
1363
|
* },
|
|
1362
1364
|
* action: 'publish',
|
|
1363
1365
|
* scheduledFor: {
|
|
1364
|
-
*
|
|
1366
|
+
* datetime: <ISO_date_string>,
|
|
1365
1367
|
* timezone: 'Europe/Berlin'
|
|
1366
1368
|
* }
|
|
1367
1369
|
* }))
|
|
@@ -1408,13 +1410,15 @@ export default function createSpaceApi(makeRequest) {
|
|
|
1408
1410
|
* }
|
|
1409
1411
|
* },
|
|
1410
1412
|
* environment: {
|
|
1411
|
-
*
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1413
|
+
* sys: {
|
|
1414
|
+
* type: 'Link',
|
|
1415
|
+
* linkType: 'Environment',
|
|
1416
|
+
* id: '<environment_id>'
|
|
1417
|
+
* }
|
|
1414
1418
|
* },
|
|
1415
1419
|
* action: 'publish',
|
|
1416
1420
|
* scheduledFor: {
|
|
1417
|
-
*
|
|
1421
|
+
* datetime: <ISO_date_string>,
|
|
1418
1422
|
* timezone: 'Europe/Berlin'
|
|
1419
1423
|
* }
|
|
1420
1424
|
* })
|
|
@@ -61,13 +61,15 @@ export default function getInstanceMethods(makeRequest) {
|
|
|
61
61
|
* }
|
|
62
62
|
* },
|
|
63
63
|
* environment: {
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
64
|
+
* sys: {
|
|
65
|
+
* type: 'Link',
|
|
66
|
+
* linkType: 'Environment',
|
|
67
|
+
* id: '<environment_id>'
|
|
68
|
+
* }
|
|
67
69
|
* },
|
|
68
70
|
* action: 'publish',
|
|
69
71
|
* scheduledFor: {
|
|
70
|
-
*
|
|
72
|
+
* datetime: <ISO_date_string>,
|
|
71
73
|
* timezone: 'Europe/Berlin'
|
|
72
74
|
* }
|
|
73
75
|
* })
|
|
@@ -124,13 +126,15 @@ export default function getInstanceMethods(makeRequest) {
|
|
|
124
126
|
* }
|
|
125
127
|
* },
|
|
126
128
|
* environment: {
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
129
|
+
* sys: {
|
|
130
|
+
* type: 'Link',
|
|
131
|
+
* linkType: 'Environment',
|
|
132
|
+
* id: '<environment_id>'
|
|
133
|
+
* }
|
|
130
134
|
* },
|
|
131
135
|
* action: 'publish',
|
|
132
136
|
* scheduledFor: {
|
|
133
|
-
*
|
|
137
|
+
* datetime: <ISO_date_string>,
|
|
134
138
|
* timezone: 'Europe/Berlin'
|
|
135
139
|
* }
|
|
136
140
|
* })
|
|
@@ -915,7 +915,11 @@ export declare type MRActions = {
|
|
|
915
915
|
references: {
|
|
916
916
|
params: GetSpaceEnvironmentParams & {
|
|
917
917
|
entryId: string;
|
|
918
|
+
/**
|
|
919
|
+
* @deprecated use `include` param instead
|
|
920
|
+
*/
|
|
918
921
|
maxDepth?: number;
|
|
922
|
+
include?: number;
|
|
919
923
|
};
|
|
920
924
|
return: EntryReferenceProps;
|
|
921
925
|
};
|
|
@@ -17,6 +17,7 @@ export { createClient };
|
|
|
17
17
|
export { RestAdapter } from './adapters/REST/rest-adapter';
|
|
18
18
|
export { editorInterfaceDefaults };
|
|
19
19
|
export declare type PlainClientDefaultParams = DefaultParams;
|
|
20
|
+
export * from './export-types';
|
|
20
21
|
interface UserAgentParams {
|
|
21
22
|
/**
|
|
22
23
|
* Application name and version e.g myApp/version
|
|
@@ -540,7 +540,8 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
540
540
|
/**
|
|
541
541
|
* Get entry references
|
|
542
542
|
* @param entryId - Entry ID
|
|
543
|
-
* @param {Object} options.
|
|
543
|
+
* @param {Object} options.include - Level of the entry descendants from 1 up to 10 maximum
|
|
544
|
+
* @param {Object} options.maxDepth - alias for `include`. Deprecated, please use `include`
|
|
544
545
|
* @returns Promise of Entry references
|
|
545
546
|
* @example ```javascript
|
|
546
547
|
* const contentful = require('contentful-management');
|
|
@@ -552,10 +553,10 @@ export default function createEnvironmentApi(makeRequest: MakeRequest): {
|
|
|
552
553
|
* // Get entry references
|
|
553
554
|
* client.getSpace('<space_id>')
|
|
554
555
|
* .then((space) => space.getEnvironment('<environment_id>'))
|
|
555
|
-
* .then((environment) => environment.getEntryReferences('<entry_id>', {
|
|
556
|
+
* .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
|
|
556
557
|
* .then((entry) => console.log(entry.includes))
|
|
557
558
|
* // or
|
|
558
|
-
* .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({
|
|
559
|
+
* .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({include: number}))
|
|
559
560
|
* .catch(console.error)
|
|
560
561
|
* ```
|
|
561
562
|
*/
|
|
@@ -832,13 +832,15 @@ export default function createSpaceApi(makeRequest: MakeRequest): {
|
|
|
832
832
|
* }
|
|
833
833
|
* },
|
|
834
834
|
* environment: {
|
|
835
|
-
*
|
|
836
|
-
*
|
|
837
|
-
*
|
|
835
|
+
* sys: {
|
|
836
|
+
* type: 'Link',
|
|
837
|
+
* linkType: 'Environment',
|
|
838
|
+
* id: '<environment_id>'
|
|
839
|
+
* }
|
|
838
840
|
* },
|
|
839
841
|
* action: 'publish',
|
|
840
842
|
* scheduledFor: {
|
|
841
|
-
*
|
|
843
|
+
* datetime: <ISO_date_string>,
|
|
842
844
|
* timezone: 'Europe/Berlin'
|
|
843
845
|
* }
|
|
844
846
|
* }))
|
|
@@ -872,13 +874,15 @@ export default function createSpaceApi(makeRequest: MakeRequest): {
|
|
|
872
874
|
* }
|
|
873
875
|
* },
|
|
874
876
|
* environment: {
|
|
875
|
-
*
|
|
876
|
-
*
|
|
877
|
-
*
|
|
877
|
+
* sys: {
|
|
878
|
+
* type: 'Link',
|
|
879
|
+
* linkType: 'Environment',
|
|
880
|
+
* id: '<environment_id>'
|
|
881
|
+
* }
|
|
878
882
|
* },
|
|
879
883
|
* action: 'publish',
|
|
880
884
|
* scheduledFor: {
|
|
881
|
-
*
|
|
885
|
+
* datetime: <ISO_date_string>,
|
|
882
886
|
* timezone: 'Europe/Berlin'
|
|
883
887
|
* }
|
|
884
888
|
* })
|
|
@@ -9,12 +9,16 @@ export declare type EntryProps<T = KeyValueMap> = {
|
|
|
9
9
|
export declare type CreateEntryProps<TFields = KeyValueMap> = Omit<EntryProps<TFields>, 'sys'>;
|
|
10
10
|
export interface EntryReferenceProps extends CollectionProp<EntryProps> {
|
|
11
11
|
includes?: {
|
|
12
|
-
Entry?:
|
|
13
|
-
Asset?:
|
|
12
|
+
Entry?: EntryProps[];
|
|
13
|
+
Asset?: AssetProps[];
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export declare type EntryReferenceOptionsProps = {
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated use `include` param instead
|
|
19
|
+
*/
|
|
17
20
|
maxDepth?: number;
|
|
21
|
+
include?: number;
|
|
18
22
|
};
|
|
19
23
|
export interface Entry extends EntryProps, DefaultElements<EntryProps>, ContentfulEntryApi {
|
|
20
24
|
}
|
|
@@ -176,7 +176,11 @@ export declare type PlainClientAPI = {
|
|
|
176
176
|
}>, rawData: CreateEntryProps<T>): Promise<EntryProps<T>>;
|
|
177
177
|
references(params: OptionalDefaults<GetSpaceEnvironmentParams & {
|
|
178
178
|
entryId: string;
|
|
179
|
+
/**
|
|
180
|
+
* @deprecated use `include` param instead
|
|
181
|
+
*/
|
|
179
182
|
maxDepth?: number;
|
|
183
|
+
include?: number;
|
|
180
184
|
}>): Promise<EntryReferenceProps>;
|
|
181
185
|
};
|
|
182
186
|
asset: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-management",
|
|
3
|
-
"version": "7.45.
|
|
3
|
+
"version": "7.45.6",
|
|
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",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"lint": "eslint lib test --ext '.ts,.tsx,.js,.jsx'",
|
|
32
32
|
"pretest": "rimraf coverage && npm run lint",
|
|
33
33
|
"test": "npm run test:cover-unit && npm run test:cover-integration && npm run test:size",
|
|
34
|
-
"test:cover-unit": "./node_modules/.bin/nyc --reporter=lcov --reporter=text --report-dir=coverage/unit npm run test:unit",
|
|
35
|
-
"test:cover-integration": "./node_modules/.bin/nyc --reporter=lcov --reporter=text --report-dir=coverage/integration npm run test:integration",
|
|
36
|
-
"test:unit": "BABEL_ENV=test babel-node --extensions .ts --extensions .js ./node_modules/.bin/mocha './test/unit/**/*-test.[tj]s' --config mocharc.js --require @babel/register",
|
|
34
|
+
"test:cover-unit": "./node_modules/.bin/nyc --reporter=lcov --reporter=text --reporter=clover --report-dir=coverage/unit npm run test:unit",
|
|
35
|
+
"test:cover-integration": "./node_modules/.bin/nyc --reporter=lcov --reporter=text --reporter=clover --report-dir=coverage/integration npm run test:integration",
|
|
36
|
+
"test:unit": "BABEL_ENV=test babel-node --extensions .ts --extensions .js ./node_modules/.bin/mocha './test/unit/**/*-test.[tj]s' --config mocharc.js --require @babel/register --reporter mocha-junit-reporter --reporter-options mochaFile=reports/unit-results.xml",
|
|
37
37
|
"test:unit-watch": "BABEL_ENV=test babel-node --extensions .ts --extensions .js ./node_modules/.bin/mocha './test/unit/**/*-test.[tj]s' --config mocharc.js --watch --require @babel/register",
|
|
38
|
-
"test:integration": "BABEL_ENV=test babel-node --extensions .ts --extensions .js ./node_modules/.bin/mocha './test/integration/*.[tj]s' --config mocharc.js --require @babel/register",
|
|
38
|
+
"test:integration": "BABEL_ENV=test babel-node --extensions .ts --extensions .js ./node_modules/.bin/mocha './test/integration/*.[tj]s' --config mocharc.js --require @babel/register --reporter mocha-junit-reporter --reporter-options mochaFile=reports/integration-results.xml",
|
|
39
39
|
"test:integration-watch": "BABEL_ENV=test babel-node --extensions .ts --extensions .js ./node_modules/.bin/mocha './test/integration/*.[tj]s' --config mocharc.js --watch --require @babel/register",
|
|
40
40
|
"test:browser": "BABEL_ENV=test karma start karma.conf.local.js --log-level info",
|
|
41
41
|
"test:size": "bundlesize",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@types/json-patch": "0.0.30",
|
|
59
59
|
"axios": "^0.21.4",
|
|
60
|
-
"contentful-sdk-core": "^6.10.
|
|
60
|
+
"contentful-sdk-core": "^6.10.4",
|
|
61
61
|
"fast-copy": "^2.1.0",
|
|
62
62
|
"lodash.isplainobject": "^4.0.6",
|
|
63
63
|
"type-fest": "^2.5.3"
|
|
@@ -113,10 +113,11 @@
|
|
|
113
113
|
"karma-mocha": "^2.0.1",
|
|
114
114
|
"karma-sourcemap-loader": "^0.3.7",
|
|
115
115
|
"karma-webpack": "^4.0.2",
|
|
116
|
-
"lint-staged": "^
|
|
116
|
+
"lint-staged": "^12.1.2",
|
|
117
117
|
"lodash": "^4.17.20",
|
|
118
118
|
"lodash-webpack-plugin": "^0.11.5",
|
|
119
119
|
"mocha": "^9.1.1",
|
|
120
|
+
"mocha-junit-reporter": "^2.0.2",
|
|
120
121
|
"nodemon": "^2.0.7",
|
|
121
122
|
"nyc": "^15.1.0",
|
|
122
123
|
"prettier": "^2.0.5",
|