@scayle/storefront-cms-contentful 1.0.0-alpha.4 → 1.0.0-alpha.6

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @scayle/storefront-cms-contentful
2
2
 
3
+ ## 1.0.0-alpha.6
4
+
5
+ ### Patch Changes
6
+
7
+ **Dependencies**
8
+
9
+ - Updated dependency to @scayle/storefront@1.0.0-alpha.9
10
+
11
+ ## 1.0.0-alpha.5
12
+
13
+ ### Patch Changes
14
+
15
+ **Dependencies**
16
+
17
+ - Updated dependency to @scayle/storefront@1.0.0-alpha.7
18
+
3
19
  ## 1.0.0-alpha.4
4
20
 
5
21
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EntryCollection, EntrySkeletonType } from "contentful";
2
2
  import { CMSCspConfig, CMSEditorData, CMSProviderService } from "@scayle/storefront/cms";
3
- import { IncomingRequest, StorefrontContext } from "@scayle/storefront/types";
3
+ import { IncomingRequest, StorefrontContext } from "@scayle/storefront";
4
4
  /**
5
5
  * Configuration for ContentfulCMSService.
6
6
  */
@@ -33,7 +33,7 @@ interface ContentfulCMSServiceConfig {
33
33
  * }
34
34
  * ```
35
35
  */
36
- declare function isUnconfiguredLocaleError(error: unknown): boolean;
36
+ export declare function isUnconfiguredLocaleError(error: unknown): boolean;
37
37
  /**
38
38
  * Minimal generic default so the package builds and can be used standalone
39
39
  * without your project's generated types. Your project subclass binds
@@ -63,7 +63,7 @@ interface MinimalContentfulPageData {
63
63
  *
64
64
  * @see https://www.contentful.com/developers/docs/references/content-delivery-api/
65
65
  */
66
- declare class ContentfulCMSService<TPageData extends MinimalContentfulPageData = MinimalContentfulPageData> implements CMSProviderService<TPageData> {
66
+ export declare class ContentfulCMSService<TPageData extends MinimalContentfulPageData = MinimalContentfulPageData> implements CMSProviderService<TPageData> {
67
67
  private static deliveryClient;
68
68
  private static previewClient;
69
69
  readonly cspConfig: CMSCspConfig;
@@ -137,6 +137,6 @@ declare class ContentfulCMSService<TPageData extends MinimalContentfulPageData =
137
137
  * Allows the Contentful web app to embed the storefront in an iframe
138
138
  * and connect to the delivery and preview APIs.
139
139
  */
140
- declare const cspConfig: CMSCspConfig;
141
- export { ContentfulCMSService, type MinimalContentfulPageData, cspConfig, isUnconfiguredLocaleError };
140
+ export declare const cspConfig: CMSCspConfig;
141
+ export type { MinimalContentfulPageData };
142
142
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/ContentfulCMSService.ts","../src/csp.ts"],"mappings":";;;;;;UA8BiB;;EAEf;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;;iBA6Bc,0BAA0B;;;;;;;;;;UA0BzB;;EAEf;;EAEA;;;;;;;;;;;;;;;;cAiBW,qBACX,kBAAkB,4BAA4B,sCACnC,mBAAmB;iBACf;iBAEA;WAGN,WAAW;mBAEH;mBACA;mBACA;mBACA;mBACA;EAEjB,YAAY,QAAQ,4BAA4B,SAAS;UA0BjD;UAiBA;UAkBA;EAIR,aAAa,SAAS;EAItB,iBAAiB,SAAS,kBAAkB;UAQ9B;;;;;;;;;EAqCd,cACE,cACA,SAAS,kBACR,QAAQ;UAsBG;;;;;;;;;;EA2Bd,qBACE,oBACA,SAAS,kBACR,QAAQ;;;;;;;;;;YAkDD,eACR,cACA,6BACC;;;;;;;;;;YAsBO,kBACR,cACA,6BACC;UAaW;UAUA;;;;;;;;;;YAsCJ,sBACR,UAAU,gBAAgB,oBAC1B,2BACC;;;;;;;cCraQ,WAAW"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/ContentfulCMSService.ts","../src/csp.ts"],"mappings":";;;;;;UA2BiB;;EAEf;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;;wBA6Bc,0BAA0B;;;;;;;;;;UA0BzB;;EAEf;;EAEA;;;;;;;;;;;;;;;;qBAiBW,qBACX,kBAAkB,4BAA4B,sCACnC,mBAAmB;iBACf;iBAEA;WAGN,WAAW;mBAEH;mBACA;mBACA;mBACA;mBACA;EAEjB,YAAY,QAAQ,4BAA4B,SAAS;UA0BjD;UAiBA;UAkBA;EAIR,aAAa,SAAS;EAItB,iBAAiB,SAAS,kBAAkB;UAQ9B;;;;;;;;;EAqCd,cACE,cACA,SAAS,kBACR,QAAQ;UAsBG;;;;;;;;;;EA2Bd,qBACE,oBACA,SAAS,kBACR,QAAQ;;;;;;;;;;YAkDD,eACR,cACA,6BACC;;;;;;;;;;YAsBO,kBACR,cACA,6BACC;UAaW;UAUA;;;;;;;;;;YAsCJ,sBACR,UAAU,gBAAgB,oBAC1B,2BACC;;;;;;;qBClaQ,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/csp.ts","../src/ContentfulCMSService.ts"],"sourcesContent":["import type { CMSCspConfig } from '@scayle/storefront/cms'\nimport type { IncomingRequest } from '@scayle/storefront/types'\n\n/**\n * Checks whether the request is a Contentful Live Preview session.\n *\n * Contentful injects `_editorMode` into the iframe URL; both editor-mode\n * detection and preview CSP use this same predicate.\n *\n * @param request Inbound request\n * @returns True when `_editorMode` is present on the query string\n */\nexport const isContentfulPreviewRequest = (request: IncomingRequest): boolean =>\n Boolean(request.query._editorMode)\n\n/**\n * CSP configuration for the Contentful provider.\n * Allows the Contentful web app to embed the storefront in an iframe\n * and connect to the delivery and preview APIs.\n */\nexport const cspConfig: CMSCspConfig = {\n directives: {\n // Allows Contentful to embed the storefront in an iframe for live preview.\n // https://www.contentful.com/developers/docs/tutorials/general/live-preview/\n 'frame-ancestors': \"'self' https://app.contentful.com\",\n // Allows Contentful editor scripts and Inertia inline hydration scripts.\n // 'unsafe-inline' is required because Inertia injects inline scripts for\n // SSR page data, and CSP may not include it when no upstream script-src exists.\n 'script-src': \"'self' 'unsafe-inline' https://app.contentful.com\",\n // The @contentful/live-preview SDK creates a Web Worker from a blob URL\n // for processing live update messages. Without worker-src, CSP falls back\n // to script-src which does not allow blob: origins.\n 'worker-src': \"'self' blob:\",\n // Allows the Live Preview SDK to fetch entry data from the Contentful\n // Content Delivery API (cdn) and Content Preview API (preview).\n // https://www.contentful.com/developers/docs/references/content-delivery-api/\n // https://www.contentful.com/developers/docs/references/content-preview-api/\n 'connect-src':\n \"'self' https://cdn.contentful.com https://preview.contentful.com\",\n },\n}\n","import https from 'node:https'\nimport { createClient } from 'contentful'\nimport resolveResponse from 'contentful-resolve-response'\nimport type {\n ContentfulClientApi,\n EntryCollection,\n EntrySkeletonType,\n} from 'contentful'\nimport {\n CMSContentNotFoundError,\n extractErrorStatus,\n wrapClientInit,\n} from '@scayle/storefront/cms'\nimport type {\n CMSCspConfig,\n CMSEditorData,\n CMSProviderService,\n} from '@scayle/storefront/cms'\nimport { createLogger } from '@scayle/storefront/shared'\nimport type {\n IncomingRequest,\n StorefrontContext,\n} from '@scayle/storefront/types'\nimport { cspConfig, isContentfulPreviewRequest } from './csp'\n\nconst log = createLogger('cms')\n\n/**\n * Configuration for ContentfulCMSService.\n */\nexport interface ContentfulCMSServiceConfig {\n /** Contentful delivery access token. */\n accessToken: string\n /** Contentful space ID. */\n space: string\n /** Contentful preview access token for draft content. */\n previewAccessToken: string\n /** Enable draft content access when in editor mode. */\n draftContentEnabled: boolean\n}\n\n/** Cache TTL for published CMS content: 5 minutes. */\nconst CACHE_TTL_SECONDS = 5 * 60\n\ntype ContentfulReadClient =\n | ContentfulClientApi<'WITHOUT_UNRESOLVABLE_LINKS'>\n | ContentfulClientApi<'WITHOUT_LINK_RESOLUTION'>\n\n/**\n * Determines whether a Contentful error indicates an unconfigured locale.\n * Contentful returns a `BadRequest` error with `\"Unknown locale: ...\"` when\n * the requested locale does not exist in the space.\n *\n * @param error Error to inspect\n * @returns true when the error is a locale-related BadRequest\n *\n * @example\n * ```ts\n * try {\n * await client.getEntries({ locale: 'en-DE' })\n * } catch (error) {\n * if (isUnconfiguredLocaleError(error)) {\n * // retry without locale\n * }\n * }\n * ```\n */\nexport function isUnconfiguredLocaleError(error: unknown): boolean {\n if (!error || typeof error !== 'object') {\n return false\n }\n\n if (\n 'name' in error &&\n 'message' in error &&\n error.name === 'BadRequest' &&\n typeof error.message === 'string'\n ) {\n return error.message.includes('Unknown locale')\n }\n\n return false\n}\n\n/**\n * Minimal generic default so the package builds and can be used standalone\n * without your project's generated types. Your project subclass binds\n * `TPageData` to its own generated `CMSPageData` type. All members are\n * optional and there is no index signature: the constraint must admit project\n * payload types that carry none, so excess-property checking stays intact on\n * them, while still rejecting bindings that lack the `{ entry }` envelope\n * {@link ContentfulCMSService.transformPageResponse} actually produces.\n */\nexport interface MinimalContentfulPageData {\n /** The resolved Contentful entry for the requested page. */\n entry?: unknown\n /** Unresolved preview payload, present only for draft content fetches. */\n previewSource?: unknown\n}\n\n/**\n * Contentful CMS provider service.\n * Manages two lazy singleton API clients (delivery and preview).\n *\n * @template TPageData Page payload shape produced by\n * {@link transformPageResponse}. Constrained to `MinimalContentfulPageData`\n * because the service constructs an `{ entry, previewSource? }` envelope, so\n * a binding without that shape could never describe the runtime value. Your\n * project subclass binds this to its own generated types from\n * `src/shared/types/cms/contentful`; the binding cannot move into this\n * package because those types are regenerated per project via `pnpm cms:sync`.\n *\n * @see https://www.contentful.com/developers/docs/references/content-delivery-api/\n */\nexport class ContentfulCMSService<\n TPageData extends MinimalContentfulPageData = MinimalContentfulPageData,\n> implements CMSProviderService<TPageData> {\n private static deliveryClient:\n ContentfulClientApi<'WITHOUT_UNRESOLVABLE_LINKS'> | undefined\n private static previewClient:\n ContentfulClientApi<'WITHOUT_LINK_RESOLUTION'> | undefined\n\n readonly cspConfig: CMSCspConfig = cspConfig\n\n private readonly accessToken: string\n private readonly space: string\n private readonly previewAccessToken: string\n private readonly draftContentEnabled: boolean\n private readonly context: StorefrontContext\n\n constructor(config: ContentfulCMSServiceConfig, context: StorefrontContext) {\n if (!config.accessToken) {\n throw new Error(\n 'Contentful CMS initialization failed: missing or empty access token. Check that CONTENTFUL_CMS_ACCESS_TOKEN is set.',\n )\n }\n\n if (!config.space) {\n throw new Error(\n 'Contentful CMS initialization failed: missing or empty space ID. Check that CONTENTFUL_CMS_SPACE is set.',\n )\n }\n\n if (!config.previewAccessToken) {\n throw new Error(\n 'Contentful CMS initialization failed: missing or empty preview access token. Check that CONTENTFUL_CMS_PREVIEW_ACCESS_TOKEN is set and different from the delivery token (CONTENTFUL_CMS_ACCESS_TOKEN).',\n )\n }\n\n this.accessToken = config.accessToken\n this.space = config.space\n this.previewAccessToken = config.previewAccessToken\n this.draftContentEnabled = config.draftContentEnabled\n this.context = context\n }\n\n private getDeliveryClient(): ContentfulClientApi<'WITHOUT_UNRESOLVABLE_LINKS'> {\n if (ContentfulCMSService.deliveryClient) {\n return ContentfulCMSService.deliveryClient\n }\n\n ContentfulCMSService.deliveryClient = wrapClientInit(\n () =>\n createClient({\n accessToken: this.accessToken,\n space: this.space,\n httpsAgent: new https.Agent({ keepAlive: true }),\n }).withoutUnresolvableLinks,\n 'Contentful delivery client initialization failed. Check that CONTENTFUL_CMS_SPACE is a valid space ID (typically a 20-character alphanumeric string) and CONTENTFUL_CMS_ACCESS_TOKEN has delivery permissions',\n )\n return ContentfulCMSService.deliveryClient\n }\n\n private getPreviewClient(): ContentfulClientApi<'WITHOUT_LINK_RESOLUTION'> {\n if (ContentfulCMSService.previewClient) {\n return ContentfulCMSService.previewClient\n }\n\n ContentfulCMSService.previewClient = wrapClientInit(\n () =>\n createClient({\n accessToken: this.previewAccessToken,\n space: this.space,\n host: 'preview.contentful.com',\n httpsAgent: new https.Agent({ keepAlive: true }),\n }).withoutLinkResolution,\n 'Contentful preview client initialization failed. Check that CONTENTFUL_CMS_SPACE is a valid space ID and CONTENTFUL_CMS_PREVIEW_ACCESS_TOKEN has preview permissions',\n )\n return ContentfulCMSService.previewClient\n }\n\n private getClient(useDraftContent: boolean): ContentfulReadClient {\n return useDraftContent ? this.getPreviewClient() : this.getDeliveryClient()\n }\n\n isEditorMode(request: IncomingRequest): boolean {\n return isContentfulPreviewRequest(request)\n }\n\n getCMSEditorData(request: IncomingRequest): CMSEditorData | undefined {\n if (!this.isEditorMode(request)) {\n return undefined\n }\n\n return {}\n }\n\n private async fetchPage(\n slug: string,\n locale: string,\n useDraftContent: boolean,\n ): Promise<TPageData | undefined> {\n const client = this.getClient(useDraftContent)\n\n try {\n return await this.fetchPageEntries(client, slug, locale, useDraftContent)\n } catch (error) {\n if (isUnconfiguredLocaleError(error)) {\n return this.fetchPageEntries(client, slug, undefined, useDraftContent)\n }\n\n if (extractErrorStatus(error) === 404) {\n throw new CMSContentNotFoundError('Contentful content not found', {\n cause: error,\n details: { slug, locale, contentType: 'PageComponent' },\n })\n }\n\n const message = error instanceof Error ? error.message : String(error)\n throw new Error(\n `Contentful API request failed (slug: \"${slug}\", locale: \"${locale}\", content-type: \"PageComponent\"): ${message}`,\n { cause: error },\n )\n }\n }\n\n /**\n * Retrieves CMS page data with application-level caching.\n * Draft content requests bypass the cache entirely.\n *\n * @param slug CMS slug\n * @param request Inbound request, used to detect editor mode and read editor-specific query params\n * @returns Contentful page data or undefined\n */\n async fetchPageData(\n slug: string,\n request: IncomingRequest,\n ): Promise<TPageData | undefined> {\n const locale = this.context.country.locale\n const useDraftContent =\n this.isEditorMode(request) && this.draftContentEnabled\n\n if (useDraftContent) {\n log.debug({\n message: 'Bypassing CMS cache in preview mode',\n slug,\n locale,\n })\n return this.fetchPage(slug, locale, useDraftContent)\n }\n\n return this.context.cache.getOrSet(\n `cms:contentful:page:${slug}:${locale}`,\n // Cast required: StorageValue excludes undefined, but the fetch can return undefined for missing content\n () => this.fetchPage(slug, locale, useDraftContent) as never,\n CACHE_TTL_SECONDS,\n )\n }\n\n private async fetchListing(\n categoryId: number,\n locale: string,\n useDraftContent: boolean,\n ): Promise<TPageData | undefined> {\n const slug = `c/c-${categoryId}`\n const client = this.getClient(useDraftContent)\n\n try {\n return await this.getListingEntries(client, slug, locale, useDraftContent)\n } catch (error) {\n if (isUnconfiguredLocaleError(error)) {\n return this.getListingEntries(client, slug, undefined, useDraftContent)\n }\n throw error\n }\n }\n\n /**\n * Retrieves CMS content for a product listing page, with caching.\n * Converts a missing entry into `undefined` rather than throwing, since\n * missing PLP content is expected, not an error condition.\n *\n * @param categoryId SCAYLE category ID\n * @param request Inbound request, used to detect editor mode and read editor-specific query params\n * @returns Contentful listing page data or undefined\n */\n async fetchListingPageData(\n categoryId: number,\n request: IncomingRequest,\n ): Promise<TPageData | undefined> {\n const locale = this.context.country.locale\n const useDraftContent =\n this.isEditorMode(request) && this.draftContentEnabled\n\n const fetchListing = async () => {\n try {\n return await this.fetchListing(categoryId, locale, useDraftContent)\n } catch (error) {\n if (error instanceof CMSContentNotFoundError) {\n return undefined\n }\n\n log.error({\n message: 'Failed to fetch CMS listing page data',\n err: error instanceof Error ? error : new Error(String(error)),\n categoryId,\n locale,\n })\n\n throw error\n }\n }\n\n if (useDraftContent) {\n log.debug({\n message: 'Bypassing CMS PLP cache in preview mode',\n categoryId,\n locale,\n })\n return fetchListing()\n }\n\n return this.context.cache.getOrSet(\n `cms:contentful:plp:${categoryId}:${locale}`,\n // Cast required: StorageValue excludes undefined, but the fetch can return undefined for missing content\n () => fetchListing() as never,\n CACHE_TTL_SECONDS,\n )\n }\n\n /**\n * Builds the Contentful `getEntries` query for a page lookup.\n * Override to query a different content type or field name than the\n * default `PageComponent` / `fields.slug[match]` shape.\n *\n * @param slug Page slug\n * @param locale Storefront locale code, or undefined on the no-locale retry\n * @returns Query object passed to `client.getEntries(...)`\n */\n protected buildPageQuery(\n slug: string,\n locale: string | undefined,\n ): Record<string, unknown> {\n const query: Record<string, unknown> = {\n content_type: 'PageComponent',\n 'fields.slug[match]': slug,\n include: 10,\n limit: 1,\n }\n if (locale) {\n query.locale = locale\n }\n return query\n }\n\n /**\n * Builds the Contentful `getEntries` query for a listing-page lookup.\n * Override to query a different content type or field name than the\n * default `productListingPageComponent` / `fields.slug[match]` shape.\n *\n * @param slug Synthetic `c/c-{categoryId}` slug\n * @param locale Storefront locale code, or undefined on the no-locale retry\n * @returns Query object passed to `client.getEntries(...)`\n */\n protected buildListingQuery(\n slug: string,\n locale: string | undefined,\n ): Record<string, unknown> {\n const query: Record<string, unknown> = {\n content_type: 'productListingPageComponent',\n 'fields.slug[match]': slug,\n include: 10,\n limit: 1,\n }\n if (locale) {\n query.locale = locale\n }\n return query\n }\n\n private async fetchPageEntries(\n client: ContentfulReadClient,\n slug: string,\n locale: string | undefined,\n useDraftContent: boolean,\n ): Promise<TPageData | undefined> {\n const response = await client.getEntries(this.buildPageQuery(slug, locale))\n return this.transformPageResponse(response, useDraftContent)\n }\n\n private async getListingEntries(\n client: ContentfulReadClient,\n slug: string,\n locale: string | undefined,\n useDraftContent: boolean,\n ): Promise<TPageData | undefined> {\n try {\n const response = await client.getEntries(\n this.buildListingQuery(slug, locale),\n )\n return this.transformPageResponse(response, useDraftContent)\n } catch (error) {\n if (extractErrorStatus(error) === 404) {\n throw new CMSContentNotFoundError(\n 'Contentful listing content not found',\n {\n cause: error,\n details: {\n slug,\n locale,\n contentType: 'productListingPageComponent',\n },\n },\n )\n }\n throw error\n }\n }\n\n /**\n * Transforms a Contentful entry collection into the page payload.\n * Override to change what shape `fetchPageData`/`fetchListingPageData` return,\n * for example to keep additional response fields.\n *\n * @param response Raw Contentful entry collection\n * @param useDraftContent Whether this is a draft content fetch\n * @returns Page payload, or undefined when the collection has no entries\n */\n protected transformPageResponse(\n response: EntryCollection<EntrySkeletonType>,\n useDraftContent: boolean,\n ): TPageData | undefined {\n const entry = response.items.at(0)\n if (!entry) {\n return undefined\n }\n if (!useDraftContent) {\n return { entry } as TPageData\n }\n\n const [resolvedEntry] = resolveResponse({\n items: response.items,\n includes: response.includes,\n })\n\n return {\n entry: resolvedEntry ?? entry,\n previewSource: { entry, includes: response.includes },\n } as TPageData\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;CAoBA,IA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CAAA;GAIA,MAAI;EACF;CACA;CAEA,sBAAA,UAAA,iBAAA;EACF,MAAC,QAAA,SAAA,MAAA,GAAA,CAAA;EAED,IAAA,CAAA,OAAM;EACR,IAAA,CAAA,iBAAA,OAAA,EAAA,MAAA;EACF,MAAA,CAAA,iBAAA,gBAAA;GAEA,OAAI,SAAA;GACF,UAAU,SAAA;EACR,CAAA;EACA,OAAA;GACA,OAAA,iBAAA;GACF,eAAC;IACD;IACF,UAAA,SAAA;GAEA;EAMF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/csp.ts","../src/ContentfulCMSService.ts"],"sourcesContent":["import type { CMSCspConfig } from '@scayle/storefront/cms'\nimport type { IncomingRequest } from '@scayle/storefront'\n\n/**\n * Checks whether the request is a Contentful Live Preview session.\n *\n * Contentful injects `_editorMode` into the iframe URL; both editor-mode\n * detection and preview CSP use this same predicate.\n *\n * @param request Inbound request\n * @returns True when `_editorMode` is present on the query string\n */\nexport const isContentfulPreviewRequest = (request: IncomingRequest): boolean =>\n Boolean(request.query._editorMode)\n\n/**\n * CSP configuration for the Contentful provider.\n * Allows the Contentful web app to embed the storefront in an iframe\n * and connect to the delivery and preview APIs.\n */\nexport const cspConfig: CMSCspConfig = {\n directives: {\n // Allows Contentful to embed the storefront in an iframe for live preview.\n // https://www.contentful.com/developers/docs/tutorials/general/live-preview/\n 'frame-ancestors': \"'self' https://app.contentful.com\",\n // Allows Contentful editor scripts and Inertia inline hydration scripts.\n // 'unsafe-inline' is required because Inertia injects inline scripts for\n // SSR page data, and CSP may not include it when no upstream script-src exists.\n 'script-src': \"'self' 'unsafe-inline' https://app.contentful.com\",\n // The @contentful/live-preview SDK creates a Web Worker from a blob URL\n // for processing live update messages. Without worker-src, CSP falls back\n // to script-src which does not allow blob: origins.\n 'worker-src': \"'self' blob:\",\n // Allows the Live Preview SDK to fetch entry data from the Contentful\n // Content Delivery API (cdn) and Content Preview API (preview).\n // https://www.contentful.com/developers/docs/references/content-delivery-api/\n // https://www.contentful.com/developers/docs/references/content-preview-api/\n 'connect-src':\n \"'self' https://cdn.contentful.com https://preview.contentful.com\",\n },\n}\n","import https from 'node:https'\nimport { createClient } from 'contentful'\nimport resolveResponse from 'contentful-resolve-response'\nimport type {\n ContentfulClientApi,\n EntryCollection,\n EntrySkeletonType,\n} from 'contentful'\nimport {\n CMSContentNotFoundError,\n extractErrorStatus,\n wrapClientInit,\n} from '@scayle/storefront/cms'\nimport type {\n CMSCspConfig,\n CMSEditorData,\n CMSProviderService,\n} from '@scayle/storefront/cms'\nimport { createLogger } from '@scayle/storefront/shared'\nimport type { IncomingRequest, StorefrontContext } from '@scayle/storefront'\nimport { cspConfig, isContentfulPreviewRequest } from './csp'\n\nconst log = createLogger('cms')\n\n/**\n * Configuration for ContentfulCMSService.\n */\nexport interface ContentfulCMSServiceConfig {\n /** Contentful delivery access token. */\n accessToken: string\n /** Contentful space ID. */\n space: string\n /** Contentful preview access token for draft content. */\n previewAccessToken: string\n /** Enable draft content access when in editor mode. */\n draftContentEnabled: boolean\n}\n\n/** Cache TTL for published CMS content: 5 minutes. */\nconst CACHE_TTL_SECONDS = 5 * 60\n\ntype ContentfulReadClient =\n | ContentfulClientApi<'WITHOUT_UNRESOLVABLE_LINKS'>\n | ContentfulClientApi<'WITHOUT_LINK_RESOLUTION'>\n\n/**\n * Determines whether a Contentful error indicates an unconfigured locale.\n * Contentful returns a `BadRequest` error with `\"Unknown locale: ...\"` when\n * the requested locale does not exist in the space.\n *\n * @param error Error to inspect\n * @returns true when the error is a locale-related BadRequest\n *\n * @example\n * ```ts\n * try {\n * await client.getEntries({ locale: 'en-DE' })\n * } catch (error) {\n * if (isUnconfiguredLocaleError(error)) {\n * // retry without locale\n * }\n * }\n * ```\n */\nexport function isUnconfiguredLocaleError(error: unknown): boolean {\n if (!error || typeof error !== 'object') {\n return false\n }\n\n if (\n 'name' in error &&\n 'message' in error &&\n error.name === 'BadRequest' &&\n typeof error.message === 'string'\n ) {\n return error.message.includes('Unknown locale')\n }\n\n return false\n}\n\n/**\n * Minimal generic default so the package builds and can be used standalone\n * without your project's generated types. Your project subclass binds\n * `TPageData` to its own generated `CMSPageData` type. All members are\n * optional and there is no index signature: the constraint must admit project\n * payload types that carry none, so excess-property checking stays intact on\n * them, while still rejecting bindings that lack the `{ entry }` envelope\n * {@link ContentfulCMSService.transformPageResponse} actually produces.\n */\nexport interface MinimalContentfulPageData {\n /** The resolved Contentful entry for the requested page. */\n entry?: unknown\n /** Unresolved preview payload, present only for draft content fetches. */\n previewSource?: unknown\n}\n\n/**\n * Contentful CMS provider service.\n * Manages two lazy singleton API clients (delivery and preview).\n *\n * @template TPageData Page payload shape produced by\n * {@link transformPageResponse}. Constrained to `MinimalContentfulPageData`\n * because the service constructs an `{ entry, previewSource? }` envelope, so\n * a binding without that shape could never describe the runtime value. Your\n * project subclass binds this to its own generated types from\n * `src/shared/types/cms/contentful`; the binding cannot move into this\n * package because those types are regenerated per project via `pnpm cms:sync`.\n *\n * @see https://www.contentful.com/developers/docs/references/content-delivery-api/\n */\nexport class ContentfulCMSService<\n TPageData extends MinimalContentfulPageData = MinimalContentfulPageData,\n> implements CMSProviderService<TPageData> {\n private static deliveryClient:\n ContentfulClientApi<'WITHOUT_UNRESOLVABLE_LINKS'> | undefined\n private static previewClient:\n ContentfulClientApi<'WITHOUT_LINK_RESOLUTION'> | undefined\n\n readonly cspConfig: CMSCspConfig = cspConfig\n\n private readonly accessToken: string\n private readonly space: string\n private readonly previewAccessToken: string\n private readonly draftContentEnabled: boolean\n private readonly context: StorefrontContext\n\n constructor(config: ContentfulCMSServiceConfig, context: StorefrontContext) {\n if (!config.accessToken) {\n throw new Error(\n 'Contentful CMS initialization failed: missing or empty access token. Check that CONTENTFUL_CMS_ACCESS_TOKEN is set.',\n )\n }\n\n if (!config.space) {\n throw new Error(\n 'Contentful CMS initialization failed: missing or empty space ID. Check that CONTENTFUL_CMS_SPACE is set.',\n )\n }\n\n if (!config.previewAccessToken) {\n throw new Error(\n 'Contentful CMS initialization failed: missing or empty preview access token. Check that CONTENTFUL_CMS_PREVIEW_ACCESS_TOKEN is set and different from the delivery token (CONTENTFUL_CMS_ACCESS_TOKEN).',\n )\n }\n\n this.accessToken = config.accessToken\n this.space = config.space\n this.previewAccessToken = config.previewAccessToken\n this.draftContentEnabled = config.draftContentEnabled\n this.context = context\n }\n\n private getDeliveryClient(): ContentfulClientApi<'WITHOUT_UNRESOLVABLE_LINKS'> {\n if (ContentfulCMSService.deliveryClient) {\n return ContentfulCMSService.deliveryClient\n }\n\n ContentfulCMSService.deliveryClient = wrapClientInit(\n () =>\n createClient({\n accessToken: this.accessToken,\n space: this.space,\n httpsAgent: new https.Agent({ keepAlive: true }),\n }).withoutUnresolvableLinks,\n 'Contentful delivery client initialization failed. Check that CONTENTFUL_CMS_SPACE is a valid space ID (typically a 20-character alphanumeric string) and CONTENTFUL_CMS_ACCESS_TOKEN has delivery permissions',\n )\n return ContentfulCMSService.deliveryClient\n }\n\n private getPreviewClient(): ContentfulClientApi<'WITHOUT_LINK_RESOLUTION'> {\n if (ContentfulCMSService.previewClient) {\n return ContentfulCMSService.previewClient\n }\n\n ContentfulCMSService.previewClient = wrapClientInit(\n () =>\n createClient({\n accessToken: this.previewAccessToken,\n space: this.space,\n host: 'preview.contentful.com',\n httpsAgent: new https.Agent({ keepAlive: true }),\n }).withoutLinkResolution,\n 'Contentful preview client initialization failed. Check that CONTENTFUL_CMS_SPACE is a valid space ID and CONTENTFUL_CMS_PREVIEW_ACCESS_TOKEN has preview permissions',\n )\n return ContentfulCMSService.previewClient\n }\n\n private getClient(useDraftContent: boolean): ContentfulReadClient {\n return useDraftContent ? this.getPreviewClient() : this.getDeliveryClient()\n }\n\n isEditorMode(request: IncomingRequest): boolean {\n return isContentfulPreviewRequest(request)\n }\n\n getCMSEditorData(request: IncomingRequest): CMSEditorData | undefined {\n if (!this.isEditorMode(request)) {\n return undefined\n }\n\n return {}\n }\n\n private async fetchPage(\n slug: string,\n locale: string,\n useDraftContent: boolean,\n ): Promise<TPageData | undefined> {\n const client = this.getClient(useDraftContent)\n\n try {\n return await this.fetchPageEntries(client, slug, locale, useDraftContent)\n } catch (error) {\n if (isUnconfiguredLocaleError(error)) {\n return this.fetchPageEntries(client, slug, undefined, useDraftContent)\n }\n\n if (extractErrorStatus(error) === 404) {\n throw new CMSContentNotFoundError('Contentful content not found', {\n cause: error,\n details: { slug, locale, contentType: 'PageComponent' },\n })\n }\n\n const message = error instanceof Error ? error.message : String(error)\n throw new Error(\n `Contentful API request failed (slug: \"${slug}\", locale: \"${locale}\", content-type: \"PageComponent\"): ${message}`,\n { cause: error },\n )\n }\n }\n\n /**\n * Retrieves CMS page data with application-level caching.\n * Draft content requests bypass the cache entirely.\n *\n * @param slug CMS slug\n * @param request Inbound request, used to detect editor mode and read editor-specific query params\n * @returns Contentful page data or undefined\n */\n async fetchPageData(\n slug: string,\n request: IncomingRequest,\n ): Promise<TPageData | undefined> {\n const locale = this.context.country.locale\n const useDraftContent =\n this.isEditorMode(request) && this.draftContentEnabled\n\n if (useDraftContent) {\n log.debug({\n message: 'Bypassing CMS cache in preview mode',\n slug,\n locale,\n })\n return this.fetchPage(slug, locale, useDraftContent)\n }\n\n return this.context.cache.getOrSet(\n `cms:contentful:page:${slug}:${locale}`,\n // Cast required: StorageValue excludes undefined, but the fetch can return undefined for missing content\n () => this.fetchPage(slug, locale, useDraftContent) as never,\n CACHE_TTL_SECONDS,\n )\n }\n\n private async fetchListing(\n categoryId: number,\n locale: string,\n useDraftContent: boolean,\n ): Promise<TPageData | undefined> {\n const slug = `c/c-${categoryId}`\n const client = this.getClient(useDraftContent)\n\n try {\n return await this.getListingEntries(client, slug, locale, useDraftContent)\n } catch (error) {\n if (isUnconfiguredLocaleError(error)) {\n return this.getListingEntries(client, slug, undefined, useDraftContent)\n }\n throw error\n }\n }\n\n /**\n * Retrieves CMS content for a product listing page, with caching.\n * Converts a missing entry into `undefined` rather than throwing, since\n * missing PLP content is expected, not an error condition.\n *\n * @param categoryId SCAYLE category ID\n * @param request Inbound request, used to detect editor mode and read editor-specific query params\n * @returns Contentful listing page data or undefined\n */\n async fetchListingPageData(\n categoryId: number,\n request: IncomingRequest,\n ): Promise<TPageData | undefined> {\n const locale = this.context.country.locale\n const useDraftContent =\n this.isEditorMode(request) && this.draftContentEnabled\n\n const fetchListing = async () => {\n try {\n return await this.fetchListing(categoryId, locale, useDraftContent)\n } catch (error) {\n if (error instanceof CMSContentNotFoundError) {\n return undefined\n }\n\n log.error({\n message: 'Failed to fetch CMS listing page data',\n err: error instanceof Error ? error : new Error(String(error)),\n categoryId,\n locale,\n })\n\n throw error\n }\n }\n\n if (useDraftContent) {\n log.debug({\n message: 'Bypassing CMS PLP cache in preview mode',\n categoryId,\n locale,\n })\n return fetchListing()\n }\n\n return this.context.cache.getOrSet(\n `cms:contentful:plp:${categoryId}:${locale}`,\n // Cast required: StorageValue excludes undefined, but the fetch can return undefined for missing content\n () => fetchListing() as never,\n CACHE_TTL_SECONDS,\n )\n }\n\n /**\n * Builds the Contentful `getEntries` query for a page lookup.\n * Override to query a different content type or field name than the\n * default `PageComponent` / `fields.slug[match]` shape.\n *\n * @param slug Page slug\n * @param locale Storefront locale code, or undefined on the no-locale retry\n * @returns Query object passed to `client.getEntries(...)`\n */\n protected buildPageQuery(\n slug: string,\n locale: string | undefined,\n ): Record<string, unknown> {\n const query: Record<string, unknown> = {\n content_type: 'PageComponent',\n 'fields.slug[match]': slug,\n include: 10,\n limit: 1,\n }\n if (locale) {\n query.locale = locale\n }\n return query\n }\n\n /**\n * Builds the Contentful `getEntries` query for a listing-page lookup.\n * Override to query a different content type or field name than the\n * default `productListingPageComponent` / `fields.slug[match]` shape.\n *\n * @param slug Synthetic `c/c-{categoryId}` slug\n * @param locale Storefront locale code, or undefined on the no-locale retry\n * @returns Query object passed to `client.getEntries(...)`\n */\n protected buildListingQuery(\n slug: string,\n locale: string | undefined,\n ): Record<string, unknown> {\n const query: Record<string, unknown> = {\n content_type: 'productListingPageComponent',\n 'fields.slug[match]': slug,\n include: 10,\n limit: 1,\n }\n if (locale) {\n query.locale = locale\n }\n return query\n }\n\n private async fetchPageEntries(\n client: ContentfulReadClient,\n slug: string,\n locale: string | undefined,\n useDraftContent: boolean,\n ): Promise<TPageData | undefined> {\n const response = await client.getEntries(this.buildPageQuery(slug, locale))\n return this.transformPageResponse(response, useDraftContent)\n }\n\n private async getListingEntries(\n client: ContentfulReadClient,\n slug: string,\n locale: string | undefined,\n useDraftContent: boolean,\n ): Promise<TPageData | undefined> {\n try {\n const response = await client.getEntries(\n this.buildListingQuery(slug, locale),\n )\n return this.transformPageResponse(response, useDraftContent)\n } catch (error) {\n if (extractErrorStatus(error) === 404) {\n throw new CMSContentNotFoundError(\n 'Contentful listing content not found',\n {\n cause: error,\n details: {\n slug,\n locale,\n contentType: 'productListingPageComponent',\n },\n },\n )\n }\n throw error\n }\n }\n\n /**\n * Transforms a Contentful entry collection into the page payload.\n * Override to change what shape `fetchPageData`/`fetchListingPageData` return,\n * for example to keep additional response fields.\n *\n * @param response Raw Contentful entry collection\n * @param useDraftContent Whether this is a draft content fetch\n * @returns Page payload, or undefined when the collection has no entries\n */\n protected transformPageResponse(\n response: EntryCollection<EntrySkeletonType>,\n useDraftContent: boolean,\n ): TPageData | undefined {\n const entry = response.items.at(0)\n if (!entry) {\n return undefined\n }\n if (!useDraftContent) {\n return { entry } as TPageData\n }\n\n const [resolvedEntry] = resolveResponse({\n items: response.items,\n includes: response.includes,\n })\n\n return {\n entry: resolvedEntry ?? entry,\n previewSource: { entry, includes: response.includes },\n } as TPageData\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;CAoBA,IAAA,CAAa,SAAA,OACX,UAAY,UAAA,OAAA;CAGV,IAAA,UAAA,SAAmB,aAAA,SAAA,MAAA,SAAA,gBAAA,OAAA,MAAA,YAAA,UAAA,OAAA,MAAA,QAAA,SAAA,gBAAA;CAInB,OAAA;AAIA;AAOF,IACF,uBAAA,MAAA,qBAAA;;CClBA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AA;GACF,UAAU,SAAA;EACR,CAAA;EACA,OAAA;GACA,OAAA,iBAAA;GACF,eAAC;IACD;IACF,UAAA,SAAA;GAEA;EAMF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-cms-contentful",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "Contentful CMS provider integration for the SCAYLE Storefront Application V3",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -22,25 +22,25 @@
22
22
  "node": ">= 24.0.0"
23
23
  },
24
24
  "peerDependencies": {
25
- "@scayle/storefront": "1.0.0-alpha.6",
25
+ "@scayle/storefront": "1.0.0-alpha.9",
26
26
  "contentful": "^11.12.7",
27
27
  "contentful-resolve-response": "^2.0.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@arethetypeswrong/cli": "0.18.5",
31
- "@scayle/eslint-config-storefront": "5.1.1",
32
- "@scayle/storefront": "1.0.0-alpha.6",
31
+ "@scayle/eslint-config-storefront": "5.2.0",
32
+ "@scayle/storefront": "1.0.0-alpha.9",
33
33
  "@scayle/vitest-config-storefront": "1.0.0",
34
34
  "contentful": "^11.12.7",
35
35
  "contentful-resolve-response": "^2.0.1",
36
36
  "@types/node": "^24",
37
- "@vitest/coverage-v8": "4.1.11",
38
- "eslint": "10.9.1",
37
+ "@vitest/coverage-v8": "5.0.1",
38
+ "eslint": "10.11.0",
39
39
  "eslint-formatter-gitlab": "7.2.0",
40
40
  "publint": "0.3.24",
41
41
  "typescript": "6.0.3",
42
- "obuild": "0.4.38",
43
- "vitest": "4.1.11"
42
+ "obuild": "0.4.40",
43
+ "vitest": "5.0.1"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "obuild",