From 5e1e23b8aa96f6cf0f15c2d2c70e532a03d73059 Mon Sep 17 00:00:00 2001 From: z0al <12673605+z0al@users.noreply.github.com> Date: Sun, 16 Nov 2025 14:35:24 +0000 Subject: [PATCH 1/2] feat(timeline): move Timeline Preview out of alpha --- README.md | 20 ++++++++++---------- lib/contentful.ts | 13 ++++++++++++- lib/utils/timeline-preview-helpers.ts | 3 ++- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 501656758..d121915c2 100644 --- a/README.md +++ b/README.md @@ -70,15 +70,17 @@ JavaScript library for the Contentful [Content Delivery API](https://www.content - [Authentication](#authentication) - [Documentation \& References](#documentation--references) - [Configuration](#configuration) - - [Request configuration options](#request-configuration-options) - - [Response configuration options](#response-configuration-options) + - [Request configuration options](#request-configuration-options) + - [Response configuration options](#response-configuration-options) + - [Timeline Preview](#timeline-preview) + - [Example](#example) - [Client chain modifiers](#client-chain-modifiers) - [Entries](#entries) - - [Example](#example) - - [Assets](#assets) - [Example](#example-1) - - [Sync](#sync) + - [Assets](#assets) - [Example](#example-2) + - [Sync](#sync) + - [Example](#example-3) - [Reference documentation](#reference-documentation) - [Tutorials \& other resources](#tutorials--other-resources) - [Troubleshooting](#troubleshooting) @@ -292,11 +294,9 @@ const client = contentful.createClient({ accessToken: 'preview_0b7f6x59a0', host: 'preview.contentful.com', // either release or timestamp or both can be passed as a valid config - alphaFeatures: { - timelinePreview: { - release: { lte: 'black-friday' }, - timestamp: { lte: '2025-11-29T08:46:15Z' }, - }, + timelinePreview: { + release: { lte: 'black-friday' }, + timestamp: { lte: '2025-11-29T08:46:15Z' }, }, }) ``` diff --git a/lib/contentful.ts b/lib/contentful.ts index e7820098e..d41bc0a43 100644 --- a/lib/contentful.ts +++ b/lib/contentful.ts @@ -121,6 +121,14 @@ export interface CreateClientParams { */ includeContentSourceMaps?: boolean + /** + * Enable Timeline Preview. + * + * @remarks + * This feature is only available when using the Content Preview API. + */ + timelinePreview?: TimelinePreview + /** * Enable alpha features. */ @@ -132,8 +140,11 @@ export interface CreateClientParams { /** * Enable Timeline Preview. + * * @remarks - * This feature is only available in private beta when using the Content Preview API. + * This feature is only available when using the Content Preview API. + * + * @deprecated Use the `timelinePreview` option directly instead. */ timelinePreview?: TimelinePreview } diff --git a/lib/utils/timeline-preview-helpers.ts b/lib/utils/timeline-preview-helpers.ts index db837bf73..a9e412182 100644 --- a/lib/utils/timeline-preview-helpers.ts +++ b/lib/utils/timeline-preview-helpers.ts @@ -42,7 +42,8 @@ export const isValidTimelinePreviewConfig = (timelinePreview: TimelinePreview) = export const getTimelinePreviewParams = (params: CreateClientParams) => { const host = params?.host as string - const timelinePreview = params?.alphaFeatures?.timelinePreview as TimelinePreview + const timelinePreview = + params?.timelinePreview ?? (params?.alphaFeatures?.timelinePreview as TimelinePreview) const enabled = checkEnableTimelinePreviewIsAllowed(host, timelinePreview) return { enabled, timelinePreview } } From c53ae3a1cc9af1e49be67968e1712d4a1da3e986 Mon Sep 17 00:00:00 2001 From: z0al <12673605+z0al@users.noreply.github.com> Date: Sun, 16 Nov 2025 14:37:51 +0000 Subject: [PATCH 2/2] chore: update tests --- test/integration/getEntry.test.ts | 5 ++--- test/unit/timeline-preview.test.ts | 9 ++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/integration/getEntry.test.ts b/test/integration/getEntry.test.ts index 2b42f96cb..3fd041653 100644 --- a/test/integration/getEntry.test.ts +++ b/test/integration/getEntry.test.ts @@ -357,9 +357,8 @@ test('Gets entry with attached metadata and field called "metadata" on preview', test('can make calls to TimelinePreview API on preview', async () => { const timelinePreviewClient = contentful.createClient({ ...previewParamsWithCSM, - alphaFeatures: { - timelinePreview: { release: { lte: 'black-friday' } }, - }, + + timelinePreview: { release: { lte: 'black-friday' } }, }) const entryWithMetadataFieldAndMetadata = '1NnAC4eF9IRMpHtFB1NleW' diff --git a/test/unit/timeline-preview.test.ts b/test/unit/timeline-preview.test.ts index 6d4955762..c9d200f5a 100644 --- a/test/unit/timeline-preview.test.ts +++ b/test/unit/timeline-preview.test.ts @@ -9,11 +9,10 @@ describe('Timeline Preview path and query', () => { get: mockGet, httpClientParams: { host: 'preview.contentful.com', - alphaFeatures: { - timelinePreview: { - release: { lte: 'black-friday' }, - timestamp: { lte: '2023-11-30T23:59:59Z' }, - }, + + timelinePreview: { + release: { lte: 'black-friday' }, + timestamp: { lte: '2023-11-30T23:59:59Z' }, }, }, } as unknown as AxiosInstance