@se-studio/contentful-rest-api 1.0.39 → 1.0.40

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.js CHANGED
@@ -635,6 +635,9 @@ function addPositionMetadata(items) {
635
635
  };
636
636
  });
637
637
  }
638
+ function calculateContentCount(...contents) {
639
+ return contents.reduce((acc, content) => acc + content.length, 0);
640
+ }
638
641
 
639
642
  // src/converters/asset.ts
640
643
  function convertAssetToVisual(context, asset, options) {
@@ -1983,6 +1986,7 @@ function baseArticleConverter(context, entry) {
1983
1986
  title: articleTitle,
1984
1987
  description: makeContentfulDescription(description, sys.id),
1985
1988
  featuredImage: lookupAsset(context, featuredImage),
1989
+ contentCount: calculateContentCount(topContent, articleContent, bottomContent),
1986
1990
  articleType: articleTypeLink,
1987
1991
  tags: tags?.map((tag) => resolveLink(context, id, tag)),
1988
1992
  contents,
@@ -2090,6 +2094,7 @@ function baseArticleTypeConverter(context, entry, customTypeEntry) {
2090
2094
  title: makeContentfulTitle(indexPageTitle, sys.id),
2091
2095
  description: makeContentfulDescription(indexPageDescription, sys.id),
2092
2096
  featuredImage: lookupAsset(context, featuredImage),
2097
+ contentCount: 0,
2093
2098
  contents,
2094
2099
  icons,
2095
2100
  structuredData: [
@@ -2250,6 +2255,7 @@ function baseCustomTypeConverter(context, entry) {
2250
2255
  title,
2251
2256
  description,
2252
2257
  featuredImage: lookupAsset(context, featuredImage),
2258
+ contentCount: 0,
2253
2259
  contents,
2254
2260
  icons,
2255
2261
  structuredData: [
@@ -2441,6 +2447,7 @@ function basePageConverter(context, entry) {
2441
2447
  description: makeContentfulDescription(description, id),
2442
2448
  featuredImage: lookupAsset(context, featuredImage),
2443
2449
  tags: tags?.map((tag) => resolveLink(context, id, tag)),
2450
+ contentCount: calculateContentCount(topContent, pageContent, bottomContent),
2444
2451
  contents,
2445
2452
  icons,
2446
2453
  structuredData: structuredData?.map((link) => resolveSchema(context, id, link)).filter((item) => item !== null),
@@ -2593,6 +2600,7 @@ function basePersonConverter(context, entry, customTypeEntry) {
2593
2600
  // Person uses 'media' not 'featuredImage'
2594
2601
  href: context.urlCalculators.person(slug),
2595
2602
  bio: resolveRichTextDocument(context, id, bioField) ?? null,
2603
+ contentCount: calculateContentCount(personContent),
2596
2604
  contents,
2597
2605
  menu,
2598
2606
  footer,
@@ -2666,6 +2674,7 @@ function baseTagConverter(context, entry, customTypeEntry) {
2666
2674
  description: makeContentfulDescription(description, sys.id),
2667
2675
  featuredImage: lookupAsset(context, featuredImage),
2668
2676
  tagType: tagTypeName ?? null,
2677
+ contentCount: calculateContentCount(topContent),
2669
2678
  contents,
2670
2679
  icons,
2671
2680
  structuredData: structuredData?.map((link) => resolveSchema(context, id, link)).filter((item) => item !== null),