contentful 11.12.2 → 11.12.3
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.cjs
CHANGED
|
@@ -22098,7 +22098,7 @@ var stringify$2 = function stringify(object, prefix, generateArrayPrefix, commaR
|
|
|
22098
22098
|
}
|
|
22099
22099
|
if (obj === null) {
|
|
22100
22100
|
if (strictNullHandling) {
|
|
22101
|
-
return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
|
|
22101
|
+
return formatter(encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix);
|
|
22102
22102
|
}
|
|
22103
22103
|
obj = '';
|
|
22104
22104
|
}
|
|
@@ -22117,7 +22117,9 @@ var stringify$2 = function stringify(object, prefix, generateArrayPrefix, commaR
|
|
|
22117
22117
|
if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
|
|
22118
22118
|
// we need to join elements in
|
|
22119
22119
|
if (encodeValuesOnly && encoder) {
|
|
22120
|
-
obj = utils$1.maybeMap(obj,
|
|
22120
|
+
obj = utils$1.maybeMap(obj, function (v) {
|
|
22121
|
+
return v == null ? v : encoder(v);
|
|
22122
|
+
});
|
|
22121
22123
|
}
|
|
22122
22124
|
objKeys = [{
|
|
22123
22125
|
value: obj.length > 0 ? obj.join(',') || null : void undefined
|
|
@@ -22238,6 +22240,9 @@ var stringify_1 = function (object, opts) {
|
|
|
22238
22240
|
var sideChannel = getSideChannel();
|
|
22239
22241
|
for (var i = 0; i < objKeys.length; ++i) {
|
|
22240
22242
|
var key = objKeys[i];
|
|
22243
|
+
if (typeof key === 'undefined' || key === null) {
|
|
22244
|
+
continue;
|
|
22245
|
+
}
|
|
22241
22246
|
var value = obj[key];
|
|
22242
22247
|
if (options.skipNulls && value === null) {
|
|
22243
22248
|
continue;
|
|
@@ -22249,10 +22254,10 @@ var stringify_1 = function (object, opts) {
|
|
|
22249
22254
|
if (options.charsetSentinel) {
|
|
22250
22255
|
if (options.charset === 'iso-8859-1') {
|
|
22251
22256
|
// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
|
22252
|
-
prefix += 'utf8=%26%2310003%3B
|
|
22257
|
+
prefix += 'utf8=%26%2310003%3B' + options.delimiter;
|
|
22253
22258
|
} else {
|
|
22254
22259
|
// encodeURIComponent('✓')
|
|
22255
|
-
prefix += 'utf8=%E2%9C%93
|
|
22260
|
+
prefix += 'utf8=%E2%9C%93' + options.delimiter;
|
|
22256
22261
|
}
|
|
22257
22262
|
}
|
|
22258
22263
|
return joined.length > 0 ? prefix + joined : '';
|
|
@@ -22317,8 +22322,8 @@ var parseValues = function parseQueryStringValues(str, options) {
|
|
|
22317
22322
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
22318
22323
|
cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
22319
22324
|
var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
|
|
22320
|
-
var parts = cleanStr.split(options.delimiter, options.throwOnLimitExceeded ? limit + 1 : limit);
|
|
22321
|
-
if (options.throwOnLimitExceeded && parts.length > limit) {
|
|
22325
|
+
var parts = cleanStr.split(options.delimiter, options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit);
|
|
22326
|
+
if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
|
|
22322
22327
|
throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
|
|
22323
22328
|
}
|
|
22324
22329
|
var skipIndex = -1; // Keep track of where the utf8 sentinel was found
|
|
@@ -22425,8 +22430,13 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
|
|
22425
22430
|
}
|
|
22426
22431
|
return leaf;
|
|
22427
22432
|
};
|
|
22428
|
-
|
|
22429
|
-
|
|
22433
|
+
|
|
22434
|
+
// Split a key like "a[b][c[]]" into ['a', '[b]', '[c[]]'] while preserving
|
|
22435
|
+
// qs parse semantics for depth/prototype guards.
|
|
22436
|
+
var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
|
|
22437
|
+
var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, '[$1]') : originalKey;
|
|
22438
|
+
|
|
22439
|
+
// depth <= 0 keeps the whole key as one segment
|
|
22430
22440
|
if (options.depth <= 0) {
|
|
22431
22441
|
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
|
22432
22442
|
if (!options.allowPrototypes) {
|
|
@@ -22435,37 +22445,67 @@ var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
|
|
|
22435
22445
|
}
|
|
22436
22446
|
return [key];
|
|
22437
22447
|
}
|
|
22438
|
-
var
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
var
|
|
22442
|
-
var
|
|
22448
|
+
var segments = [];
|
|
22449
|
+
|
|
22450
|
+
// parent before the first '[' (may be empty if key starts with '[')
|
|
22451
|
+
var first = key.indexOf('[');
|
|
22452
|
+
var parent = first >= 0 ? key.slice(0, first) : key;
|
|
22443
22453
|
if (parent) {
|
|
22444
22454
|
if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
|
22445
22455
|
if (!options.allowPrototypes) {
|
|
22446
22456
|
return;
|
|
22447
22457
|
}
|
|
22448
22458
|
}
|
|
22449
|
-
|
|
22450
|
-
}
|
|
22451
|
-
var
|
|
22452
|
-
|
|
22453
|
-
|
|
22454
|
-
|
|
22455
|
-
|
|
22456
|
-
|
|
22457
|
-
|
|
22459
|
+
segments[segments.length] = parent;
|
|
22460
|
+
}
|
|
22461
|
+
var n = key.length;
|
|
22462
|
+
var open = first;
|
|
22463
|
+
var collected = 0;
|
|
22464
|
+
while (open >= 0 && collected < options.depth) {
|
|
22465
|
+
var level = 1;
|
|
22466
|
+
var i = open + 1;
|
|
22467
|
+
var close = -1;
|
|
22468
|
+
|
|
22469
|
+
// balance nested '[' and ']' inside this bracket group using a nesting level counter
|
|
22470
|
+
while (i < n && close < 0) {
|
|
22471
|
+
var cu = key.charCodeAt(i);
|
|
22472
|
+
if (cu === 0x5B) {
|
|
22473
|
+
// '['
|
|
22474
|
+
level += 1;
|
|
22475
|
+
} else if (cu === 0x5D) {
|
|
22476
|
+
// ']'
|
|
22477
|
+
level -= 1;
|
|
22478
|
+
if (level === 0) {
|
|
22479
|
+
close = i; // found matching close; loop will exit by condition
|
|
22480
|
+
}
|
|
22458
22481
|
}
|
|
22482
|
+
i += 1;
|
|
22459
22483
|
}
|
|
22460
|
-
|
|
22484
|
+
if (close < 0) {
|
|
22485
|
+
// Unterminated group: wrap the raw remainder in one bracket pair so it stays
|
|
22486
|
+
// a single literal segment (e.g. "[[]b" -> "[[]b]"); we do not infer missing ']'.
|
|
22487
|
+
segments[segments.length] = '[' + key.slice(open) + ']';
|
|
22488
|
+
return segments;
|
|
22489
|
+
}
|
|
22490
|
+
var seg = key.slice(open, close + 1);
|
|
22491
|
+
// prototype guard for the content of this group
|
|
22492
|
+
var content = seg.slice(1, -1);
|
|
22493
|
+
if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) {
|
|
22494
|
+
return;
|
|
22495
|
+
}
|
|
22496
|
+
segments[segments.length] = seg;
|
|
22497
|
+
collected += 1;
|
|
22498
|
+
|
|
22499
|
+
// find the next '[' after this balanced group
|
|
22500
|
+
open = key.indexOf('[', close + 1);
|
|
22461
22501
|
}
|
|
22462
|
-
if (
|
|
22502
|
+
if (open >= 0) {
|
|
22463
22503
|
if (options.strictDepth === true) {
|
|
22464
22504
|
throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
|
|
22465
22505
|
}
|
|
22466
|
-
|
|
22506
|
+
segments[segments.length] = '[' + key.slice(open) + ']';
|
|
22467
22507
|
}
|
|
22468
|
-
return
|
|
22508
|
+
return segments;
|
|
22469
22509
|
};
|
|
22470
22510
|
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
|
22471
22511
|
if (!givenKey) {
|
|
@@ -23937,7 +23977,9 @@ function checkEnableTimelinePreviewIsAllowed(host, timelinePreview) {
|
|
|
23937
23977
|
return false;
|
|
23938
23978
|
}
|
|
23939
23979
|
const isValidConfig = isValidTimelinePreviewConfig(timelinePreview);
|
|
23940
|
-
|
|
23980
|
+
// Show error if used outside of CPA.
|
|
23981
|
+
// Opt-out of the error if a custom domain is used and CPA could not be idenfified
|
|
23982
|
+
const isValidHost = typeof host === 'string' && (!host.includes('contentful') || host.startsWith('preview'));
|
|
23941
23983
|
if (isValidConfig && !isValidHost) {
|
|
23942
23984
|
throw new ValidationError('timelinePreview', `The 'timelinePreview' parameter can only be used with the CPA. Please set host to 'preview.contentful.com' or 'preview.eu.contentful.com' to enable Timeline Preview.
|
|
23943
23985
|
`);
|
|
@@ -54,7 +54,9 @@ function checkEnableTimelinePreviewIsAllowed(host, timelinePreview) {
|
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
56
|
const isValidConfig = isValidTimelinePreviewConfig(timelinePreview);
|
|
57
|
-
|
|
57
|
+
// Show error if used outside of CPA.
|
|
58
|
+
// Opt-out of the error if a custom domain is used and CPA could not be idenfified
|
|
59
|
+
const isValidHost = typeof host === 'string' && (!host.includes('contentful') || host.startsWith('preview'));
|
|
58
60
|
if (isValidConfig && !isValidHost) {
|
|
59
61
|
throw new ValidationError('timelinePreview', `The 'timelinePreview' parameter can only be used with the CPA. Please set host to 'preview.contentful.com' or 'preview.eu.contentful.com' to enable Timeline Preview.
|
|
60
62
|
`);
|