@se-studio/contentful-rest-api 1.0.38 → 1.0.39
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/index.d.ts +4 -2
- package/dist/index.js +23 -19
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -59,8 +59,9 @@ type BaseTemplateSkeleton = EntrySkeletonType<BaseTemplateFields, 'template'>;
|
|
|
59
59
|
|
|
60
60
|
interface BaseArticleTypeFields {
|
|
61
61
|
name: EntryFieldTypes.Symbol;
|
|
62
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
62
63
|
slug: EntryFieldTypes.Symbol;
|
|
63
|
-
|
|
64
|
+
indexPageTitle: EntryFieldTypes.Symbol;
|
|
64
65
|
indexPageDescription: EntryFieldTypes.Symbol;
|
|
65
66
|
featuredImage: EntryFieldTypes.AssetLink;
|
|
66
67
|
menu?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton>;
|
|
@@ -321,8 +322,9 @@ type BaseNavigationSkeleton = EntrySkeletonType<BaseNavigationFields, 'navigatio
|
|
|
321
322
|
|
|
322
323
|
interface BaseCustomTypeFields {
|
|
323
324
|
name: EntryFieldTypes.Symbol;
|
|
325
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
324
326
|
slug: EntryFieldTypes.Symbol;
|
|
325
|
-
|
|
327
|
+
indexPageTitle: EntryFieldTypes.Symbol;
|
|
326
328
|
indexPageDescription: EntryFieldTypes.Symbol;
|
|
327
329
|
featuredImage: EntryFieldTypes.AssetLink;
|
|
328
330
|
menu?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton>;
|
package/dist/index.js
CHANGED
|
@@ -1175,13 +1175,6 @@ async function fetchSingleEntity(context, config, fetchConfig, options) {
|
|
|
1175
1175
|
},
|
|
1176
1176
|
requestOptions
|
|
1177
1177
|
);
|
|
1178
|
-
if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
|
|
1179
|
-
console.log(`[Contentful Fetch] ${fetchConfig.contentType}`, {
|
|
1180
|
-
query: fetchConfig.query,
|
|
1181
|
-
cacheTags,
|
|
1182
|
-
total: response.total
|
|
1183
|
-
});
|
|
1184
|
-
}
|
|
1185
1178
|
const entry = response.items[0];
|
|
1186
1179
|
if (!entry || !entry.fields) {
|
|
1187
1180
|
return { data: null, errors: [] };
|
|
@@ -1981,11 +1974,13 @@ function baseArticleConverter(context, entry) {
|
|
|
1981
1974
|
collectIconsFromNavigation(finalMenu),
|
|
1982
1975
|
collectIconsFromNavigation(finalFooter)
|
|
1983
1976
|
);
|
|
1977
|
+
const articleTitle = makeContentfulTitle(title, sys.id);
|
|
1984
1978
|
const article = {
|
|
1985
1979
|
type: "Article",
|
|
1986
1980
|
id,
|
|
1987
1981
|
slug,
|
|
1988
|
-
|
|
1982
|
+
name: articleTitle,
|
|
1983
|
+
title: articleTitle,
|
|
1989
1984
|
description: makeContentfulDescription(description, sys.id),
|
|
1990
1985
|
featuredImage: lookupAsset(context, featuredImage),
|
|
1991
1986
|
articleType: articleTypeLink,
|
|
@@ -2037,11 +2032,11 @@ function baseArticleTypeLinkConverter(context, entry) {
|
|
|
2037
2032
|
`Invalid content type: expected "articleType", got "${sys.contentType.sys.id}"`
|
|
2038
2033
|
);
|
|
2039
2034
|
}
|
|
2040
|
-
const { name, featuredImage, slug, ...simpleFields } = fields;
|
|
2035
|
+
const { name, cmsLabel, featuredImage, slug, ...simpleFields } = fields;
|
|
2041
2036
|
return createInternalLink(
|
|
2042
2037
|
sys.id,
|
|
2043
2038
|
{
|
|
2044
|
-
cmsLabel
|
|
2039
|
+
cmsLabel,
|
|
2045
2040
|
title: name,
|
|
2046
2041
|
featuredImage,
|
|
2047
2042
|
slug,
|
|
@@ -2056,8 +2051,9 @@ function baseArticleTypeConverter(context, entry, customTypeEntry) {
|
|
|
2056
2051
|
const { sys, fields } = entry;
|
|
2057
2052
|
const { id } = sys;
|
|
2058
2053
|
const {
|
|
2059
|
-
|
|
2054
|
+
name,
|
|
2060
2055
|
indexPageDescription,
|
|
2056
|
+
indexPageTitle,
|
|
2061
2057
|
featuredImage,
|
|
2062
2058
|
menu: menuLink,
|
|
2063
2059
|
footer: footerLink,
|
|
@@ -2090,7 +2086,8 @@ function baseArticleTypeConverter(context, entry, customTypeEntry) {
|
|
|
2090
2086
|
type: "Article type",
|
|
2091
2087
|
id,
|
|
2092
2088
|
slug,
|
|
2093
|
-
|
|
2089
|
+
name,
|
|
2090
|
+
title: makeContentfulTitle(indexPageTitle, sys.id),
|
|
2094
2091
|
description: makeContentfulDescription(indexPageDescription, sys.id),
|
|
2095
2092
|
featuredImage: lookupAsset(context, featuredImage),
|
|
2096
2093
|
contents,
|
|
@@ -2218,8 +2215,9 @@ function baseCustomTypeConverter(context, entry) {
|
|
|
2218
2215
|
const { sys, fields } = entry;
|
|
2219
2216
|
const { id } = sys;
|
|
2220
2217
|
const {
|
|
2218
|
+
name,
|
|
2221
2219
|
slug,
|
|
2222
|
-
|
|
2220
|
+
indexPageTitle,
|
|
2223
2221
|
indexPageDescription,
|
|
2224
2222
|
featuredImage,
|
|
2225
2223
|
menu: menuLink,
|
|
@@ -2242,14 +2240,15 @@ function baseCustomTypeConverter(context, entry) {
|
|
|
2242
2240
|
collectIconsFromNavigation(menu),
|
|
2243
2241
|
collectIconsFromNavigation(footer)
|
|
2244
2242
|
);
|
|
2243
|
+
const title = makeContentfulTitle(indexPageTitle, sys.id);
|
|
2244
|
+
const description = makeContentfulDescription(indexPageDescription, sys.id);
|
|
2245
2245
|
const customType = {
|
|
2246
2246
|
type: "Custom type",
|
|
2247
2247
|
id,
|
|
2248
2248
|
slug,
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
description: makeContentfulDescription(indexPageDescription, sys.id),
|
|
2249
|
+
name,
|
|
2250
|
+
title,
|
|
2251
|
+
description,
|
|
2253
2252
|
featuredImage: lookupAsset(context, featuredImage),
|
|
2254
2253
|
contents,
|
|
2255
2254
|
icons,
|
|
@@ -2274,7 +2273,7 @@ function baseCustomTypeLinkConverter(context, entry) {
|
|
|
2274
2273
|
return createInternalLink(
|
|
2275
2274
|
id,
|
|
2276
2275
|
{
|
|
2277
|
-
cmsLabel: fields.
|
|
2276
|
+
cmsLabel: fields.cmsLabel,
|
|
2278
2277
|
title: fields.name,
|
|
2279
2278
|
featuredImage: fields.featuredImage,
|
|
2280
2279
|
backgroundColour: fields.backgroundColour,
|
|
@@ -2437,6 +2436,7 @@ function basePageConverter(context, entry) {
|
|
|
2437
2436
|
id,
|
|
2438
2437
|
isHomePage: slug === "index",
|
|
2439
2438
|
slug,
|
|
2439
|
+
name: title,
|
|
2440
2440
|
title: makeContentfulTitle(title, id),
|
|
2441
2441
|
description: makeContentfulDescription(description, id),
|
|
2442
2442
|
featuredImage: lookupAsset(context, featuredImage),
|
|
@@ -2586,6 +2586,7 @@ function basePersonConverter(context, entry, customTypeEntry) {
|
|
|
2586
2586
|
type: "Person",
|
|
2587
2587
|
id,
|
|
2588
2588
|
slug,
|
|
2589
|
+
name,
|
|
2589
2590
|
title: makeContentfulTitle(name, id),
|
|
2590
2591
|
description: description ?? `Description for ${id}`,
|
|
2591
2592
|
featuredImage: lookupAsset(context, media),
|
|
@@ -2605,7 +2606,7 @@ function basePersonConverter(context, entry, customTypeEntry) {
|
|
|
2605
2606
|
// src/converters/tag.ts
|
|
2606
2607
|
function baseTagLinkConverter(context, entry) {
|
|
2607
2608
|
const { sys, fields } = entry;
|
|
2608
|
-
const { name, ...simpleFields } = fields;
|
|
2609
|
+
const { name, cmsLabel, ...simpleFields } = fields;
|
|
2609
2610
|
if (sys.contentType.sys.id !== "tag") {
|
|
2610
2611
|
throw new Error(`Invalid content type: expected "tag", got "${sys.contentType.sys.id}"`);
|
|
2611
2612
|
}
|
|
@@ -2613,6 +2614,8 @@ function baseTagLinkConverter(context, entry) {
|
|
|
2613
2614
|
sys.id,
|
|
2614
2615
|
{
|
|
2615
2616
|
...simpleFields,
|
|
2617
|
+
cmsLabel,
|
|
2618
|
+
useName: false,
|
|
2616
2619
|
title: name
|
|
2617
2620
|
},
|
|
2618
2621
|
context,
|
|
@@ -2658,6 +2661,7 @@ function baseTagConverter(context, entry, customTypeEntry) {
|
|
|
2658
2661
|
type: "Tag",
|
|
2659
2662
|
id,
|
|
2660
2663
|
slug,
|
|
2664
|
+
name,
|
|
2661
2665
|
title: makeContentfulTitle(name, sys.id),
|
|
2662
2666
|
description: makeContentfulDescription(description, sys.id),
|
|
2663
2667
|
featuredImage: lookupAsset(context, featuredImage),
|