@se-studio/contentful-rest-api 1.0.44 → 1.0.46

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 CHANGED
@@ -366,7 +366,7 @@ interface RetryConfig {
366
366
  }
367
367
  interface FetchOptions {
368
368
  locale?: string;
369
- preview?: boolean;
369
+ preview: boolean;
370
370
  include?: number;
371
371
  cache?: 'force-cache' | 'no-store';
372
372
  next?: {
@@ -447,12 +447,12 @@ type ConverterContext = BaseConverterContext & {
447
447
  errors: CmsError[];
448
448
  };
449
449
 
450
- declare function contentfulArticleRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, articleTypeSlug: string, options?: FetchOptions): Promise<CmsResponse<IBaseArticle | null>>;
450
+ declare function contentfulArticleRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, articleTypeSlug: string, options: FetchOptions): Promise<CmsResponse<IBaseArticle | null>>;
451
451
 
452
452
  interface ArticleTypeFetchOptions extends FetchOptions {
453
453
  customType?: string;
454
454
  }
455
- declare function contentfulArticleTypeRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options?: ArticleTypeFetchOptions): Promise<CmsResponse<IBaseArticleType | null>>;
455
+ declare function contentfulArticleTypeRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options: ArticleTypeFetchOptions): Promise<CmsResponse<IBaseArticleType | null>>;
456
456
 
457
457
  interface ContentfulResponse<T = any> {
458
458
  sys: {
@@ -511,10 +511,10 @@ declare class ContentfulFetchClient {
511
511
  }
512
512
  declare function createContentfulClient(config: ContentfulConfig): ContentfulFetchClient;
513
513
  declare function createContentfulPreviewClient(config: ContentfulConfig): ContentfulFetchClient;
514
- declare function getContentfulClient(config: ContentfulConfig, preview?: boolean): ContentfulFetchClient;
514
+ declare function getContentfulClient(config: ContentfulConfig, preview: boolean): ContentfulFetchClient;
515
515
 
516
516
  declare function isBrowserViewable(contentType: string): boolean;
517
- declare function contentfulAssetRest(config: ContentfulConfig, assetId: string, options?: FetchOptions): Promise<ContentfulAssetResponse | null>;
517
+ declare function contentfulAssetRest(config: ContentfulConfig, assetId: string, options: FetchOptions): Promise<ContentfulAssetResponse | null>;
518
518
  interface DownloadHandlerConfig {
519
519
  getConfig: (preview?: boolean) => ContentfulConfig;
520
520
  revalidate?: number;
@@ -530,7 +530,7 @@ declare function createDownloadHandler(config: DownloadHandlerConfig): (_request
530
530
 
531
531
  declare function createBaseConverterContext(urlCalculators: UrlCalculators): BaseConverterContext;
532
532
 
533
- declare function contentfulCustomTypeRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options?: FetchOptions): Promise<CmsResponse<IBaseCustomType | null>>;
533
+ declare function contentfulCustomTypeRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options: FetchOptions): Promise<CmsResponse<IBaseCustomType | null>>;
534
534
 
535
535
  type DefaultChainModifier = 'WITHOUT_LINK_RESOLUTION';
536
536
  interface IContentfulRichText {
@@ -548,7 +548,7 @@ interface SitemapContentTypeConfig {
548
548
  priority?: number;
549
549
  changeFrequency?: SitemapChangeFrequency;
550
550
  }
551
- type SitemapEntryProvider = (context: BaseConverterContext, config: ContentfulConfig, options?: FetchOptions) => Promise<CmsResponse<ISitemapEntry[]>>;
551
+ type SitemapEntryProvider = (context: BaseConverterContext, config: ContentfulConfig, options: FetchOptions) => Promise<CmsResponse<ISitemapEntry[]>>;
552
552
  interface SitemapConfig {
553
553
  providers: SitemapEntryProvider[];
554
554
  }
@@ -569,18 +569,21 @@ type PossibleResolvedEntry = {
569
569
  resolved?: ResolvedEntry;
570
570
  };
571
571
 
572
- declare function contentfulAllPageLinks(context: BaseConverterContext, config: ContentfulConfig, options?: FetchOptions): Promise<CmsResponse<IInternalLink[]>>;
573
- declare function contentfulAllArticleLinks(context: BaseConverterContext, config: ContentfulConfig, options?: FetchOptions): Promise<CmsResponse<IArticleLink[]>>;
574
- declare function contentfulAllTagLinks(context: BaseConverterContext, config: ContentfulConfig, options?: FetchOptions): Promise<CmsResponse<IInternalLink[]>>;
575
- declare function contentfulAllPersonLinks(context: BaseConverterContext, config: ContentfulConfig, options?: FetchOptions): Promise<CmsResponse<IInternalLink[]>>;
576
- declare function contentfulAllArticleTypeLinks(context: BaseConverterContext, config: ContentfulConfig, options?: FetchOptions): Promise<CmsResponse<IArticleTypeLink[]>>;
572
+ declare function buildFetchOptions(options: FetchOptions | undefined, defaultDraftOnly?: boolean): FetchOptions;
573
+ declare function getContentfulConfig(preview: boolean): ContentfulConfig;
574
+
575
+ declare function contentfulAllPageLinks(context: BaseConverterContext, config: ContentfulConfig, options: FetchOptions): Promise<CmsResponse<IInternalLink[]>>;
576
+ declare function contentfulAllArticleLinks(context: BaseConverterContext, config: ContentfulConfig, options: FetchOptions): Promise<CmsResponse<IArticleLink[]>>;
577
+ declare function contentfulAllTagLinks(context: BaseConverterContext, config: ContentfulConfig, options: FetchOptions): Promise<CmsResponse<IInternalLink[]>>;
578
+ declare function contentfulAllPersonLinks(context: BaseConverterContext, config: ContentfulConfig, options: FetchOptions): Promise<CmsResponse<IInternalLink[]>>;
579
+ declare function contentfulAllArticleTypeLinks(context: BaseConverterContext, config: ContentfulConfig, options: FetchOptions): Promise<CmsResponse<IArticleTypeLink[]>>;
577
580
 
578
- declare function contentfulPageRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options?: FetchOptions): Promise<CmsResponse<IBasePage | null>>;
581
+ declare function contentfulPageRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options: FetchOptions): Promise<CmsResponse<IBasePage | null>>;
579
582
 
580
583
  interface PersonFetchOptions extends FetchOptions {
581
584
  customType?: string;
582
585
  }
583
- declare function contentfulPersonRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options?: PersonFetchOptions): Promise<CmsResponse<IContentfulPerson | null>>;
586
+ declare function contentfulPersonRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options: PersonFetchOptions): Promise<CmsResponse<IContentfulPerson | null>>;
584
587
 
585
588
  type PreviewContentType = 'page' | 'pageVariant' | 'article' | 'articleType' | 'tag' | 'person' | 'customType';
586
589
  interface PreviewEntryInfo {
@@ -594,18 +597,18 @@ declare function getPreviewEntryInfo(context: BaseConverterContext, config: Cont
594
597
 
595
598
  declare function filterRelatedArticles(articles: IArticleLink[], options: RelatedArticlesOptions): IArticleLink[];
596
599
 
597
- declare function contentfulPageSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig?: SitemapContentTypeConfig, options?: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
598
- declare function contentfulArticleSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig?: SitemapContentTypeConfig, options?: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
599
- declare function contentfulArticleTypeSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig?: SitemapContentTypeConfig, options?: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
600
- declare function contentfulTagSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig?: SitemapContentTypeConfig, options?: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
601
- declare function contentfulPersonSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig?: SitemapContentTypeConfig, options?: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
602
- declare function getAllSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapConfig, options?: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
603
- declare function createSitemapProvider(fetcher: (context: BaseConverterContext, config: ContentfulConfig, sitemapConfig?: SitemapContentTypeConfig, options?: FetchOptions) => Promise<CmsResponse<ISitemapEntry[]>>, sitemapConfig?: SitemapContentTypeConfig): SitemapEntryProvider;
600
+ declare function contentfulPageSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
601
+ declare function contentfulArticleSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
602
+ declare function contentfulArticleTypeSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
603
+ declare function contentfulTagSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
604
+ declare function contentfulPersonSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
605
+ declare function getAllSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
606
+ declare function createSitemapProvider(fetcher: (context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions) => Promise<CmsResponse<ISitemapEntry[]>>, sitemapConfig: SitemapContentTypeConfig): SitemapEntryProvider;
604
607
 
605
608
  interface TagFetchOptions extends FetchOptions {
606
609
  customType?: string;
607
610
  }
608
- declare function contentfulTagRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options?: TagFetchOptions): Promise<CmsResponse<IBaseTag | null>>;
611
+ declare function contentfulTagRest(context: BaseConverterContext, config: ContentfulConfig, slug: string, options: TagFetchOptions): Promise<CmsResponse<IBaseTag | null>>;
609
612
 
610
613
  interface IFetchedTemplate {
611
614
  id: string;
@@ -619,7 +622,7 @@ interface IFetchedTemplate {
619
622
  stickyNav: boolean;
620
623
  icons?: ReadonlyArray<ISvgImage>;
621
624
  }
622
- declare function contentfulTemplateRest(context: BaseConverterContext, config: ContentfulConfig, cmsLabel: string, options?: FetchOptions): Promise<CmsResponse<IFetchedTemplate | null>>;
625
+ declare function contentfulTemplateRest(context: BaseConverterContext, config: ContentfulConfig, cmsLabel: string, options: FetchOptions): Promise<CmsResponse<IFetchedTemplate | null>>;
623
626
 
624
627
  declare function createResponsiveVisual(visual: IVisual | undefined, mobileVisual: IVisual | undefined, customSize?: number | null): IResponsiveVisual | undefined;
625
628
 
@@ -715,4 +718,4 @@ declare class RateLimiter {
715
718
  getIntervalMs(): number;
716
719
  }
717
720
 
718
- export { AllTags, ArticleTag, type ArticleTypeFetchOptions, ArticleTypeTag, AssetTag, AuthenticationError, BannerTag, type BaseConverterContext, type CmsError, type CmsResponse, type ContentResolverFunction, ContentfulFetchClient as ContentfulClient, type ContentfulConfig, ContentfulError, ContentfulFetchClient, type ConverterContext, CustomTypeTag, type DefaultChainModifier, type DownloadHandlerConfig, type DownloadRouteParams, EntryNotFoundError, type FetchOptions, GlobalTag, type IContentfulCollection, type IContentfulComponent, type IContentfulPerson, type IContentfulRichText, type IFetchedTemplate, type ISitemapEntry, LocationTag, NavigationTag, PageTag, type PersonFetchOptions, PersonTag, type PreviewContentType, type PreviewEntryInfo, RateLimitError, RateLimiter, type RelatedArticlesOptions, type RetryConfig, type RevalidationConfig, type SitemapChangeFrequency, type SitemapConfig, type SitemapContentTypeConfig, type SitemapEntryProvider, type TagFetchOptions, TagTag, TemplateTag, type UrlCalculators, ValidationError, arrayOrUndefined, articleTag, articleTypeIndexTag, articleTypeTag, assetTag, basePageConverter, calculateBackoffDelay, calculatePageHref, calculatePageVariantHref, contentfulAllArticleLinks, contentfulAllArticleTypeLinks, contentfulAllPageLinks, contentfulAllPersonLinks, contentfulAllTagLinks, contentfulArticleRest, contentfulArticleSitemapEntries, contentfulArticleTypeRest, contentfulArticleTypeSitemapEntries, contentfulAssetRest, contentfulCustomTypeRest, contentfulPageRest, contentfulPageSitemapEntries, contentfulPersonRest, contentfulPersonSitemapEntries, contentfulTagRest, contentfulTagSitemapEntries, contentfulTemplateRest, createBaseConverterContext, createContentfulClient, createContentfulPreviewClient, createDownloadHandler, createResponsiveVisual, createRevalidationHandler, createSitemapProvider, customTypeTag, filterRelatedArticles, getAllSitemapEntries, getCacheTags, getCacheTagsForPreview, getCacheTagsForProduction, getContentfulClient, getPreviewEntryInfo, getRetryAfter, isBrowserViewable, isContentfulError, isRateLimitError, isRetryableError, isValidDate, locationTag, lookupAsset, notEmpty, pageTag, personTag, resolveLink, resolveLinks, resolveRichTextDocument, revalidateSingleTag, revalidateTags, safeDate, tagTag, templateTag, withRetry };
721
+ export { AllTags, ArticleTag, type ArticleTypeFetchOptions, ArticleTypeTag, AssetTag, AuthenticationError, BannerTag, type BaseConverterContext, type CmsError, type CmsResponse, type ContentResolverFunction, ContentfulFetchClient as ContentfulClient, type ContentfulConfig, ContentfulError, ContentfulFetchClient, type ConverterContext, CustomTypeTag, type DefaultChainModifier, type DownloadHandlerConfig, type DownloadRouteParams, EntryNotFoundError, type FetchOptions, GlobalTag, type IContentfulCollection, type IContentfulComponent, type IContentfulPerson, type IContentfulRichText, type IFetchedTemplate, type ISitemapEntry, LocationTag, NavigationTag, PageTag, type PersonFetchOptions, PersonTag, type PreviewContentType, type PreviewEntryInfo, RateLimitError, RateLimiter, type RelatedArticlesOptions, type RetryConfig, type RevalidationConfig, type SitemapChangeFrequency, type SitemapConfig, type SitemapContentTypeConfig, type SitemapEntryProvider, type TagFetchOptions, TagTag, TemplateTag, type UrlCalculators, ValidationError, arrayOrUndefined, articleTag, articleTypeIndexTag, articleTypeTag, assetTag, basePageConverter, buildFetchOptions, calculateBackoffDelay, calculatePageHref, calculatePageVariantHref, contentfulAllArticleLinks, contentfulAllArticleTypeLinks, contentfulAllPageLinks, contentfulAllPersonLinks, contentfulAllTagLinks, contentfulArticleRest, contentfulArticleSitemapEntries, contentfulArticleTypeRest, contentfulArticleTypeSitemapEntries, contentfulAssetRest, contentfulCustomTypeRest, contentfulPageRest, contentfulPageSitemapEntries, contentfulPersonRest, contentfulPersonSitemapEntries, contentfulTagRest, contentfulTagSitemapEntries, contentfulTemplateRest, createBaseConverterContext, createContentfulClient, createContentfulPreviewClient, createDownloadHandler, createResponsiveVisual, createRevalidationHandler, createSitemapProvider, customTypeTag, filterRelatedArticles, getAllSitemapEntries, getCacheTags, getCacheTagsForPreview, getCacheTagsForProduction, getContentfulClient, getContentfulConfig, getPreviewEntryInfo, getRetryAfter, isBrowserViewable, isContentfulError, isRateLimitError, isRetryableError, isValidDate, locationTag, lookupAsset, notEmpty, pageTag, personTag, resolveLink, resolveLinks, resolveRichTextDocument, revalidateSingleTag, revalidateTags, safeDate, tagTag, templateTag, withRetry };
package/dist/index.js CHANGED
@@ -122,13 +122,13 @@ async function revalidateTags(tags, reason) {
122
122
  await delay(500);
123
123
  for (const tag of tags) {
124
124
  console.log(`Revalidating tag: ${tag} - ${reason}`);
125
- revalidateTag(tag, "max");
125
+ revalidateTag(tag);
126
126
  }
127
127
  }
128
128
  async function revalidateSingleTag(tag, reason) {
129
129
  await delay(500);
130
130
  console.log(`Revalidating single tag: ${tag} - ${reason}`);
131
- revalidateTag(tag, "max");
131
+ revalidateTag(tag);
132
132
  }
133
133
  function delay(ms) {
134
134
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -528,7 +528,7 @@ function createContentfulClient(config) {
528
528
  function createContentfulPreviewClient(config) {
529
529
  return new ContentfulFetchClient(config, true);
530
530
  }
531
- function getContentfulClient(config, preview = false) {
531
+ function getContentfulClient(config, preview) {
532
532
  return preview ? createContentfulPreviewClient(config) : createContentfulClient(config);
533
533
  }
534
534
 
@@ -1140,6 +1140,38 @@ function safeDate(date) {
1140
1140
  }
1141
1141
 
1142
1142
  // src/api/helpers.ts
1143
+ function buildFetchOptions(options, defaultDraftOnly = false) {
1144
+ const preview = options?.preview === void 0 ? defaultDraftOnly : options.preview;
1145
+ return {
1146
+ preview,
1147
+ cache: "force-cache",
1148
+ ...options
1149
+ };
1150
+ }
1151
+ function getContentfulConfig(preview) {
1152
+ const spaceId = process.env.CONTENTFUL_SPACE_ID;
1153
+ const environment = process.env.CONTENTFUL_ENVIRONMENT || process.env.CONTENTFUL_ENVIRONMENT_NAME;
1154
+ const accessToken = preview ? process.env.CONTENTFUL_PREVIEW_ACCESS_TOKEN : process.env.CONTENTFUL_ACCESS_TOKEN;
1155
+ if (!spaceId) {
1156
+ throw new Error("CONTENTFUL_SPACE_ID environment variable is required");
1157
+ }
1158
+ if (!accessToken) {
1159
+ if (preview) {
1160
+ throw new Error("CONTENTFUL_PREVIEW_ACCESS_TOKEN environment variable is required");
1161
+ }
1162
+ throw new Error("CONTENTFUL_ACCESS_TOKEN environment variable is required");
1163
+ }
1164
+ if (!environment) {
1165
+ throw new Error(
1166
+ "CONTENTFUL_ENVIRONMENT or CONTENTFUL_ENVIRONMENT_NAME environment variable is required"
1167
+ );
1168
+ }
1169
+ return {
1170
+ spaceId,
1171
+ accessToken,
1172
+ environment
1173
+ };
1174
+ }
1143
1175
  var PAGE_LINK_FIELDS = "sys,fields.cmsLabel,fields.title,fields.slug,fields.featuredImage,fields.backgroundColour,fields.textColour,fields.indexed,fields.hidden,fields.tags";
1144
1176
  var ARTICLE_LINK_FIELDS = "sys,fields.cmsLabel,fields.title,fields.slug,fields.featuredImage,fields.backgroundColour,fields.textColour,fields.indexed,fields.hidden,fields.tags,fields.articleType,fields.date,fields.author,fields.externalLink,fields.download";
1145
1177
  var ARTICLE_TYPE_LINK_FIELDS = "sys,fields.name,fields.slug,fields.featuredImage,fields.backgroundColour,fields.textColour,fields.indexed,fields.hidden";
@@ -1185,7 +1217,7 @@ function convertAllIncludes(response) {
1185
1217
  return includes;
1186
1218
  }
1187
1219
  async function fetchSingleEntity(context, config, fetchConfig, options) {
1188
- const client = getContentfulClient(config, options?.preview);
1220
+ const client = getContentfulClient(config, options.preview);
1189
1221
  const cacheTags = getCacheTags(
1190
1222
  fetchConfig.cacheTagType,
1191
1223
  fetchConfig.cacheTagIdentifier,
@@ -1351,7 +1383,7 @@ async function contentfulArticleRest(context, config, slug, articleTypeSlug, opt
1351
1383
  // src/api/article-type.ts
1352
1384
  init_utils();
1353
1385
  async function contentfulArticleTypeRest(context, config, slug, options) {
1354
- const client = getContentfulClient(config, options?.preview);
1386
+ const client = getContentfulClient(config, options.preview);
1355
1387
  const articleTypeCacheTags = getCacheTags("articleType", slug, options?.preview);
1356
1388
  const customTypeCacheTags = options?.customType ? getCacheTags("customType", options.customType, options?.preview) : [];
1357
1389
  const requestOptions = {
@@ -1459,7 +1491,7 @@ function isBrowserViewable(contentType) {
1459
1491
  return BROWSER_VIEWABLE_TYPES.includes(contentType);
1460
1492
  }
1461
1493
  async function contentfulAssetRest(config, assetId, options) {
1462
- const client = getContentfulClient(config, options?.preview);
1494
+ const client = getContentfulClient(config, options.preview);
1463
1495
  const cacheTags = getCacheTags("asset", assetId, options?.preview);
1464
1496
  return client.getAsset(assetId, {
1465
1497
  ...options,
@@ -2774,7 +2806,7 @@ async function contentfulCustomTypeRest(context, config, slug, options) {
2774
2806
  // src/api/links.ts
2775
2807
  init_utils();
2776
2808
  async function contentfulAllPageLinks(context, config, options) {
2777
- const client = getContentfulClient(config, options?.preview);
2809
+ const client = getContentfulClient(config, options.preview);
2778
2810
  const cacheTags = getCacheTags("page", void 0, options?.preview);
2779
2811
  const requestOptions = {
2780
2812
  ...options,
@@ -2798,7 +2830,7 @@ async function contentfulAllPageLinks(context, config, options) {
2798
2830
  return await fetchFn();
2799
2831
  }
2800
2832
  async function contentfulAllArticleLinks(context, config, options) {
2801
- const client = getContentfulClient(config, options?.preview);
2833
+ const client = getContentfulClient(config, options.preview);
2802
2834
  const cacheTags = getCacheTags("article", void 0, options?.preview);
2803
2835
  const requestOptions = {
2804
2836
  ...options,
@@ -2822,7 +2854,7 @@ async function contentfulAllArticleLinks(context, config, options) {
2822
2854
  return await fetchFn();
2823
2855
  }
2824
2856
  async function contentfulAllTagLinks(context, config, options) {
2825
- const client = getContentfulClient(config, options?.preview);
2857
+ const client = getContentfulClient(config, options.preview);
2826
2858
  const cacheTags = getCacheTags("tag", void 0, options?.preview);
2827
2859
  const requestOptions = {
2828
2860
  ...options,
@@ -2846,7 +2878,7 @@ async function contentfulAllTagLinks(context, config, options) {
2846
2878
  return await fetchFn();
2847
2879
  }
2848
2880
  async function contentfulAllPersonLinks(context, config, options) {
2849
- const client = getContentfulClient(config, options?.preview);
2881
+ const client = getContentfulClient(config, options.preview);
2850
2882
  const cacheTags = getCacheTags("person", void 0, options?.preview);
2851
2883
  const requestOptions = {
2852
2884
  ...options,
@@ -2870,7 +2902,7 @@ async function contentfulAllPersonLinks(context, config, options) {
2870
2902
  return await fetchFn();
2871
2903
  }
2872
2904
  async function contentfulAllArticleTypeLinks(context, config, options) {
2873
- const client = getContentfulClient(config, options?.preview);
2905
+ const client = getContentfulClient(config, options.preview);
2874
2906
  const cacheTags = getCacheTags("articleType", void 0, options?.preview);
2875
2907
  const requestOptions = {
2876
2908
  ...options,
@@ -2914,7 +2946,7 @@ async function contentfulPageRest(context, config, slug, options) {
2914
2946
  // src/api/person.ts
2915
2947
  init_utils();
2916
2948
  async function contentfulPersonRest(context, config, slug, options) {
2917
- const client = getContentfulClient(config, options?.preview);
2949
+ const client = getContentfulClient(config, options.preview);
2918
2950
  const personCacheTags = getCacheTags("person", slug, options?.preview);
2919
2951
  const customTypeCacheTags = options?.customType ? getCacheTags("customType", options.customType, options?.preview) : [];
2920
2952
  const requestOptions = {
@@ -3242,7 +3274,7 @@ function createSitemapProvider(fetcher, sitemapConfig) {
3242
3274
  // src/api/tag.ts
3243
3275
  init_utils();
3244
3276
  async function contentfulTagRest(context, config, slug, options) {
3245
- const client = getContentfulClient(config, options?.preview);
3277
+ const client = getContentfulClient(config, options.preview);
3246
3278
  const tagCacheTags = getCacheTags("tag", slug, options?.preview);
3247
3279
  const customTypeCacheTags = options?.customType ? getCacheTags("customType", options.customType, options?.preview) : [];
3248
3280
  const requestOptions = {
@@ -3598,6 +3630,6 @@ function createRevalidationHandler(config = {}) {
3598
3630
  init_tags();
3599
3631
  init_utils();
3600
3632
 
3601
- export { AllTags, ArticleTag, ArticleTypeTag, AssetTag, AuthenticationError, BannerTag, ContentfulError, CustomTypeTag, EntryNotFoundError, GlobalTag, LocationTag, NavigationTag, PageTag, PersonTag, RateLimitError, RateLimiter, TagTag, TemplateTag, ValidationError, arrayOrUndefined, articleTag, articleTypeIndexTag, articleTypeTag, assetTag, basePageConverter, calculateBackoffDelay, calculatePageHref, calculatePageVariantHref, contentfulAllArticleLinks, contentfulAllArticleTypeLinks, contentfulAllPageLinks, contentfulAllPersonLinks, contentfulAllTagLinks, contentfulArticleRest, contentfulArticleSitemapEntries, contentfulArticleTypeRest, contentfulArticleTypeSitemapEntries, contentfulAssetRest, contentfulCustomTypeRest, contentfulPageRest, contentfulPageSitemapEntries, contentfulPersonRest, contentfulPersonSitemapEntries, contentfulTagRest, contentfulTagSitemapEntries, contentfulTemplateRest, createBaseConverterContext, createContentfulClient, createContentfulPreviewClient, createDownloadHandler, createResponsiveVisual, createRevalidationHandler, createSitemapProvider, customTypeTag, filterRelatedArticles, getAllSitemapEntries, getCacheTags, getCacheTagsForPreview, getCacheTagsForProduction, getContentfulClient, getPreviewEntryInfo, getRetryAfter, isBrowserViewable, isContentfulError, isRateLimitError, isRetryableError, isValidDate, locationTag, lookupAsset, notEmpty, pageTag, personTag, resolveLink, resolveLinks, resolveRichTextDocument, revalidateSingleTag, revalidateTags, safeDate, tagTag, templateTag, withRetry };
3633
+ export { AllTags, ArticleTag, ArticleTypeTag, AssetTag, AuthenticationError, BannerTag, ContentfulError, CustomTypeTag, EntryNotFoundError, GlobalTag, LocationTag, NavigationTag, PageTag, PersonTag, RateLimitError, RateLimiter, TagTag, TemplateTag, ValidationError, arrayOrUndefined, articleTag, articleTypeIndexTag, articleTypeTag, assetTag, basePageConverter, buildFetchOptions, calculateBackoffDelay, calculatePageHref, calculatePageVariantHref, contentfulAllArticleLinks, contentfulAllArticleTypeLinks, contentfulAllPageLinks, contentfulAllPersonLinks, contentfulAllTagLinks, contentfulArticleRest, contentfulArticleSitemapEntries, contentfulArticleTypeRest, contentfulArticleTypeSitemapEntries, contentfulAssetRest, contentfulCustomTypeRest, contentfulPageRest, contentfulPageSitemapEntries, contentfulPersonRest, contentfulPersonSitemapEntries, contentfulTagRest, contentfulTagSitemapEntries, contentfulTemplateRest, createBaseConverterContext, createContentfulClient, createContentfulPreviewClient, createDownloadHandler, createResponsiveVisual, createRevalidationHandler, createSitemapProvider, customTypeTag, filterRelatedArticles, getAllSitemapEntries, getCacheTags, getCacheTagsForPreview, getCacheTagsForProduction, getContentfulClient, getContentfulConfig, getPreviewEntryInfo, getRetryAfter, isBrowserViewable, isContentfulError, isRateLimitError, isRetryableError, isValidDate, locationTag, lookupAsset, notEmpty, pageTag, personTag, resolveLink, resolveLinks, resolveRichTextDocument, revalidateSingleTag, revalidateTags, safeDate, tagTag, templateTag, withRetry };
3602
3634
  //# sourceMappingURL=index.js.map
3603
3635
  //# sourceMappingURL=index.js.map