contentful 9.2.5 → 9.2.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.browser.js +474 -120
- package/dist/contentful.browser.js.map +1 -1
- package/dist/contentful.browser.min.js +3 -3
- package/dist/contentful.node.js +468 -117
- package/dist/contentful.node.js.map +1 -1
- package/dist/contentful.node.min.js +3 -3
- package/dist/es-modules/contentful.js +4 -16
- package/dist/es-modules/create-contentful-api.js +15 -56
- package/dist/es-modules/create-global-options.js +0 -1
- package/dist/es-modules/entities/asset-key.js +0 -4
- package/dist/es-modules/entities/asset.js +1 -6
- package/dist/es-modules/entities/content-type.js +1 -6
- package/dist/es-modules/entities/entry.js +1 -10
- package/dist/es-modules/entities/index.js +0 -10
- package/dist/es-modules/entities/locale.js +1 -6
- package/dist/es-modules/entities/space.js +0 -2
- package/dist/es-modules/entities/tag.js +1 -6
- package/dist/es-modules/mixins/stringify-safe.js +0 -3
- package/dist/es-modules/paged-sync.js +7 -35
- package/dist/es-modules/utils/normalize-select.js +12 -13
- package/dist/es-modules/utils/validate-timestamp.js +0 -7
- package/package.json +1 -1
|
@@ -4,23 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createClient = createClient;
|
|
7
|
-
|
|
8
7
|
var _axios = _interopRequireDefault(require("axios"));
|
|
9
|
-
|
|
10
8
|
var _contentfulSdkCore = require("contentful-sdk-core");
|
|
11
|
-
|
|
12
9
|
var _createContentfulApi = _interopRequireDefault(require("./create-contentful-api"));
|
|
13
|
-
|
|
14
10
|
var _createGlobalOptions = _interopRequireDefault(require("./create-global-options"));
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
|
|
22
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
15
|
/**
|
|
25
16
|
* Create a client instance
|
|
26
17
|
* @func
|
|
@@ -54,25 +45,22 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
54
45
|
* space: 'mySpaceId'
|
|
55
46
|
* })
|
|
56
47
|
*/
|
|
48
|
+
|
|
57
49
|
function createClient(params) {
|
|
58
50
|
if (!params.accessToken) {
|
|
59
51
|
throw new TypeError('Expected parameter accessToken');
|
|
60
52
|
}
|
|
61
|
-
|
|
62
53
|
if (!params.space) {
|
|
63
54
|
throw new TypeError('Expected parameter space');
|
|
64
55
|
}
|
|
65
|
-
|
|
66
56
|
const defaultConfig = {
|
|
67
57
|
resolveLinks: true,
|
|
68
58
|
removeUnresolved: false,
|
|
69
59
|
defaultHostname: 'cdn.contentful.com',
|
|
70
60
|
environment: 'master'
|
|
71
61
|
};
|
|
72
|
-
|
|
73
62
|
const config = _objectSpread(_objectSpread({}, defaultConfig), params);
|
|
74
|
-
|
|
75
|
-
const userAgentHeader = (0, _contentfulSdkCore.getUserAgentHeader)(`contentful.js/${"9.2.5"}`, config.application, config.integration);
|
|
63
|
+
const userAgentHeader = (0, _contentfulSdkCore.getUserAgentHeader)(`contentful.js/${"9.2.6"}`, config.application, config.integration);
|
|
76
64
|
config.headers = _objectSpread(_objectSpread({}, config.headers), {}, {
|
|
77
65
|
'Content-Type': 'application/vnd.contentful.delivery.v1+json',
|
|
78
66
|
'X-Contentful-User-Agent': userAgentHeader
|
|
@@ -84,8 +72,8 @@ function createClient(params) {
|
|
|
84
72
|
removeUnresolved: config.removeUnresolved,
|
|
85
73
|
spaceBaseUrl: http.defaults.baseURL,
|
|
86
74
|
environmentBaseUrl: `${http.defaults.baseURL}environments/${config.environment}`
|
|
87
|
-
});
|
|
88
|
-
|
|
75
|
+
});
|
|
76
|
+
// Append environment to baseURL
|
|
89
77
|
http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
|
|
90
78
|
return (0, _createContentfulApi.default)({
|
|
91
79
|
http,
|
|
@@ -4,26 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createContentfulApi;
|
|
7
|
-
|
|
8
7
|
var _contentfulSdkCore = require("contentful-sdk-core");
|
|
9
|
-
|
|
10
8
|
var _entities = _interopRequireDefault(require("./entities"));
|
|
11
|
-
|
|
12
9
|
var _pagedSync = _interopRequireDefault(require("./paged-sync"));
|
|
13
|
-
|
|
14
10
|
var _normalizeSelect = _interopRequireDefault(require("./utils/normalize-select"));
|
|
15
|
-
|
|
16
11
|
var _validateTimestamp = _interopRequireDefault(require("./utils/validate-timestamp"));
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
-
|
|
22
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
-
|
|
24
15
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
-
|
|
26
16
|
const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
17
|
+
|
|
27
18
|
/**
|
|
28
19
|
* Creates API object with methods to access functionality from Contentful's
|
|
29
20
|
* Delivery API
|
|
@@ -34,7 +25,6 @@ const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
|
34
25
|
* @prop {Function} getGlobalOptions - Link resolver preconfigured with global setting
|
|
35
26
|
* @return {ClientAPI}
|
|
36
27
|
*/
|
|
37
|
-
|
|
38
28
|
function createContentfulApi(_ref) {
|
|
39
29
|
let {
|
|
40
30
|
http,
|
|
@@ -65,7 +55,6 @@ function createContentfulApi(_ref) {
|
|
|
65
55
|
const {
|
|
66
56
|
wrapLocaleCollection
|
|
67
57
|
} = _entities.default.locale;
|
|
68
|
-
|
|
69
58
|
const notFoundError = id => {
|
|
70
59
|
const error = new Error('The resource could not be found.');
|
|
71
60
|
error.sys = {
|
|
@@ -80,6 +69,7 @@ function createContentfulApi(_ref) {
|
|
|
80
69
|
};
|
|
81
70
|
return error;
|
|
82
71
|
};
|
|
72
|
+
|
|
83
73
|
/**
|
|
84
74
|
* Gets the Space which the client is currently configured to use
|
|
85
75
|
* @memberof ContentfulClientAPI
|
|
@@ -95,11 +85,8 @@ function createContentfulApi(_ref) {
|
|
|
95
85
|
* const space = await client.getSpace()
|
|
96
86
|
* console.log(space)
|
|
97
87
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
88
|
async function getSpace() {
|
|
101
89
|
switchToSpace(http);
|
|
102
|
-
|
|
103
90
|
try {
|
|
104
91
|
const response = await http.get('/');
|
|
105
92
|
return wrapSpace(response.data);
|
|
@@ -107,6 +94,7 @@ function createContentfulApi(_ref) {
|
|
|
107
94
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
108
95
|
}
|
|
109
96
|
}
|
|
97
|
+
|
|
110
98
|
/**
|
|
111
99
|
* Gets a Content Type
|
|
112
100
|
* @memberof ContentfulClientAPI
|
|
@@ -123,11 +111,8 @@ function createContentfulApi(_ref) {
|
|
|
123
111
|
* const contentType = await client.getContentType('<content_type_id>')
|
|
124
112
|
* console.log(contentType)
|
|
125
113
|
*/
|
|
126
|
-
|
|
127
|
-
|
|
128
114
|
async function getContentType(id) {
|
|
129
115
|
switchToEnvironment(http);
|
|
130
|
-
|
|
131
116
|
try {
|
|
132
117
|
const response = await http.get(`content_types/${id}`);
|
|
133
118
|
return wrapContentType(response.data);
|
|
@@ -135,6 +120,7 @@ function createContentfulApi(_ref) {
|
|
|
135
120
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
136
121
|
}
|
|
137
122
|
}
|
|
123
|
+
|
|
138
124
|
/**
|
|
139
125
|
* Gets a collection of Content Types
|
|
140
126
|
* @memberof ContentfulClientAPI
|
|
@@ -151,12 +137,9 @@ function createContentfulApi(_ref) {
|
|
|
151
137
|
* const response = await client.getContentTypes()
|
|
152
138
|
* console.log(response.items)
|
|
153
139
|
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
140
|
async function getContentTypes() {
|
|
157
141
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
158
142
|
switchToEnvironment(http);
|
|
159
|
-
|
|
160
143
|
try {
|
|
161
144
|
const response = await http.get('content_types', (0, _contentfulSdkCore.createRequestConfig)({
|
|
162
145
|
query: query
|
|
@@ -166,6 +149,7 @@ function createContentfulApi(_ref) {
|
|
|
166
149
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
167
150
|
}
|
|
168
151
|
}
|
|
152
|
+
|
|
169
153
|
/**
|
|
170
154
|
* Gets an Entry
|
|
171
155
|
* @memberof ContentfulClientAPI
|
|
@@ -183,20 +167,15 @@ function createContentfulApi(_ref) {
|
|
|
183
167
|
* const entry = await client.getEntry('<entry_id>')
|
|
184
168
|
* console.log(entry)
|
|
185
169
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
170
|
async function getEntry(id) {
|
|
189
171
|
let query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
190
|
-
|
|
191
172
|
if (!id) {
|
|
192
173
|
throw notFoundError(id);
|
|
193
174
|
}
|
|
194
|
-
|
|
195
175
|
try {
|
|
196
176
|
const response = await this.getEntries(_objectSpread({
|
|
197
177
|
'sys.id': id
|
|
198
178
|
}, query));
|
|
199
|
-
|
|
200
179
|
if (response.items.length > 0) {
|
|
201
180
|
return wrapEntry(response.items[0]);
|
|
202
181
|
} else {
|
|
@@ -206,6 +185,7 @@ function createContentfulApi(_ref) {
|
|
|
206
185
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
207
186
|
}
|
|
208
187
|
}
|
|
188
|
+
|
|
209
189
|
/**
|
|
210
190
|
* Gets a collection of Entries
|
|
211
191
|
* @memberof ContentfulClientAPI
|
|
@@ -222,8 +202,6 @@ function createContentfulApi(_ref) {
|
|
|
222
202
|
* const response = await client.getEntries()
|
|
223
203
|
* console.log(response.items)
|
|
224
204
|
*/
|
|
225
|
-
|
|
226
|
-
|
|
227
205
|
async function getEntries() {
|
|
228
206
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
229
207
|
switchToEnvironment(http);
|
|
@@ -232,7 +210,6 @@ function createContentfulApi(_ref) {
|
|
|
232
210
|
removeUnresolved
|
|
233
211
|
} = getGlobalOptions(query);
|
|
234
212
|
query = (0, _normalizeSelect.default)(query);
|
|
235
|
-
|
|
236
213
|
try {
|
|
237
214
|
const response = await http.get('entries', (0, _contentfulSdkCore.createRequestConfig)({
|
|
238
215
|
query: query
|
|
@@ -262,13 +239,10 @@ function createContentfulApi(_ref) {
|
|
|
262
239
|
* const asset = await client.getAsset('<asset_id>')
|
|
263
240
|
* console.log(asset)
|
|
264
241
|
*/
|
|
265
|
-
|
|
266
|
-
|
|
267
242
|
async function getAsset(id) {
|
|
268
243
|
let query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
269
244
|
switchToEnvironment(http);
|
|
270
245
|
query = (0, _normalizeSelect.default)(query);
|
|
271
|
-
|
|
272
246
|
try {
|
|
273
247
|
const response = await http.get(`assets/${id}`, (0, _contentfulSdkCore.createRequestConfig)({
|
|
274
248
|
query: query
|
|
@@ -278,6 +252,7 @@ function createContentfulApi(_ref) {
|
|
|
278
252
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
279
253
|
}
|
|
280
254
|
}
|
|
255
|
+
|
|
281
256
|
/**
|
|
282
257
|
* Gets a collection of Assets
|
|
283
258
|
* @memberof ContentfulClientAPI
|
|
@@ -294,13 +269,10 @@ function createContentfulApi(_ref) {
|
|
|
294
269
|
* const response = await client.getAssets()
|
|
295
270
|
* console.log(response.items)
|
|
296
271
|
*/
|
|
297
|
-
|
|
298
|
-
|
|
299
272
|
async function getAssets() {
|
|
300
273
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
301
274
|
switchToEnvironment(http);
|
|
302
275
|
query = (0, _normalizeSelect.default)(query);
|
|
303
|
-
|
|
304
276
|
try {
|
|
305
277
|
const response = await http.get('assets', (0, _contentfulSdkCore.createRequestConfig)({
|
|
306
278
|
query: query
|
|
@@ -310,6 +282,7 @@ function createContentfulApi(_ref) {
|
|
|
310
282
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
311
283
|
}
|
|
312
284
|
}
|
|
285
|
+
|
|
313
286
|
/**
|
|
314
287
|
* Gets a Tag
|
|
315
288
|
* @memberof ContentfulClientAPI
|
|
@@ -326,11 +299,8 @@ function createContentfulApi(_ref) {
|
|
|
326
299
|
* const tag = await client.getTag('<asset_id>')
|
|
327
300
|
* console.log(tag)
|
|
328
301
|
*/
|
|
329
|
-
|
|
330
|
-
|
|
331
302
|
async function getTag(id) {
|
|
332
303
|
switchToEnvironment(http);
|
|
333
|
-
|
|
334
304
|
try {
|
|
335
305
|
const response = await http.get(`tags/${id}`);
|
|
336
306
|
return wrapTag(response.data);
|
|
@@ -338,6 +308,7 @@ function createContentfulApi(_ref) {
|
|
|
338
308
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
339
309
|
}
|
|
340
310
|
}
|
|
311
|
+
|
|
341
312
|
/**
|
|
342
313
|
* Gets a collection of Tags
|
|
343
314
|
* @memberof ContentfulClientAPI
|
|
@@ -354,13 +325,10 @@ function createContentfulApi(_ref) {
|
|
|
354
325
|
* const response = await client.getTags()
|
|
355
326
|
* console.log(response.items)
|
|
356
327
|
*/
|
|
357
|
-
|
|
358
|
-
|
|
359
328
|
async function getTags() {
|
|
360
329
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
361
330
|
switchToEnvironment(http);
|
|
362
331
|
query = (0, _normalizeSelect.default)(query);
|
|
363
|
-
|
|
364
332
|
try {
|
|
365
333
|
const response = await http.get('tags', (0, _contentfulSdkCore.createRequestConfig)({
|
|
366
334
|
query: query
|
|
@@ -370,6 +338,7 @@ function createContentfulApi(_ref) {
|
|
|
370
338
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
371
339
|
}
|
|
372
340
|
}
|
|
341
|
+
|
|
373
342
|
/**
|
|
374
343
|
* Creates an asset key for signing asset URLs (Embargoed Assets)
|
|
375
344
|
* @memberof ContentfulClientAPI
|
|
@@ -386,11 +355,8 @@ function createContentfulApi(_ref) {
|
|
|
386
355
|
* const assetKey = await client.getAssetKey(<UNIX timestamp>)
|
|
387
356
|
* console.log(assetKey)
|
|
388
357
|
*/
|
|
389
|
-
|
|
390
|
-
|
|
391
358
|
async function createAssetKey(expiresAt) {
|
|
392
359
|
switchToEnvironment(http);
|
|
393
|
-
|
|
394
360
|
try {
|
|
395
361
|
const now = Math.floor(Date.now() / 1000);
|
|
396
362
|
const currentMaxLifetime = now + ASSET_KEY_MAX_LIFETIME;
|
|
@@ -407,6 +373,7 @@ function createContentfulApi(_ref) {
|
|
|
407
373
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
408
374
|
}
|
|
409
375
|
}
|
|
376
|
+
|
|
410
377
|
/**
|
|
411
378
|
* Gets a collection of Locale
|
|
412
379
|
* @memberof ContentfulClientAPI
|
|
@@ -423,12 +390,9 @@ function createContentfulApi(_ref) {
|
|
|
423
390
|
* const response = await client.getLocales()
|
|
424
391
|
* console.log(response.items)
|
|
425
392
|
*/
|
|
426
|
-
|
|
427
|
-
|
|
428
393
|
async function getLocales() {
|
|
429
394
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
430
395
|
switchToEnvironment(http);
|
|
431
|
-
|
|
432
396
|
try {
|
|
433
397
|
const response = await http.get('locales', (0, _contentfulSdkCore.createRequestConfig)({
|
|
434
398
|
query: query
|
|
@@ -438,6 +402,7 @@ function createContentfulApi(_ref) {
|
|
|
438
402
|
(0, _contentfulSdkCore.errorHandler)(error);
|
|
439
403
|
}
|
|
440
404
|
}
|
|
405
|
+
|
|
441
406
|
/**
|
|
442
407
|
* Synchronizes either all the content or only new content since last sync
|
|
443
408
|
* See <a href="https://www.contentful.com/developers/docs/concepts/sync/">Synchronization</a> for more information.
|
|
@@ -471,8 +436,6 @@ function createContentfulApi(_ref) {
|
|
|
471
436
|
* nextSyncToken: response.nextSyncToken
|
|
472
437
|
* })
|
|
473
438
|
*/
|
|
474
|
-
|
|
475
|
-
|
|
476
439
|
async function sync() {
|
|
477
440
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
478
441
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
@@ -488,6 +451,7 @@ function createContentfulApi(_ref) {
|
|
|
488
451
|
removeUnresolved
|
|
489
452
|
}, options));
|
|
490
453
|
}
|
|
454
|
+
|
|
491
455
|
/**
|
|
492
456
|
* Parse raw json data into collection of entry objects.Links will be resolved also
|
|
493
457
|
* @memberof ContentfulClientAPI
|
|
@@ -518,8 +482,6 @@ function createContentfulApi(_ref) {
|
|
|
518
482
|
* let parsedData = client.parseEntries(data);
|
|
519
483
|
* console.log( parsedData.items[0].fields.foo ); // foo
|
|
520
484
|
*/
|
|
521
|
-
|
|
522
|
-
|
|
523
485
|
function parseEntries(data) {
|
|
524
486
|
const {
|
|
525
487
|
resolveLinks,
|
|
@@ -530,23 +492,20 @@ function createContentfulApi(_ref) {
|
|
|
530
492
|
removeUnresolved
|
|
531
493
|
});
|
|
532
494
|
}
|
|
495
|
+
|
|
533
496
|
/*
|
|
534
497
|
* Switches BaseURL to use /environments path
|
|
535
498
|
* */
|
|
536
|
-
|
|
537
|
-
|
|
538
499
|
function switchToEnvironment(http) {
|
|
539
500
|
http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
|
|
540
501
|
}
|
|
502
|
+
|
|
541
503
|
/*
|
|
542
504
|
* Switches BaseURL to use /spaces path
|
|
543
505
|
* */
|
|
544
|
-
|
|
545
|
-
|
|
546
506
|
function switchToSpace(http) {
|
|
547
507
|
http.defaults.baseURL = getGlobalOptions().spaceBaseUrl;
|
|
548
508
|
}
|
|
549
|
-
|
|
550
509
|
return {
|
|
551
510
|
getSpace,
|
|
552
511
|
getContentType,
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = createGlobalOptions;
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Link resolution can be set globally, or it can be turned off for the methods
|
|
10
9
|
* which make use of it. The local setting always overrides the global setting.
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.wrapAssetKey = wrapAssetKey;
|
|
7
|
-
|
|
8
7
|
var _fastCopy = _interopRequireDefault(require("fast-copy"));
|
|
9
|
-
|
|
10
8
|
var _contentfulSdkCore = require("contentful-sdk-core");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
/**
|
|
15
11
|
* @memberof Entities
|
|
16
12
|
* @typedef AssetKey
|
|
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.wrapAsset = wrapAsset;
|
|
7
7
|
exports.wrapAssetCollection = wrapAssetCollection;
|
|
8
|
-
|
|
9
8
|
var _fastCopy = _interopRequireDefault(require("fast-copy"));
|
|
10
|
-
|
|
11
9
|
var _contentfulSdkCore = require("contentful-sdk-core");
|
|
12
|
-
|
|
13
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* @memberof Entities
|
|
17
13
|
* @typedef Asset
|
|
@@ -36,6 +32,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
36
32
|
function wrapAsset(data) {
|
|
37
33
|
return (0, _contentfulSdkCore.freezeSys)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
38
34
|
}
|
|
35
|
+
|
|
39
36
|
/**
|
|
40
37
|
* @memberof Entities
|
|
41
38
|
* @typedef AssetCollection
|
|
@@ -51,8 +48,6 @@ function wrapAsset(data) {
|
|
|
51
48
|
* @param {Object} data - Raw asset collection data
|
|
52
49
|
* @return {AssetCollection} Wrapped asset collection data
|
|
53
50
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
51
|
function wrapAssetCollection(data) {
|
|
57
52
|
return (0, _contentfulSdkCore.freezeSys)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
58
53
|
}
|
|
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.wrapContentType = wrapContentType;
|
|
7
7
|
exports.wrapContentTypeCollection = wrapContentTypeCollection;
|
|
8
|
-
|
|
9
8
|
var _fastCopy = _interopRequireDefault(require("fast-copy"));
|
|
10
|
-
|
|
11
9
|
var _contentfulSdkCore = require("contentful-sdk-core");
|
|
12
|
-
|
|
13
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* @memberof Entities
|
|
17
13
|
* @typedef ContentType
|
|
@@ -31,6 +27,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
31
27
|
function wrapContentType(data) {
|
|
32
28
|
return (0, _contentfulSdkCore.freezeSys)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
33
29
|
}
|
|
30
|
+
|
|
34
31
|
/**
|
|
35
32
|
* @memberof Entities
|
|
36
33
|
* @typedef ContentTypeCollection
|
|
@@ -46,8 +43,6 @@ function wrapContentType(data) {
|
|
|
46
43
|
* @param {Object} data - Raw content type collection data
|
|
47
44
|
* @return {ContentTypeCollection} Wrapped content type collection data
|
|
48
45
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
46
|
function wrapContentTypeCollection(data) {
|
|
52
47
|
return (0, _contentfulSdkCore.freezeSys)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
53
48
|
}
|
|
@@ -5,17 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.wrapEntry = wrapEntry;
|
|
7
7
|
exports.wrapEntryCollection = wrapEntryCollection;
|
|
8
|
-
|
|
9
8
|
var _fastCopy = _interopRequireDefault(require("fast-copy"));
|
|
10
|
-
|
|
11
9
|
var _contentfulSdkCore = require("contentful-sdk-core");
|
|
12
|
-
|
|
13
10
|
var _stringifySafe = _interopRequireDefault(require("../mixins/stringify-safe"));
|
|
14
|
-
|
|
15
11
|
var _contentfulResolveResponse = _interopRequireDefault(require("contentful-resolve-response"));
|
|
16
|
-
|
|
17
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
13
|
/**
|
|
20
14
|
* Types of fields found in an Entry
|
|
21
15
|
* @namespace EntryFields
|
|
@@ -89,6 +83,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
89
83
|
function wrapEntry(data) {
|
|
90
84
|
return (0, _contentfulSdkCore.freezeSys)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
91
85
|
}
|
|
86
|
+
|
|
92
87
|
/**
|
|
93
88
|
* @memberof Entities
|
|
94
89
|
* @typedef EntryCollection
|
|
@@ -109,21 +104,17 @@ function wrapEntry(data) {
|
|
|
109
104
|
* @param {Object} options - wrapper options
|
|
110
105
|
* @return {EntryCollection} Wrapped entry collection data
|
|
111
106
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
107
|
function wrapEntryCollection(data, _ref) {
|
|
115
108
|
let {
|
|
116
109
|
resolveLinks,
|
|
117
110
|
removeUnresolved
|
|
118
111
|
} = _ref;
|
|
119
112
|
const wrappedData = (0, _stringifySafe.default)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
120
|
-
|
|
121
113
|
if (resolveLinks) {
|
|
122
114
|
wrappedData.items = (0, _contentfulResolveResponse.default)(wrappedData, {
|
|
123
115
|
removeUnresolved,
|
|
124
116
|
itemEntryPoints: ['fields']
|
|
125
117
|
});
|
|
126
118
|
}
|
|
127
|
-
|
|
128
119
|
return (0, _contentfulSdkCore.freezeSys)(wrappedData);
|
|
129
120
|
}
|
|
@@ -4,25 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var space = _interopRequireWildcard(require("./space"));
|
|
9
|
-
|
|
10
8
|
var entry = _interopRequireWildcard(require("./entry"));
|
|
11
|
-
|
|
12
9
|
var asset = _interopRequireWildcard(require("./asset"));
|
|
13
|
-
|
|
14
10
|
var assetKey = _interopRequireWildcard(require("./asset-key"));
|
|
15
|
-
|
|
16
11
|
var contentType = _interopRequireWildcard(require("./content-type"));
|
|
17
|
-
|
|
18
12
|
var locale = _interopRequireWildcard(require("./locale"));
|
|
19
|
-
|
|
20
13
|
var tag = _interopRequireWildcard(require("./tag"));
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
16
|
var _default = {
|
|
27
17
|
space,
|
|
28
18
|
entry,
|
|
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.wrapLocale = wrapLocale;
|
|
7
7
|
exports.wrapLocaleCollection = wrapLocaleCollection;
|
|
8
|
-
|
|
9
8
|
var _fastCopy = _interopRequireDefault(require("fast-copy"));
|
|
10
|
-
|
|
11
9
|
var _contentfulSdkCore = require("contentful-sdk-core");
|
|
12
|
-
|
|
13
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* @memberof Entities
|
|
17
13
|
* @typedef Locale
|
|
@@ -32,6 +28,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
32
28
|
function wrapLocale(data) {
|
|
33
29
|
return (0, _contentfulSdkCore.freezeSys)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
34
30
|
}
|
|
31
|
+
|
|
35
32
|
/**
|
|
36
33
|
* @memberof Entities
|
|
37
34
|
* @typedef LocaleCollection
|
|
@@ -47,8 +44,6 @@ function wrapLocale(data) {
|
|
|
47
44
|
* @param {Object} data - Raw locale collection data
|
|
48
45
|
* @return {LocaleCollection} Wrapped locale collection data
|
|
49
46
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
47
|
function wrapLocaleCollection(data) {
|
|
53
48
|
return (0, _contentfulSdkCore.freezeSys)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
54
49
|
}
|
|
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.wrapTag = wrapTag;
|
|
7
7
|
exports.wrapTagCollection = wrapTagCollection;
|
|
8
|
-
|
|
9
8
|
var _fastCopy = _interopRequireDefault(require("fast-copy"));
|
|
10
|
-
|
|
11
9
|
var _contentfulSdkCore = require("contentful-sdk-core");
|
|
12
|
-
|
|
13
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* @memberof Entities
|
|
17
13
|
* @typedef Tag
|
|
@@ -28,6 +24,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
28
24
|
function wrapTag(data) {
|
|
29
25
|
return (0, _contentfulSdkCore.freezeSys)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
30
26
|
}
|
|
27
|
+
|
|
31
28
|
/**
|
|
32
29
|
* @memberof Entities
|
|
33
30
|
* @typedef TagCollection
|
|
@@ -43,8 +40,6 @@ function wrapTag(data) {
|
|
|
43
40
|
* @param {Object} data - Raw tag collection data
|
|
44
41
|
* @return {TagCollection} Wrapped tag collection data
|
|
45
42
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
43
|
function wrapTagCollection(data) {
|
|
49
44
|
return (0, _contentfulSdkCore.freezeSys)((0, _contentfulSdkCore.toPlainObject)((0, _fastCopy.default)(data)));
|
|
50
45
|
}
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = mixinStringifySafe;
|
|
7
|
-
|
|
8
7
|
var _jsonStringifySafe = _interopRequireDefault(require("json-stringify-safe"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
function mixinStringifySafe(data) {
|
|
13
10
|
return Object.defineProperty(data, 'stringifySafe', {
|
|
14
11
|
enumerable: false,
|