@se-studio/contentful-rest-api 0.0.0-next16-20260822103555
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/CHANGELOG.md +2036 -0
- package/README.md +764 -0
- package/dist/api/article-type.d.ts +37 -0
- package/dist/api/article-type.d.ts.map +1 -0
- package/dist/api/article-type.js +140 -0
- package/dist/api/article-type.js.map +1 -0
- package/dist/api/article.d.ts +32 -0
- package/dist/api/article.d.ts.map +1 -0
- package/dist/api/article.js +43 -0
- package/dist/api/article.js.map +1 -0
- package/dist/api/asset.d.ts +28 -0
- package/dist/api/asset.d.ts.map +1 -0
- package/dist/api/asset.js +56 -0
- package/dist/api/asset.js.map +1 -0
- package/dist/api/banner.d.ts +8 -0
- package/dist/api/banner.d.ts.map +1 -0
- package/dist/api/banner.js +96 -0
- package/dist/api/banner.js.map +1 -0
- package/dist/api/breadcrumb.d.ts +40 -0
- package/dist/api/breadcrumb.d.ts.map +1 -0
- package/dist/api/breadcrumb.js +60 -0
- package/dist/api/breadcrumb.js.map +1 -0
- package/dist/api/componentPreview.d.ts +59 -0
- package/dist/api/componentPreview.d.ts.map +1 -0
- package/dist/api/componentPreview.js +88 -0
- package/dist/api/componentPreview.js.map +1 -0
- package/dist/api/context.d.ts +24 -0
- package/dist/api/context.d.ts.map +1 -0
- package/dist/api/context.js +73 -0
- package/dist/api/context.js.map +1 -0
- package/dist/api/custom-type.d.ts +37 -0
- package/dist/api/custom-type.d.ts.map +1 -0
- package/dist/api/custom-type.js +44 -0
- package/dist/api/custom-type.js.map +1 -0
- package/dist/api/document.d.ts +8 -0
- package/dist/api/document.d.ts.map +1 -0
- package/dist/api/document.js +84 -0
- package/dist/api/document.js.map +1 -0
- package/dist/api/helpers.d.ts +59 -0
- package/dist/api/helpers.d.ts.map +1 -0
- package/dist/api/helpers.js +313 -0
- package/dist/api/helpers.js.map +1 -0
- package/dist/api/index.d.ts +33 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +37 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/links.d.ts +124 -0
- package/dist/api/links.d.ts.map +1 -0
- package/dist/api/links.js +307 -0
- package/dist/api/links.js.map +1 -0
- package/dist/api/listing-fetch-params.d.ts +70 -0
- package/dist/api/listing-fetch-params.d.ts.map +1 -0
- package/dist/api/listing-fetch-params.js +124 -0
- package/dist/api/listing-fetch-params.js.map +1 -0
- package/dist/api/media-library.d.ts +59 -0
- package/dist/api/media-library.d.ts.map +1 -0
- package/dist/api/media-library.js +315 -0
- package/dist/api/media-library.js.map +1 -0
- package/dist/api/navigation.d.ts +10 -0
- package/dist/api/navigation.d.ts.map +1 -0
- package/dist/api/navigation.js +18 -0
- package/dist/api/navigation.js.map +1 -0
- package/dist/api/page.d.ts +15 -0
- package/dist/api/page.d.ts.map +1 -0
- package/dist/api/page.js +39 -0
- package/dist/api/page.js.map +1 -0
- package/dist/api/person.d.ts +37 -0
- package/dist/api/person.d.ts.map +1 -0
- package/dist/api/person.js +135 -0
- package/dist/api/person.js.map +1 -0
- package/dist/api/preview-types.d.ts +65 -0
- package/dist/api/preview-types.d.ts.map +1 -0
- package/dist/api/preview-types.js +7 -0
- package/dist/api/preview-types.js.map +1 -0
- package/dist/api/preview.d.ts +49 -0
- package/dist/api/preview.d.ts.map +1 -0
- package/dist/api/preview.js +261 -0
- package/dist/api/preview.js.map +1 -0
- package/dist/api/redirects.d.ts +16 -0
- package/dist/api/redirects.d.ts.map +1 -0
- package/dist/api/redirects.js +110 -0
- package/dist/api/redirects.js.map +1 -0
- package/dist/api/related-articles.d.ts +28 -0
- package/dist/api/related-articles.d.ts.map +1 -0
- package/dist/api/related-articles.js +147 -0
- package/dist/api/related-articles.js.map +1 -0
- package/dist/api/server-asset.d.ts +67 -0
- package/dist/api/server-asset.d.ts.map +1 -0
- package/dist/api/server-asset.js +106 -0
- package/dist/api/server-asset.js.map +1 -0
- package/dist/api/sitemap.d.ts +131 -0
- package/dist/api/sitemap.d.ts.map +1 -0
- package/dist/api/sitemap.js +201 -0
- package/dist/api/sitemap.js.map +1 -0
- package/dist/api/tag-type.d.ts +32 -0
- package/dist/api/tag-type.d.ts.map +1 -0
- package/dist/api/tag-type.js +123 -0
- package/dist/api/tag-type.js.map +1 -0
- package/dist/api/tag.d.ts +37 -0
- package/dist/api/tag.d.ts.map +1 -0
- package/dist/api/tag.js +132 -0
- package/dist/api/tag.js.map +1 -0
- package/dist/api/template.d.ts +61 -0
- package/dist/api/template.d.ts.map +1 -0
- package/dist/api/template.js +94 -0
- package/dist/api/template.js.map +1 -0
- package/dist/api/types.d.ts +113 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +2 -0
- package/dist/api/types.js.map +1 -0
- package/dist/baseTypes/baseAlternatePageContent.d.ts +32 -0
- package/dist/baseTypes/baseAlternatePageContent.d.ts.map +1 -0
- package/dist/baseTypes/baseAlternatePageContent.js +2 -0
- package/dist/baseTypes/baseAlternatePageContent.js.map +1 -0
- package/dist/baseTypes/baseArticle.d.ts +206 -0
- package/dist/baseTypes/baseArticle.d.ts.map +1 -0
- package/dist/baseTypes/baseArticle.js +2 -0
- package/dist/baseTypes/baseArticle.js.map +1 -0
- package/dist/baseTypes/baseArticleType.d.ts +177 -0
- package/dist/baseTypes/baseArticleType.d.ts.map +1 -0
- package/dist/baseTypes/baseArticleType.js +2 -0
- package/dist/baseTypes/baseArticleType.js.map +1 -0
- package/dist/baseTypes/baseBanner.d.ts +113 -0
- package/dist/baseTypes/baseBanner.d.ts.map +1 -0
- package/dist/baseTypes/baseBanner.js +2 -0
- package/dist/baseTypes/baseBanner.js.map +1 -0
- package/dist/baseTypes/baseCollection.d.ts +132 -0
- package/dist/baseTypes/baseCollection.d.ts.map +1 -0
- package/dist/baseTypes/baseCollection.js +2 -0
- package/dist/baseTypes/baseCollection.js.map +1 -0
- package/dist/baseTypes/baseComponent.d.ts +130 -0
- package/dist/baseTypes/baseComponent.d.ts.map +1 -0
- package/dist/baseTypes/baseComponent.js +2 -0
- package/dist/baseTypes/baseComponent.js.map +1 -0
- package/dist/baseTypes/baseCustomType.d.ts +147 -0
- package/dist/baseTypes/baseCustomType.d.ts.map +1 -0
- package/dist/baseTypes/baseCustomType.js +2 -0
- package/dist/baseTypes/baseCustomType.js.map +1 -0
- package/dist/baseTypes/baseDocument.d.ts +70 -0
- package/dist/baseTypes/baseDocument.d.ts.map +1 -0
- package/dist/baseTypes/baseDocument.js +2 -0
- package/dist/baseTypes/baseDocument.js.map +1 -0
- package/dist/baseTypes/baseExternalComponent.d.ts +138 -0
- package/dist/baseTypes/baseExternalComponent.d.ts.map +1 -0
- package/dist/baseTypes/baseExternalComponent.js +2 -0
- package/dist/baseTypes/baseExternalComponent.js.map +1 -0
- package/dist/baseTypes/baseExternalVideo.d.ts +86 -0
- package/dist/baseTypes/baseExternalVideo.d.ts.map +1 -0
- package/dist/baseTypes/baseExternalVideo.js +2 -0
- package/dist/baseTypes/baseExternalVideo.js.map +1 -0
- package/dist/baseTypes/baseHtmlComponent.d.ts +72 -0
- package/dist/baseTypes/baseHtmlComponent.d.ts.map +1 -0
- package/dist/baseTypes/baseHtmlComponent.js +2 -0
- package/dist/baseTypes/baseHtmlComponent.js.map +1 -0
- package/dist/baseTypes/baseLink.d.ts +115 -0
- package/dist/baseTypes/baseLink.d.ts.map +1 -0
- package/dist/baseTypes/baseLink.js +2 -0
- package/dist/baseTypes/baseLink.js.map +1 -0
- package/dist/baseTypes/baseMedia.d.ts +100 -0
- package/dist/baseTypes/baseMedia.d.ts.map +1 -0
- package/dist/baseTypes/baseMedia.js +2 -0
- package/dist/baseTypes/baseMedia.js.map +1 -0
- package/dist/baseTypes/baseNavigation.d.ts +37 -0
- package/dist/baseTypes/baseNavigation.d.ts.map +1 -0
- package/dist/baseTypes/baseNavigation.js +2 -0
- package/dist/baseTypes/baseNavigation.js.map +1 -0
- package/dist/baseTypes/baseNavigationItem.d.ts +109 -0
- package/dist/baseTypes/baseNavigationItem.d.ts.map +1 -0
- package/dist/baseTypes/baseNavigationItem.js +2 -0
- package/dist/baseTypes/baseNavigationItem.js.map +1 -0
- package/dist/baseTypes/basePage.d.ts +142 -0
- package/dist/baseTypes/basePage.d.ts.map +1 -0
- package/dist/baseTypes/basePage.js +2 -0
- package/dist/baseTypes/basePage.js.map +1 -0
- package/dist/baseTypes/basePageVariant.d.ts +145 -0
- package/dist/baseTypes/basePageVariant.d.ts.map +1 -0
- package/dist/baseTypes/basePageVariant.js +2 -0
- package/dist/baseTypes/basePageVariant.js.map +1 -0
- package/dist/baseTypes/basePerson.d.ts +160 -0
- package/dist/baseTypes/basePerson.d.ts.map +1 -0
- package/dist/baseTypes/basePerson.js +2 -0
- package/dist/baseTypes/basePerson.js.map +1 -0
- package/dist/baseTypes/baseRedirect.d.ts +69 -0
- package/dist/baseTypes/baseRedirect.d.ts.map +1 -0
- package/dist/baseTypes/baseRedirect.js +2 -0
- package/dist/baseTypes/baseRedirect.js.map +1 -0
- package/dist/baseTypes/baseSchema.d.ts +19 -0
- package/dist/baseTypes/baseSchema.d.ts.map +1 -0
- package/dist/baseTypes/baseSchema.js +2 -0
- package/dist/baseTypes/baseSchema.js.map +1 -0
- package/dist/baseTypes/baseShared.d.ts +25 -0
- package/dist/baseTypes/baseShared.d.ts.map +1 -0
- package/dist/baseTypes/baseShared.js +2 -0
- package/dist/baseTypes/baseShared.js.map +1 -0
- package/dist/baseTypes/baseTag.d.ts +129 -0
- package/dist/baseTypes/baseTag.d.ts.map +1 -0
- package/dist/baseTypes/baseTag.js +2 -0
- package/dist/baseTypes/baseTag.js.map +1 -0
- package/dist/baseTypes/baseTagType.d.ts +70 -0
- package/dist/baseTypes/baseTagType.d.ts.map +1 -0
- package/dist/baseTypes/baseTagType.js +2 -0
- package/dist/baseTypes/baseTagType.js.map +1 -0
- package/dist/baseTypes/baseTemplate.d.ts +77 -0
- package/dist/baseTypes/baseTemplate.d.ts.map +1 -0
- package/dist/baseTypes/baseTemplate.js +2 -0
- package/dist/baseTypes/baseTemplate.js.map +1 -0
- package/dist/client.d.ts +145 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +322 -0
- package/dist/client.js.map +1 -0
- package/dist/cms-integrity.d.ts +10 -0
- package/dist/cms-integrity.d.ts.map +1 -0
- package/dist/cms-integrity.js +7 -0
- package/dist/cms-integrity.js.map +1 -0
- package/dist/converters/animationEnricher.d.ts +17 -0
- package/dist/converters/animationEnricher.d.ts.map +1 -0
- package/dist/converters/animationEnricher.js +177 -0
- package/dist/converters/animationEnricher.js.map +1 -0
- package/dist/converters/article.d.ts +48 -0
- package/dist/converters/article.d.ts.map +1 -0
- package/dist/converters/article.js +364 -0
- package/dist/converters/article.js.map +1 -0
- package/dist/converters/asset.d.ts +33 -0
- package/dist/converters/asset.d.ts.map +1 -0
- package/dist/converters/asset.js +340 -0
- package/dist/converters/asset.js.map +1 -0
- package/dist/converters/banner.d.ts +10 -0
- package/dist/converters/banner.d.ts.map +1 -0
- package/dist/converters/banner.js +63 -0
- package/dist/converters/banner.js.map +1 -0
- package/dist/converters/collection.d.ts +26 -0
- package/dist/converters/collection.d.ts.map +1 -0
- package/dist/converters/collection.js +52 -0
- package/dist/converters/collection.js.map +1 -0
- package/dist/converters/component.d.ts +26 -0
- package/dist/converters/component.d.ts.map +1 -0
- package/dist/converters/component.js +54 -0
- package/dist/converters/component.js.map +1 -0
- package/dist/converters/customType.d.ts +24 -0
- package/dist/converters/customType.d.ts.map +1 -0
- package/dist/converters/customType.js +93 -0
- package/dist/converters/customType.js.map +1 -0
- package/dist/converters/document.d.ts +14 -0
- package/dist/converters/document.d.ts.map +1 -0
- package/dist/converters/document.js +51 -0
- package/dist/converters/document.js.map +1 -0
- package/dist/converters/enrichAssets.d.ts +19 -0
- package/dist/converters/enrichAssets.d.ts.map +1 -0
- package/dist/converters/enrichAssets.js +36 -0
- package/dist/converters/enrichAssets.js.map +1 -0
- package/dist/converters/externalComponent.d.ts +27 -0
- package/dist/converters/externalComponent.d.ts.map +1 -0
- package/dist/converters/externalComponent.js +46 -0
- package/dist/converters/externalComponent.js.map +1 -0
- package/dist/converters/externalVideoEnricher.d.ts +12 -0
- package/dist/converters/externalVideoEnricher.d.ts.map +1 -0
- package/dist/converters/externalVideoEnricher.js +70 -0
- package/dist/converters/externalVideoEnricher.js.map +1 -0
- package/dist/converters/helpers.d.ts +173 -0
- package/dist/converters/helpers.d.ts.map +1 -0
- package/dist/converters/helpers.js +167 -0
- package/dist/converters/helpers.js.map +1 -0
- package/dist/converters/heroVideoEnricher.d.ts +9 -0
- package/dist/converters/heroVideoEnricher.d.ts.map +1 -0
- package/dist/converters/heroVideoEnricher.js +108 -0
- package/dist/converters/heroVideoEnricher.js.map +1 -0
- package/dist/converters/heroVideoEnv.d.ts +14 -0
- package/dist/converters/heroVideoEnv.d.ts.map +1 -0
- package/dist/converters/heroVideoEnv.js +28 -0
- package/dist/converters/heroVideoEnv.js.map +1 -0
- package/dist/converters/htmlComponent.d.ts +17 -0
- package/dist/converters/htmlComponent.d.ts.map +1 -0
- package/dist/converters/htmlComponent.js +33 -0
- package/dist/converters/htmlComponent.js.map +1 -0
- package/dist/converters/iconCollector.d.ts +36 -0
- package/dist/converters/iconCollector.d.ts.map +1 -0
- package/dist/converters/iconCollector.js +309 -0
- package/dist/converters/iconCollector.js.map +1 -0
- package/dist/converters/index.d.ts +26 -0
- package/dist/converters/index.d.ts.map +1 -0
- package/dist/converters/index.js +21 -0
- package/dist/converters/index.js.map +1 -0
- package/dist/converters/link.d.ts +11 -0
- package/dist/converters/link.d.ts.map +1 -0
- package/dist/converters/link.js +109 -0
- package/dist/converters/link.js.map +1 -0
- package/dist/converters/navigationItem.d.ts +17 -0
- package/dist/converters/navigationItem.d.ts.map +1 -0
- package/dist/converters/navigationItem.js +126 -0
- package/dist/converters/navigationItem.js.map +1 -0
- package/dist/converters/page.d.ts +44 -0
- package/dist/converters/page.d.ts.map +1 -0
- package/dist/converters/page.js +160 -0
- package/dist/converters/page.js.map +1 -0
- package/dist/converters/pageVariantMerge.d.ts +24 -0
- package/dist/converters/pageVariantMerge.d.ts.map +1 -0
- package/dist/converters/pageVariantMerge.js +151 -0
- package/dist/converters/pageVariantMerge.js.map +1 -0
- package/dist/converters/person.d.ts +40 -0
- package/dist/converters/person.d.ts.map +1 -0
- package/dist/converters/person.js +152 -0
- package/dist/converters/person.js.map +1 -0
- package/dist/converters/pictureBlurEnricher.d.ts +9 -0
- package/dist/converters/pictureBlurEnricher.d.ts.map +1 -0
- package/dist/converters/pictureBlurEnricher.js +79 -0
- package/dist/converters/pictureBlurEnricher.js.map +1 -0
- package/dist/converters/redirect.d.ts +20 -0
- package/dist/converters/redirect.d.ts.map +1 -0
- package/dist/converters/redirect.js +50 -0
- package/dist/converters/redirect.js.map +1 -0
- package/dist/converters/resolver.d.ts +26 -0
- package/dist/converters/resolver.d.ts.map +1 -0
- package/dist/converters/resolver.js +383 -0
- package/dist/converters/resolver.js.map +1 -0
- package/dist/converters/schema.d.ts +14 -0
- package/dist/converters/schema.d.ts.map +1 -0
- package/dist/converters/schema.js +25 -0
- package/dist/converters/schema.js.map +1 -0
- package/dist/converters/svgProcessor.d.ts +58 -0
- package/dist/converters/svgProcessor.d.ts.map +1 -0
- package/dist/converters/svgProcessor.js +225 -0
- package/dist/converters/svgProcessor.js.map +1 -0
- package/dist/converters/tag.d.ts +25 -0
- package/dist/converters/tag.d.ts.map +1 -0
- package/dist/converters/tag.js +170 -0
- package/dist/converters/tag.js.map +1 -0
- package/dist/converters/tagType.d.ts +15 -0
- package/dist/converters/tagType.d.ts.map +1 -0
- package/dist/converters/tagType.js +56 -0
- package/dist/converters/tagType.js.map +1 -0
- package/dist/converters/template.d.ts +31 -0
- package/dist/converters/template.d.ts.map +1 -0
- package/dist/converters/template.js +53 -0
- package/dist/converters/template.js.map +1 -0
- package/dist/converters/videoEnricher.d.ts +14 -0
- package/dist/converters/videoEnricher.d.ts.map +1 -0
- package/dist/converters/videoEnricher.js +85 -0
- package/dist/converters/videoEnricher.js.map +1 -0
- package/dist/icons/rebuildIconSprite.d.ts +8 -0
- package/dist/icons/rebuildIconSprite.d.ts.map +1 -0
- package/dist/icons/rebuildIconSprite.js +15 -0
- package/dist/icons/rebuildIconSprite.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/navigation/assembly.d.ts +8 -0
- package/dist/navigation/assembly.d.ts.map +1 -0
- package/dist/navigation/assembly.js +115 -0
- package/dist/navigation/assembly.js.map +1 -0
- package/dist/navigation/cacheOptions.d.ts +17 -0
- package/dist/navigation/cacheOptions.d.ts.map +1 -0
- package/dist/navigation/cacheOptions.js +45 -0
- package/dist/navigation/cacheOptions.js.map +1 -0
- package/dist/navigation/enrichModelNavigation.d.ts +17 -0
- package/dist/navigation/enrichModelNavigation.d.ts.map +1 -0
- package/dist/navigation/enrichModelNavigation.js +46 -0
- package/dist/navigation/enrichModelNavigation.js.map +1 -0
- package/dist/navigation/linkIndex.d.ts +10 -0
- package/dist/navigation/linkIndex.d.ts.map +1 -0
- package/dist/navigation/linkIndex.js +34 -0
- package/dist/navigation/linkIndex.js.map +1 -0
- package/dist/navigation/listingLinkBundle.d.ts +22 -0
- package/dist/navigation/listingLinkBundle.d.ts.map +1 -0
- package/dist/navigation/listingLinkBundle.js +88 -0
- package/dist/navigation/listingLinkBundle.js.map +1 -0
- package/dist/navigation/registry.d.ts +15 -0
- package/dist/navigation/registry.d.ts.map +1 -0
- package/dist/navigation/registry.js +130 -0
- package/dist/navigation/registry.js.map +1 -0
- package/dist/navigation/requestCache.d.ts +18 -0
- package/dist/navigation/requestCache.d.ts.map +1 -0
- package/dist/navigation/requestCache.js +66 -0
- package/dist/navigation/requestCache.js.map +1 -0
- package/dist/navigation/types.d.ts +45 -0
- package/dist/navigation/types.d.ts.map +1 -0
- package/dist/navigation/types.js +2 -0
- package/dist/navigation/types.js.map +1 -0
- package/dist/revalidation/entry-handlers.d.ts +40 -0
- package/dist/revalidation/entry-handlers.d.ts.map +1 -0
- package/dist/revalidation/entry-handlers.js +144 -0
- package/dist/revalidation/entry-handlers.js.map +1 -0
- package/dist/revalidation/handlers.d.ts +19 -0
- package/dist/revalidation/handlers.d.ts.map +1 -0
- package/dist/revalidation/handlers.js +50 -0
- package/dist/revalidation/handlers.js.map +1 -0
- package/dist/revalidation/index.d.ts +4 -0
- package/dist/revalidation/index.d.ts.map +1 -0
- package/dist/revalidation/index.js +5 -0
- package/dist/revalidation/index.js.map +1 -0
- package/dist/revalidation/nextjs-route.d.ts +38 -0
- package/dist/revalidation/nextjs-route.d.ts.map +1 -0
- package/dist/revalidation/nextjs-route.js +36 -0
- package/dist/revalidation/nextjs-route.js.map +1 -0
- package/dist/revalidation/route.d.ts +3 -0
- package/dist/revalidation/route.d.ts.map +1 -0
- package/dist/revalidation/route.js +99 -0
- package/dist/revalidation/route.js.map +1 -0
- package/dist/revalidation/server-utils.d.ts +31 -0
- package/dist/revalidation/server-utils.d.ts.map +1 -0
- package/dist/revalidation/server-utils.js +54 -0
- package/dist/revalidation/server-utils.js.map +1 -0
- package/dist/revalidation/tags.d.ts +110 -0
- package/dist/revalidation/tags.d.ts.map +1 -0
- package/dist/revalidation/tags.js +160 -0
- package/dist/revalidation/tags.js.map +1 -0
- package/dist/revalidation/utils.d.ts +21 -0
- package/dist/revalidation/utils.d.ts.map +1 -0
- package/dist/revalidation/utils.js +61 -0
- package/dist/revalidation/utils.js.map +1 -0
- package/dist/revalidation/webhook-content-types.d.ts +12 -0
- package/dist/revalidation/webhook-content-types.d.ts.map +1 -0
- package/dist/revalidation/webhook-content-types.js +28 -0
- package/dist/revalidation/webhook-content-types.js.map +1 -0
- package/dist/routing/index.d.ts +2 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +2 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/marketing-site-url-calculators.d.ts +21 -0
- package/dist/routing/marketing-site-url-calculators.d.ts.map +1 -0
- package/dist/routing/marketing-site-url-calculators.js +43 -0
- package/dist/routing/marketing-site-url-calculators.js.map +1 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +10 -0
- package/dist/server.js.map +1 -0
- package/dist/telemetry/deriveOperation.d.ts +8 -0
- package/dist/telemetry/deriveOperation.d.ts.map +1 -0
- package/dist/telemetry/deriveOperation.js +59 -0
- package/dist/telemetry/deriveOperation.js.map +1 -0
- package/dist/telemetry/queryContext.d.ts +7 -0
- package/dist/telemetry/queryContext.d.ts.map +1 -0
- package/dist/telemetry/queryContext.js +9 -0
- package/dist/telemetry/queryContext.js.map +1 -0
- package/dist/telemetry/queryLog.d.ts +17 -0
- package/dist/telemetry/queryLog.d.ts.map +1 -0
- package/dist/telemetry/queryLog.js +54 -0
- package/dist/telemetry/queryLog.js.map +1 -0
- package/dist/types.d.ts +93 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/arrayUtils.d.ts +3 -0
- package/dist/utils/arrayUtils.d.ts.map +1 -0
- package/dist/utils/arrayUtils.js +12 -0
- package/dist/utils/arrayUtils.js.map +1 -0
- package/dist/utils/dateUtils.d.ts +9 -0
- package/dist/utils/dateUtils.d.ts.map +1 -0
- package/dist/utils/dateUtils.js +26 -0
- package/dist/utils/dateUtils.js.map +1 -0
- package/dist/utils/errors.d.ts +56 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +100 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/redirectMap.d.ts +40 -0
- package/dist/utils/redirectMap.d.ts.map +1 -0
- package/dist/utils/redirectMap.js +129 -0
- package/dist/utils/redirectMap.js.map +1 -0
- package/dist/utils/retry.d.ts +103 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +248 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/tags.d.ts +35 -0
- package/dist/utils/tags.d.ts.map +1 -0
- package/dist/utils/tags.js +37 -0
- package/dist/utils/tags.js.map +1 -0
- package/docs/llms.md +430 -0
- package/package.json +86 -0
package/docs/llms.md
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# @se-studio/contentful-rest-api — LLM Reference
|
|
2
|
+
|
|
3
|
+
Type-safe Contentful REST API client for Next.js App Router applications. Handles fetching, caching, rate limiting, and content conversion.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { coreGetContentfulConfig } from '@se-studio/contentful-rest-api';
|
|
9
|
+
|
|
10
|
+
// Reads CONTENTFUL_SPACE_ID, CONTENTFUL_ACCESS_TOKEN, CONTENTFUL_ENVIRONMENT from env
|
|
11
|
+
const config = coreGetContentfulConfig();
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Or build manually:
|
|
15
|
+
```ts
|
|
16
|
+
import type { ContentfulConfig } from '@se-studio/contentful-rest-api';
|
|
17
|
+
|
|
18
|
+
const config: ContentfulConfig = {
|
|
19
|
+
spaceId: process.env.CONTENTFUL_SPACE_ID!,
|
|
20
|
+
accessToken: process.env.CONTENTFUL_ACCESS_TOKEN!, // delivery token
|
|
21
|
+
previewAccessToken: process.env.CONTENTFUL_PREVIEW_ACCESS_TOKEN, // optional
|
|
22
|
+
environment: process.env.CONTENTFUL_ENVIRONMENT ?? 'master',
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Primary Fetch Functions
|
|
27
|
+
|
|
28
|
+
All functions share the signature `fn(config, identifier, options?)`.
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import {
|
|
32
|
+
contentfulPageRest,
|
|
33
|
+
contentfulArticleRest,
|
|
34
|
+
contentfulArticleTypeRest,
|
|
35
|
+
contentfulNavigationRest, // via contentfulAnyEntryRest
|
|
36
|
+
contentfulTagRest,
|
|
37
|
+
contentfulTagTypeRest,
|
|
38
|
+
contentfulPersonRest,
|
|
39
|
+
contentfulBannerRest,
|
|
40
|
+
contentfulTemplateRest, // IFetchedTemplate includes structuredData (Schema.org Mustache list)
|
|
41
|
+
contentfulComponentRest,
|
|
42
|
+
contentfulCustomTypeRest,
|
|
43
|
+
contentfulAssetRest,
|
|
44
|
+
listMediaLibraryPage, // cms-dev media inventory (images/videos/animations/external-videos)
|
|
45
|
+
mediaLibraryPageToMarkdown,
|
|
46
|
+
contentfulAnyEntryRest, // generic fallback by entry ID
|
|
47
|
+
} from '@se-studio/contentful-rest-api';
|
|
48
|
+
|
|
49
|
+
// Media library page (Preview API by default) — thumbnails via buildAssetThumbUrl
|
|
50
|
+
// const media = await listMediaLibraryPage(config, 'images', { page: 1, limit: 50, preview: true });
|
|
51
|
+
|
|
52
|
+
// Fetch a page by slug
|
|
53
|
+
const page = await contentfulPageRest(config, 'home', {
|
|
54
|
+
preview: false,
|
|
55
|
+
cache: { tags: ['page#home'], revalidate: 3600 },
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Fetch an article by slug
|
|
59
|
+
const article = await contentfulArticleRest(config, 'my-article-slug', {
|
|
60
|
+
cache: { tags: ['article#my-article-slug'], revalidate: 3600 },
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Fetch all links (for sitemaps / related content)
|
|
64
|
+
const allPageLinks = await contentfulAllPageLinks(config);
|
|
65
|
+
const allArticleLinks = await contentfulAllArticleLinks(config);
|
|
66
|
+
const allTagLinks = await contentfulAllTagLinks(config);
|
|
67
|
+
const allPersonLinks = await contentfulAllPersonLinks(config);
|
|
68
|
+
// CmsResponse<IPersonLink[]> — each link includes resolved bio (IResolvedRichText) when set in CMS
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Page variants
|
|
72
|
+
|
|
73
|
+
`contentfulPageRest` resolves a `pageVariant` slug when no `page` matches. The variant merges onto `originalPage` and applies `alternativeContents` swaps.
|
|
74
|
+
|
|
75
|
+
Each `alternatePageContent` entry:
|
|
76
|
+
|
|
77
|
+
- **`sourceContent`** — component/collection to replace (by entry id in the merged tree)
|
|
78
|
+
- **`replacementContents`** — array of replacements (primary; supports 1→N swaps)
|
|
79
|
+
- **`replacementContent`** — singular fallback when `replacementContents` is empty
|
|
80
|
+
|
|
81
|
+
Exported helpers: `mergeAlternatePageContentsInTree`, `resolveAlternateReplacements`.
|
|
82
|
+
|
|
83
|
+
## Flat navigation
|
|
84
|
+
|
|
85
|
+
Assemble menus without Contentful include depth.
|
|
86
|
+
|
|
87
|
+
**Page renders (preferred):** `navigationResolution: 'flat'` on `FetchOptions` — converters stub nav root ids; post-convert step calls registry + link index and rebuilds `model.menu` / `model.footer` / `model.icons`. Set in app `buildOptions`. Default is `'bundled'`.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
buildFetchOptions({ navigationResolution: 'flat', ...options }, preview);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Ad hoc:** `getNavigation` from `createAppHelpers` only — registry/link-index fetchers are not exported.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
const { getNavigation } = createAppHelpers({ /* ... */ });
|
|
97
|
+
const menu = await getNavigation(mainNavEntryId);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Custom layout assembly:** when menu/footer are resolved outside the flat post-convert step, rebuild the sprite from final trees:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { rebuildIconSpriteFromLayout } from '@se-studio/contentful-rest-api';
|
|
104
|
+
|
|
105
|
+
model.icons = await rebuildIconSpriteFromLayout(model.contents, model.menu, model.footer);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Lower-level helpers (`collectIconsFromContent`, `collectIconsFromNavigation`, `deduplicateIcons`, `processIconsForSprite`) are also exported from the package root.
|
|
109
|
+
|
|
110
|
+
Caching (applied inside `getNavigation` via `buildFlatNavigationCacheOptions`):
|
|
111
|
+
|
|
112
|
+
- **Tags (primary):** `FLAT_NAV_CACHE_TAGS` — collection tags for navigation, navigationItem, page, article, tag, **tagType**, **link**, person, etc.
|
|
113
|
+
- **Revalidate (fallback):** `FLAT_NAV_TIME_REVALIDATE_SECONDS` (3600) when webhooks miss; override with `options.next.revalidate`.
|
|
114
|
+
|
|
115
|
+
Unresolved internal targets → blank link; set `LOG_CMS=1` to warn.
|
|
116
|
+
|
|
117
|
+
### Golden listing fields
|
|
118
|
+
|
|
119
|
+
Defined in `listing-fetch-params.ts` (table in file header). Bulk link/index fetches use these `select` lists. Flat-nav **registry** fetches omit `select` (schema-tolerant per space).
|
|
120
|
+
|
|
121
|
+
`tagType` links: `TAG_TYPE_LINK_FIELDS` includes `fields.slug`; spaces without slug fall back to `TAG_TYPE_MINIMAL_FIELDS` on 422.
|
|
122
|
+
|
|
123
|
+
## Related Articles Filtering
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { filterRelatedArticles } from '@se-studio/contentful-rest-api';
|
|
127
|
+
|
|
128
|
+
const related = filterRelatedArticles(allArticleLinks, {
|
|
129
|
+
tagIds: ['tag-entry-id-1', 'tag-entry-id-2'], // OR filter — must match at least one
|
|
130
|
+
tagSlugs: ['topic-a'], // slugs also supported (combined with OR)
|
|
131
|
+
articleTypeSlugs: ['resources/news'], // or articleTypeIds
|
|
132
|
+
authorSlugs: ['alice'], // or authorIds
|
|
133
|
+
strictAuthorMatch: true, // hard filter (exclude non-matches) instead of boost
|
|
134
|
+
tagTypeSlugs: ['condition'], // hard filter on any tag's tagType
|
|
135
|
+
excludeArticleIds: [currentArticle.id],
|
|
136
|
+
before: new Date('2025-01-01'),
|
|
137
|
+
count: 3, // undefined = all matches after sort
|
|
138
|
+
allowUnindexed: true,
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
When tag criteria are set, articles must match at least one (OR). More distinct matching tags → higher rank (then newest date). `strictAuthorMatch` turns author criteria into an exclude filter (key for person-scoped full lists). Use via `getAllArticleLinks({ articleTypeSlugs, strictAuthorMatch, ... })` in core-ui helpers for News Grids / Publications Lists without duplicating filter logic. Direct import is server-only (main barrel of the package pulls server-only transitive deps via enrichers).
|
|
143
|
+
|
|
144
|
+
## Sitemap Helpers
|
|
145
|
+
|
|
146
|
+
(The actual URLs in the entries are produced by your project's `UrlCalculators` + link converters. See `docs/routing.md` for the multi-project guidance and sync checklist.)
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import {
|
|
150
|
+
contentfulPageSitemapEntries,
|
|
151
|
+
contentfulArticleSitemapEntries,
|
|
152
|
+
contentfulArticleTypeSitemapEntries,
|
|
153
|
+
contentfulTagSitemapEntries,
|
|
154
|
+
contentfulPersonSitemapEntries,
|
|
155
|
+
getAllSitemapEntries,
|
|
156
|
+
createSitemapProvider,
|
|
157
|
+
} from '@se-studio/contentful-rest-api';
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## FetchOptions
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
interface FetchOptions {
|
|
164
|
+
preview?: boolean; // use preview API (default: false)
|
|
165
|
+
locale?: string; // Contentful locale (default: 'en-US')
|
|
166
|
+
cache?: {
|
|
167
|
+
tags?: string[]; // Next.js cache tags for revalidation
|
|
168
|
+
revalidate?: number; // seconds; 0 = no cache
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Cache Tags (for revalidation)
|
|
174
|
+
|
|
175
|
+
**Publish cascades:** `template` → `page` + `article`; `articleType` → `article`; `customType` → `tag` + `person` (coarse; Next 15 workaround until per-entity `cacheTag` on Next 16).
|
|
176
|
+
|
|
177
|
+
Use these tag helpers to generate consistent cache tag strings:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
import {
|
|
181
|
+
pageTag, // pageTag('home') → 'page#home'
|
|
182
|
+
articleTag, // articleTag('slug') → 'article#slug'
|
|
183
|
+
articleTypeTag, // articleTypeTag('news') → 'article-type#news'
|
|
184
|
+
tagTag, // tagTag('slug') → 'tag#slug'
|
|
185
|
+
personTag,
|
|
186
|
+
pageVariantTag,
|
|
187
|
+
locationTag,
|
|
188
|
+
templateTag,
|
|
189
|
+
customTypeTag,
|
|
190
|
+
assetTag,
|
|
191
|
+
// Constants
|
|
192
|
+
PageTag, ArticleTag, TagTypeTag, LinkTag, NavigationTag, BannerTag, GlobalTag, AllTags,
|
|
193
|
+
FLAT_NAV_CACHE_TAGS, FLAT_NAV_TIME_REVALIDATE_SECONDS, buildFlatNavigationCacheOptions,
|
|
194
|
+
REVALIDATION_WEBHOOK_ENTRY_CONTENT_TYPES, REVALIDATION_WEBHOOK_ENTRY_CONTENT_TYPES_CSV,
|
|
195
|
+
} from '@se-studio/contentful-rest-api';
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Production published-entry webhook filter: `REVALIDATION_WEBHOOK_ENTRY_CONTENT_TYPES_CSV` (includes `navigation`, `navigationItem`, `tagType`, `link` for flat nav). See `docs/CONTENTFUL_WEBHOOK_REVALIDATION.md`.
|
|
199
|
+
|
|
200
|
+
## Converter Pattern
|
|
201
|
+
|
|
202
|
+
Used to extend how Contentful entries are transformed into typed models. You typically call `createBaseConverterContext()` and pass it via `buildFetchOptions`.
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
import {
|
|
206
|
+
createBaseConverterContext,
|
|
207
|
+
buildFetchOptions,
|
|
208
|
+
basePageConverter,
|
|
209
|
+
baseComponentConverter,
|
|
210
|
+
baseCollectionConverter,
|
|
211
|
+
} from '@se-studio/contentful-rest-api';
|
|
212
|
+
|
|
213
|
+
const context = createBaseConverterContext();
|
|
214
|
+
// extend context.resolvers if you need custom content types
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Base converters available:
|
|
218
|
+
- `basePageConverter` — converts page entries
|
|
219
|
+
- `baseComponentConverter` — converts component entries
|
|
220
|
+
- `baseCollectionConverter` — converts collection entries
|
|
221
|
+
- `baseExternalComponentConverter`
|
|
222
|
+
- `baseArticleConverter`, `baseArticleTypeConverter` — full article converter resolves `download` (same as `baseArticleLinkConverter`); article type **index** `structuredData` comes from `indexPageStructuredData` + template schemas only (entry-level `structuredData` applies on individual articles via `baseArticleConverter`)
|
|
223
|
+
- `baseCustomTypeConverter` — custom type **index** `structuredData` comes from `indexPageStructuredData` only (entry-level `structuredData` applies to child entries)
|
|
224
|
+
- `baseArticleLinkConverter` — `href` is internal when the article has article-level body content (`topContent`, `content`, or `bottomContent` on the article entry; article-type `articlePageTopContent` does not count); external-only articles use `externalLink` as `href`; `externalLink` always on the link object
|
|
225
|
+
- `basePersonConverter`
|
|
226
|
+
- `baseTagConverter`, `baseTagTypeConverter`
|
|
227
|
+
- `baseBannerConverter`
|
|
228
|
+
|
|
229
|
+
### Context extension points
|
|
230
|
+
|
|
231
|
+
`BaseConverterContext` has optional resolver hooks for project-specific behaviour:
|
|
232
|
+
|
|
233
|
+
- `maskResolver?: (maskName: string) => string | undefined` — maps a CMS mask dropdown value to a CSS mask URL or Tailwind class string, stored as `IVisual.mask`
|
|
234
|
+
- `gradientResolver?: (gradientName: string) => string | undefined` — maps a CMS gradient dropdown value to a CSS gradient string (e.g. `linear-gradient(...)`), stored as `IVisual.gradient` and rendered as an overlay div on top of the visual
|
|
235
|
+
- `previewEntryResolvers?: Readonly<Record<string, PreviewEntryResolver>>` — maps Contentful content type ids to Live Preview URL resolvers for **customer page-like types** not built into core (e.g. HSD `location` → `/drive/{slug}/`). Built-in types always win; extensions only run on unknown content types.
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
const context = createBaseConverterContext(urlCalculators);
|
|
239
|
+
context.maskResolver = (name) => maskMap[name];
|
|
240
|
+
context.gradientResolver = (name) => gradientMap[name];
|
|
241
|
+
context.previewEntryResolvers = {
|
|
242
|
+
location: slugPreviewResolver('location', (slug) => `/drive/${slug}/`),
|
|
243
|
+
};
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Preview
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
import {
|
|
250
|
+
createBaseConverterContext,
|
|
251
|
+
getPreviewEntryInfo,
|
|
252
|
+
slugPreviewResolver,
|
|
253
|
+
type PreviewEntryResolver,
|
|
254
|
+
} from '@se-studio/contentful-rest-api';
|
|
255
|
+
|
|
256
|
+
const context = createBaseConverterContext(urlCalculators);
|
|
257
|
+
|
|
258
|
+
// Built-in: page, pageVariant, pageTest, article, articleType, tag, person, customType
|
|
259
|
+
const info = await getPreviewEntryInfo(context, config, entryId);
|
|
260
|
+
// info: { contentType, entryId, slug, href, articleTypeSlug? } | null
|
|
261
|
+
|
|
262
|
+
// Custom page-like types (do not hardcode customer types in core):
|
|
263
|
+
context.previewEntryResolvers = {
|
|
264
|
+
location: slugPreviewResolver('location', (slug) => `/drive/${slug}/`),
|
|
265
|
+
// Or full control — receives fields, includes (include: 1), urlCalculators:
|
|
266
|
+
locationShell: ({ entryId, fields, includes, urlCalculators }) => {
|
|
267
|
+
/* resolve linked entry, return PreviewEntryInfo | null */
|
|
268
|
+
return null;
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const locationInfo = await getPreviewEntryInfo(context, config, locationEntryId);
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Built-in content types:** `page`, `pageVariant`, `pageTest` (redirects to linked control `page` or `pageVariant`), `article`, `articleType`, `tag`, `person`, `customType`.
|
|
276
|
+
|
|
277
|
+
**Custom types:** register via `context.previewEntryResolvers[contentTypeId]`. Prefer `slugPreviewResolver(contentType, toHref)` when only `fields.slug` is needed. Return type is always `PreviewEntryInfo | null`.
|
|
278
|
+
|
|
279
|
+
## Error Handling
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
import {
|
|
283
|
+
isContentfulError,
|
|
284
|
+
isRateLimitError,
|
|
285
|
+
EntryNotFoundError,
|
|
286
|
+
AuthenticationError,
|
|
287
|
+
RateLimitError,
|
|
288
|
+
withRetry,
|
|
289
|
+
} from '@se-studio/contentful-rest-api';
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Rich Text
|
|
293
|
+
|
|
294
|
+
```ts
|
|
295
|
+
import type { IContentfulRichText } from '@se-studio/contentful-rest-api';
|
|
296
|
+
// Use with core-ui's RTF component
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Primary Tag Selection
|
|
300
|
+
|
|
301
|
+
`getPrimaryTag(article, selector?)` returns the primary tag from an article. Without a selector it returns `tags[0]`. Supply a predicate to apply custom logic — the library does not prescribe which tag is "primary".
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
import { getPrimaryTag, type PrimaryTagSelector } from '@se-studio/contentful-rest-api';
|
|
305
|
+
|
|
306
|
+
// Default: returns tags[0]
|
|
307
|
+
const primaryTag = getPrimaryTag(article);
|
|
308
|
+
|
|
309
|
+
// Custom selection — client supplies the predicate
|
|
310
|
+
const mySelector: PrimaryTagSelector = (tag, articleType) =>
|
|
311
|
+
articleType?.slug === 'news'
|
|
312
|
+
? tag.tagType?.slug === 'disease-area'
|
|
313
|
+
: tag.tagType?.slug === 'presentation-type';
|
|
314
|
+
|
|
315
|
+
const primaryTag = getPrimaryTag(article, mySelector);
|
|
316
|
+
// Falls back to tags[0] if no tag matches the predicate
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
To also drive the generated `article.href` URL, pass `primaryTagSelector` when building the converter context:
|
|
320
|
+
|
|
321
|
+
See also the full routing + UrlCalculators contract + examples from other consumers in the monorepo at `docs/routing.md` (critical when you have a non-default primary tag selection or custom article URL shape).
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
const context = createBaseConverterContext({
|
|
325
|
+
...config,
|
|
326
|
+
primaryTagSelector: mySelector,
|
|
327
|
+
});
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
`ITagLink` carries `tagType?: { id, name, slug, show? }` so selectors can match on tag type without an extra fetch.
|
|
331
|
+
|
|
332
|
+
## Tag visual visibility
|
|
333
|
+
|
|
334
|
+
`show` on Tag and TagType controls **UI rendering only** (cards, detail pages). It does not affect search indexing (`indexed`), live pages (`hidden`), or related-articles matching.
|
|
335
|
+
|
|
336
|
+
```ts
|
|
337
|
+
import {
|
|
338
|
+
filterVisibleTags,
|
|
339
|
+
isTagShowEnabled,
|
|
340
|
+
isTagVisible,
|
|
341
|
+
} from '@se-studio/contentful-rest-api';
|
|
342
|
+
|
|
343
|
+
// Visible when tag.show and tag.tagType.show are not explicitly false
|
|
344
|
+
const displayTags = filterVisibleTags(article.tags);
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Utility Functions
|
|
348
|
+
|
|
349
|
+
```ts
|
|
350
|
+
import {
|
|
351
|
+
filterVisibleTags, // tags to show on cards/detail (show !== false on tag and tagType)
|
|
352
|
+
getPrimaryTag, // select primary tag from an article; accepts optional predicate
|
|
353
|
+
isTagShowEnabled, // undefined/null/true => visible; false => hidden from UI
|
|
354
|
+
isTagVisible, // tag.show && tag.tagType.show (visual only)
|
|
355
|
+
type PrimaryTagSelector, // (tag, articleType) => boolean
|
|
356
|
+
type TagVisibilityFields,
|
|
357
|
+
notEmpty, // array filter: arr.filter(notEmpty)
|
|
358
|
+
arrayOrUndefined, // returns array or undefined if empty
|
|
359
|
+
safeDate, // parse date string safely
|
|
360
|
+
isValidDate,
|
|
361
|
+
} from '@se-studio/contentful-rest-api';
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Query logging (dev)
|
|
365
|
+
|
|
366
|
+
Set `LOG_CMS_QUERIES=1` to emit structured per-fetch lines:
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
[CMS query] {"url":"...","operation":"Reading article","identifier":"my-slug","bytes":24064,"ms":45}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Merge with Next.js dev fetch cache lines (`(cache hit|miss)`) after the fact:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
pnpm dev 2>&1 | tee dev.log
|
|
376
|
+
pnpm --filter @se-studio/contentful-rest-api consolidate-cms-logs -- dev.log
|
|
377
|
+
# => Reading article my-slug - 23.5k (cached) in 12ms
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
For reliable URL matching, enable full fetch URLs in the app's `next.config.js`:
|
|
381
|
+
|
|
382
|
+
```js
|
|
383
|
+
logging: { fetches: { fullUrl: true } }
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Related: `LOG_CMS=1` (conversion warnings), `LOG_CMS_FETCH=1` (raw URLs only).
|
|
387
|
+
|
|
388
|
+
## Download proxy (hide CDN URLs)
|
|
389
|
+
|
|
390
|
+
```ts
|
|
391
|
+
// app/download/[assetId]/[filename]/route.ts
|
|
392
|
+
import { createDownloadHandler } from '@se-studio/contentful-rest-api/server';
|
|
393
|
+
|
|
394
|
+
export const GET = createDownloadHandler({
|
|
395
|
+
getConfig: () => getContentfulConfig(),
|
|
396
|
+
// Default revalidate = 86400 (1 day). Static fund/letter PDFs: pass a long TTL via config only.
|
|
397
|
+
revalidate: 60 * 60 * 24 * 30, // e.g. 30 days for immutable-ish document packages
|
|
398
|
+
baseUrl: 'https://www.example.com',
|
|
399
|
+
});
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
- Public hrefs: `/download/{assetId}/{canonicalFilename}` via `urlCalculators.download`.
|
|
403
|
+
- Never emit raw Contentful/Webflow CDN URLs in published HTML for PDFs.
|
|
404
|
+
- On file replace: use a **new asset id and/or filename** so long `Cache-Control` does not pin stale bytes.
|
|
405
|
+
- Successful responses set `max-age` and `s-maxage` from `revalidate`; identity 301s use a short max-age.
|
|
406
|
+
|
|
407
|
+
## Document content type
|
|
408
|
+
|
|
409
|
+
Fund/compliance files without full Article machinery.
|
|
410
|
+
|
|
411
|
+
```ts
|
|
412
|
+
import {
|
|
413
|
+
baseDocumentConverter,
|
|
414
|
+
contentfulDocumentsRest,
|
|
415
|
+
} from '@se-studio/contentful-rest-api';
|
|
416
|
+
import type { IBaseDocument } from '@se-studio/core-data-types';
|
|
417
|
+
|
|
418
|
+
// Optional hop page (omit → document.href falls back to file download proxy)
|
|
419
|
+
urlCalculators.document = (slug) => `/documents/${slug}/`;
|
|
420
|
+
|
|
421
|
+
const { data } = await contentfulDocumentsRest(context, config, options);
|
|
422
|
+
// data: IBaseDocument[] — file.href always /download/...
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## Important Constraints
|
|
426
|
+
|
|
427
|
+
- Always supply `spaceId`, `accessToken`, and `environment`.
|
|
428
|
+
- For Next.js: pass `cache.tags` and `cache.revalidate` so pages can be revalidated via Contentful webhooks.
|
|
429
|
+
- For preview mode, also supply `previewAccessToken` and pass `{ preview: true }` in options.
|
|
430
|
+
- `contentfulNavigationRest` is not a direct export — navigation is fetched via `contentfulAnyEntryRest` or via the app's `cms-server`.
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@se-studio/contentful-rest-api",
|
|
3
|
+
"version": "0.0.0-next16-20260822103555",
|
|
4
|
+
"description": "Type-safe Contentful REST API client with caching and rate limiting for Next.js applications",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Something-Else-Studio/se-core-product",
|
|
8
|
+
"directory": "packages/contentful-rest-api"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"require": "./dist/index.js",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./server": {
|
|
22
|
+
"types": "./dist/server.d.ts",
|
|
23
|
+
"import": "./dist/server.js",
|
|
24
|
+
"require": "./dist/server.js",
|
|
25
|
+
"default": "./dist/server.js"
|
|
26
|
+
},
|
|
27
|
+
"./cms-integrity": {
|
|
28
|
+
"types": "./dist/cms-integrity.d.ts",
|
|
29
|
+
"import": "./dist/cms-integrity.js",
|
|
30
|
+
"require": "./dist/cms-integrity.js",
|
|
31
|
+
"default": "./dist/cms-integrity.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"*.md",
|
|
37
|
+
"docs"
|
|
38
|
+
],
|
|
39
|
+
"keywords": [
|
|
40
|
+
"contentful",
|
|
41
|
+
"cms",
|
|
42
|
+
"nextjs",
|
|
43
|
+
"next.js",
|
|
44
|
+
"typescript",
|
|
45
|
+
"rest-api",
|
|
46
|
+
"rest",
|
|
47
|
+
"api-client",
|
|
48
|
+
"caching",
|
|
49
|
+
"cache",
|
|
50
|
+
"rate-limiting",
|
|
51
|
+
"webhook",
|
|
52
|
+
"revalidation",
|
|
53
|
+
"isr",
|
|
54
|
+
"incremental-static-regeneration"
|
|
55
|
+
],
|
|
56
|
+
"homepage": "https://github.com/Something-Else-Studio/se-core-product#readme",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/Something-Else-Studio/se-core-product/issues"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@contentful/rich-text-types": "^17.2.7",
|
|
62
|
+
"contentful": "^11.12.7",
|
|
63
|
+
"fflate": "^0.8.3",
|
|
64
|
+
"server-only": "0.0.1",
|
|
65
|
+
"@se-studio/core-data-types": "1.12.0"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"next": ">=15.5.0 <17"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@biomejs/biome": "^2.5.5",
|
|
72
|
+
"@types/node": "^24.13.3",
|
|
73
|
+
"next": "^16.3.1",
|
|
74
|
+
"typescript": "^6.0.3",
|
|
75
|
+
"vitest": "^4.1.10"
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"build": "tsc --project tsconfig.build.json && node scripts/fix-esm-imports.mjs",
|
|
79
|
+
"dev": "tsc --project tsconfig.build.json --watch",
|
|
80
|
+
"type-check": "tsc --noEmit",
|
|
81
|
+
"lint": "biome lint .",
|
|
82
|
+
"test": "vitest run && node --test scripts/cms-query-log-consolidate.test.mjs",
|
|
83
|
+
"consolidate-cms-logs": "node scripts/consolidate-cms-query-logs.mjs",
|
|
84
|
+
"clean": "rm -rf dist .turbo *.tsbuildinfo"
|
|
85
|
+
}
|
|
86
|
+
}
|