contentful-management 11.38.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 +1692 -2175
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +4222 -4668
- 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/concept-scheme.js +18 -0
- package/dist/es-modules/adapters/REST/endpoints/concept.js +21 -4
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/plain/plain-client.js +7 -1
- package/dist/typings/adapters/REST/endpoints/concept-scheme.d.ts +3 -0
- package/dist/typings/adapters/REST/endpoints/concept.d.ts +3 -0
- package/dist/typings/common-types.d.ts +36 -0
- package/dist/typings/entities/bulk-action.d.ts +1 -1
- package/dist/typings/entities/resource-type.d.ts +1 -1
- package/dist/typings/plain/entities/concept-scheme.d.ts +48 -0
- package/dist/typings/plain/entities/concept.d.ts +48 -0
- 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
|
@@ -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 {};
|