contentful-management 11.39.0 → 11.39.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/dist/contentful-management.browser.js +1958 -2488
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +4105 -4598
- package/dist/contentful-management.node.js.map +1 -1
- package/dist/contentful-management.node.min.js +1 -1
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/typings/entities/bulk-action.d.ts +1 -1
- package/dist/typings/entities/resource-type.d.ts +1 -1
- package/package.json +14 -30
- package/dist/es-modules/plain/plain-client-test.js +0 -227
- package/dist/typings/plain/plain-client-test.d.ts +0 -1
|
@@ -46,7 +46,7 @@ function createClient(params, opts = {}) {
|
|
|
46
46
|
const sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
47
47
|
const userAgent = getUserAgentHeader(
|
|
48
48
|
// @ts-expect-error
|
|
49
|
-
`${sdkMain}/${"11.39.
|
|
49
|
+
`${sdkMain}/${"11.39.1"}`, params.application, params.integration, params.feature);
|
|
50
50
|
const adapter = createAdapter(_objectSpread(_objectSpread({}, params), {}, {
|
|
51
51
|
userAgent
|
|
52
52
|
}));
|
|
@@ -20,7 +20,7 @@ export declare enum BulkActionStatus {
|
|
|
20
20
|
failed = "failed"
|
|
21
21
|
}
|
|
22
22
|
declare const STATUSES: BulkActionStatus[];
|
|
23
|
-
type BulkActionStatuses = typeof STATUSES[number];
|
|
23
|
+
type BulkActionStatuses = (typeof STATUSES)[number];
|
|
24
24
|
interface BulkActionFailedError {
|
|
25
25
|
sys: {
|
|
26
26
|
type: 'Error';
|
|
@@ -32,7 +32,7 @@ export type ResourceTypeProps = {
|
|
|
32
32
|
};
|
|
33
33
|
declare const publicResourceTypeFields: readonly ["name"];
|
|
34
34
|
type OptionalSysFields = 'createdAt' | 'createdBy' | 'updatedAt' | 'updatedBy' | 'appDefinition' | 'organization';
|
|
35
|
-
export type SpaceEnvResourceTypeProps = Pick<ResourceTypeProps, typeof publicResourceTypeFields[number]> & {
|
|
35
|
+
export type SpaceEnvResourceTypeProps = Pick<ResourceTypeProps, (typeof publicResourceTypeFields)[number]> & {
|
|
36
36
|
sys: Partial<Pick<ResourceTypeProps['sys'], OptionalSysFields>> & Omit<ResourceTypeProps['sys'], OptionalSysFields>;
|
|
37
37
|
};
|
|
38
38
|
export type UpsertResourceTypeProps = Omit<ResourceTypeProps, 'sys'>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-management",
|
|
3
|
-
"version": "11.39.
|
|
3
|
+
"version": "11.39.1",
|
|
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",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"lint": "eslint lib test --ext '.ts,.tsx,.js,.jsx'",
|
|
39
39
|
"pretest": "rimraf coverage && npm run lint",
|
|
40
40
|
"test": "npm run test:cover-unit && npm run test:cover-integration && npm run test:size",
|
|
41
|
-
"test:cover-unit": "
|
|
42
|
-
"test:cover-integration": "
|
|
43
|
-
"test:unit": "
|
|
44
|
-
"test:unit-watch": "
|
|
45
|
-
"test:integration": "
|
|
46
|
-
"test:integration-watch": "
|
|
47
|
-
"test:browser": "
|
|
41
|
+
"test:cover-unit": "npm run test:unit -- --coverage",
|
|
42
|
+
"test:cover-integration": "npm run test:integration -- --coverage",
|
|
43
|
+
"test:unit": "npx vitest --project unit --run",
|
|
44
|
+
"test:unit-watch": "npx vitest --project unit",
|
|
45
|
+
"test:integration": "npx vitest --project integration --run --no-file-parallelism",
|
|
46
|
+
"test:integration-watch": "npx vitest --project integration --no-file-parallelism",
|
|
47
|
+
"test:browser": "npx playwright install && npx vitest --project browser-unit --run && npx vitest --project browser-integration --run",
|
|
48
48
|
"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",
|
|
49
49
|
"test:size": "size-limit",
|
|
50
50
|
"test:prepush": "npm run build && npm run test:unit && npm run test:size",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@contentful/rich-text-types": "^16.6.1",
|
|
65
65
|
"axios": "^1.7.4",
|
|
66
|
-
"contentful-sdk-core": "^
|
|
66
|
+
"contentful-sdk-core": "^9.0.1",
|
|
67
67
|
"fast-copy": "^3.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
@@ -78,25 +78,19 @@
|
|
|
78
78
|
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
|
|
79
79
|
"@babel/preset-env": "^7.24.6",
|
|
80
80
|
"@babel/preset-typescript": "^7.24.7",
|
|
81
|
-
"@contentful/integration-test-utils": "^2.0.
|
|
81
|
+
"@contentful/integration-test-utils": "^2.0.1",
|
|
82
82
|
"@semantic-release/changelog": "^6.0.0",
|
|
83
83
|
"@size-limit/file": "^11.1.6",
|
|
84
|
-
"@types/chai": "^4.3.16",
|
|
85
|
-
"@types/chai-as-promised": "^7.1.4",
|
|
86
84
|
"@types/json-patch": "0.0.30",
|
|
87
85
|
"@types/lodash": "^4.14.168",
|
|
88
|
-
"@types/mocha": "^10.0.6",
|
|
89
86
|
"@types/node": "^20.12.13",
|
|
90
|
-
"@types/sinon": "17.0.3",
|
|
91
|
-
"@types/sinon-chai": "^3.2.9",
|
|
92
87
|
"@typescript-eslint/eslint-plugin": "^7.14.1",
|
|
93
88
|
"@typescript-eslint/parser": "^7.14.1",
|
|
89
|
+
"@vitest/browser": "^2.1.5",
|
|
90
|
+
"@vitest/coverage-v8": "^2.1.5",
|
|
94
91
|
"babel-loader": "^8.2.1",
|
|
95
92
|
"babel-plugin-inline-replace-variables": "^1.3.1",
|
|
96
93
|
"babel-plugin-lodash": "^3.3.4",
|
|
97
|
-
"babel-plugin-rewire-ts": "1.4.0",
|
|
98
|
-
"chai": "^4.2.0",
|
|
99
|
-
"chai-as-promised": "7.1.2",
|
|
100
94
|
"contentful-sdk-jsdoc": "3.1.0",
|
|
101
95
|
"cz-conventional-changelog": "^3.3.0",
|
|
102
96
|
"eslint": "^8.11.0",
|
|
@@ -110,29 +104,19 @@
|
|
|
110
104
|
"in-publish": "^2.0.1",
|
|
111
105
|
"json-patch": "^0.7.0",
|
|
112
106
|
"jsonwebtoken": "^9.0.2",
|
|
113
|
-
"karma": "^6.4.4",
|
|
114
|
-
"karma-chrome-launcher": "^3.1.0",
|
|
115
|
-
"karma-env-preprocessor": "^0.1.1",
|
|
116
|
-
"karma-firefox-launcher": "^2.1.1",
|
|
117
|
-
"karma-mocha": "^2.0.1",
|
|
118
|
-
"karma-sourcemap-loader": "^0.4.0",
|
|
119
|
-
"karma-webpack": "^5.0.0",
|
|
120
107
|
"lint-staged": "^15.2.5",
|
|
121
108
|
"lodash": "^4.17.20",
|
|
122
109
|
"lodash-webpack-plugin": "^0.11.5",
|
|
123
|
-
"mocha": "^10.4.0",
|
|
124
|
-
"mocha-junit-reporter": "^2.0.2",
|
|
125
110
|
"nodemon": "^3.1.2",
|
|
126
|
-
"
|
|
111
|
+
"playwright": "^1.49.0",
|
|
127
112
|
"prettier": "^2.6.0",
|
|
128
113
|
"rimraf": "^5.0.0",
|
|
129
114
|
"semantic-release": "^22.0.12",
|
|
130
|
-
"sinon": "^18.0.0",
|
|
131
|
-
"sinon-chai": "^3.7.0",
|
|
132
115
|
"size-limit": "^11.1.6",
|
|
133
116
|
"type-fest": "^4.18.3",
|
|
134
117
|
"typedoc": "^0.26.2",
|
|
135
118
|
"typescript": "^5.5.2",
|
|
119
|
+
"vitest": "^2.1.5",
|
|
136
120
|
"webpack": "^5.91.0",
|
|
137
121
|
"webpack-bundle-analyzer": "^4.9.0",
|
|
138
122
|
"webpack-cli": "^5.1.4"
|
|
@@ -1,227 +0,0 @@
|
|
|
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 chai, { expect } from 'chai';
|
|
7
|
-
import { describe } from 'mocha';
|
|
8
|
-
import Sinon from 'sinon';
|
|
9
|
-
import { createClient } from '../contentful-management';
|
|
10
|
-
import sinonChai from 'sinon-chai';
|
|
11
|
-
import { CommentNode } from '../entities/comment';
|
|
12
|
-
chai.should();
|
|
13
|
-
chai.use(sinonChai);
|
|
14
|
-
describe('Plain Client', () => {
|
|
15
|
-
const stub = Sinon.stub();
|
|
16
|
-
beforeEach(() => stub.reset());
|
|
17
|
-
const apiAdapter = {
|
|
18
|
-
makeRequest: args => {
|
|
19
|
-
return stub.returns(Promise.resolve())(args);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const plainClient = createClient({
|
|
23
|
-
apiAdapter
|
|
24
|
-
}, {
|
|
25
|
-
type: 'plain'
|
|
26
|
-
});
|
|
27
|
-
describe('Comment', () => {
|
|
28
|
-
describe('when body is plain text', () => {
|
|
29
|
-
const props = {
|
|
30
|
-
commentId: '123',
|
|
31
|
-
entryId: '123',
|
|
32
|
-
bodyFormat: 'plain-text'
|
|
33
|
-
};
|
|
34
|
-
const updateText = 'My new text';
|
|
35
|
-
it('should create a get object', async () => {
|
|
36
|
-
await plainClient.comment.get(props);
|
|
37
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
38
|
-
entityType: 'Comment',
|
|
39
|
-
action: 'get',
|
|
40
|
-
params: props,
|
|
41
|
-
payload: undefined,
|
|
42
|
-
headers: undefined
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
it('should create a getMany object', async () => {
|
|
46
|
-
await plainClient.comment.getMany(props);
|
|
47
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
48
|
-
entityType: 'Comment',
|
|
49
|
-
action: 'getMany',
|
|
50
|
-
params: props,
|
|
51
|
-
payload: undefined,
|
|
52
|
-
headers: undefined
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
it('should create a create object', async () => {
|
|
56
|
-
await plainClient.comment.create(props, {
|
|
57
|
-
body: updateText
|
|
58
|
-
});
|
|
59
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
60
|
-
entityType: 'Comment',
|
|
61
|
-
action: 'create',
|
|
62
|
-
params: props,
|
|
63
|
-
payload: {
|
|
64
|
-
body: updateText
|
|
65
|
-
},
|
|
66
|
-
headers: undefined
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
it('should create a update object', async () => {
|
|
70
|
-
await plainClient.comment.update(props, {
|
|
71
|
-
body: updateText,
|
|
72
|
-
sys: {
|
|
73
|
-
version: 2
|
|
74
|
-
},
|
|
75
|
-
status: 'active'
|
|
76
|
-
});
|
|
77
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
78
|
-
entityType: 'Comment',
|
|
79
|
-
action: 'update',
|
|
80
|
-
params: props,
|
|
81
|
-
payload: {
|
|
82
|
-
body: updateText
|
|
83
|
-
},
|
|
84
|
-
headers: undefined
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
it('should create a delete object', async () => {
|
|
88
|
-
await plainClient.comment.delete(_objectSpread(_objectSpread({}, props), {}, {
|
|
89
|
-
version: 2
|
|
90
|
-
}));
|
|
91
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
92
|
-
entityType: 'Comment',
|
|
93
|
-
action: 'delete',
|
|
94
|
-
params: props,
|
|
95
|
-
payload: undefined,
|
|
96
|
-
headers: undefined
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
describe('when body is rich text', () => {
|
|
101
|
-
const richTextBody = {
|
|
102
|
-
data: {},
|
|
103
|
-
nodeType: CommentNode.Document,
|
|
104
|
-
content: [{
|
|
105
|
-
nodeType: CommentNode.Paragraph,
|
|
106
|
-
data: {},
|
|
107
|
-
content: [{
|
|
108
|
-
nodeType: 'text',
|
|
109
|
-
marks: [],
|
|
110
|
-
data: {},
|
|
111
|
-
value: 'My comment'
|
|
112
|
-
}, {
|
|
113
|
-
nodeType: CommentNode.Mention,
|
|
114
|
-
data: {
|
|
115
|
-
target: {
|
|
116
|
-
sys: {
|
|
117
|
-
type: 'Link',
|
|
118
|
-
id: '123',
|
|
119
|
-
linkType: 'User'
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
content: [{
|
|
124
|
-
nodeType: 'text',
|
|
125
|
-
marks: [],
|
|
126
|
-
data: {},
|
|
127
|
-
value: 'My user mention'
|
|
128
|
-
}]
|
|
129
|
-
}, {
|
|
130
|
-
nodeType: CommentNode.Mention,
|
|
131
|
-
data: {
|
|
132
|
-
target: {
|
|
133
|
-
sys: {
|
|
134
|
-
type: 'Link',
|
|
135
|
-
id: '456',
|
|
136
|
-
linkType: 'Team'
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
content: [{
|
|
141
|
-
nodeType: 'text',
|
|
142
|
-
marks: [],
|
|
143
|
-
data: {},
|
|
144
|
-
value: 'My team mention'
|
|
145
|
-
}]
|
|
146
|
-
}, {
|
|
147
|
-
data: {},
|
|
148
|
-
marks: [],
|
|
149
|
-
value: '.',
|
|
150
|
-
nodeType: 'text'
|
|
151
|
-
}]
|
|
152
|
-
}]
|
|
153
|
-
};
|
|
154
|
-
const props = {
|
|
155
|
-
commentId: '123',
|
|
156
|
-
entryId: '123',
|
|
157
|
-
bodyFormat: 'rich-text'
|
|
158
|
-
};
|
|
159
|
-
it('should create a get object', async () => {
|
|
160
|
-
await plainClient.comment.get(props);
|
|
161
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
162
|
-
entityType: 'Comment',
|
|
163
|
-
action: 'get',
|
|
164
|
-
params: props,
|
|
165
|
-
payload: undefined,
|
|
166
|
-
headers: undefined
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
it('should create a getMany object', async () => {
|
|
170
|
-
await plainClient.comment.getMany(props);
|
|
171
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
172
|
-
entityType: 'Comment',
|
|
173
|
-
action: 'getMany',
|
|
174
|
-
params: props,
|
|
175
|
-
payload: undefined,
|
|
176
|
-
headers: undefined
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
it('should create a create object', async () => {
|
|
180
|
-
await plainClient.comment.create(props, {
|
|
181
|
-
body: richTextBody
|
|
182
|
-
});
|
|
183
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
184
|
-
entityType: 'Comment',
|
|
185
|
-
action: 'create',
|
|
186
|
-
params: props,
|
|
187
|
-
payload: {
|
|
188
|
-
body: richTextBody,
|
|
189
|
-
status: 'active'
|
|
190
|
-
},
|
|
191
|
-
headers: undefined
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
it('should create a update object', async () => {
|
|
195
|
-
await plainClient.comment.update(props, {
|
|
196
|
-
body: richTextBody,
|
|
197
|
-
sys: {
|
|
198
|
-
version: 2
|
|
199
|
-
},
|
|
200
|
-
status: 'active'
|
|
201
|
-
});
|
|
202
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
203
|
-
entityType: 'Comment',
|
|
204
|
-
action: 'update',
|
|
205
|
-
params: props,
|
|
206
|
-
payload: {
|
|
207
|
-
body: richTextBody,
|
|
208
|
-
status: 'active'
|
|
209
|
-
},
|
|
210
|
-
headers: undefined
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
it('should create a delete object', async () => {
|
|
214
|
-
await plainClient.comment.delete(_objectSpread(_objectSpread({}, props), {}, {
|
|
215
|
-
version: 2
|
|
216
|
-
}));
|
|
217
|
-
expect(stub).to.have.been.calledWithMatch({
|
|
218
|
-
entityType: 'Comment',
|
|
219
|
-
action: 'delete',
|
|
220
|
-
params: props,
|
|
221
|
-
payload: undefined,
|
|
222
|
-
headers: undefined
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|