@scayle/storefront-cms-storyblok 1.0.0-alpha.3 → 1.0.0-alpha.4

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,17 @@
1
1
  # @scayle/storefront-cms-storyblok
2
2
 
3
+ ## 1.0.0-alpha.4
4
+
5
+ ### Minor Changes
6
+
7
+ - `ContentfulCMSService`, `ContentstackCMSService`, and `AmplienceCMSService` now take a `TPageData` type parameter and return it from `fetchPageData` and `fetchListingPageData` — the same binding `StoryblokCMSService` already offered. Contentful and Contentstack constrain and default `TPageData` to a new exported minimal envelope shape (`MinimalContentfulPageData` with `{ entry?, previewSource? }`, `MinimalContentstackPageData` with `{ entry? }`), matching what the services construct, so a binding that could never describe the runtime value is rejected; Amplience returns the raw content item, so it stays `TPageData extends object` defaulting to `CMSPagePayload`. Your project subclass binds `TPageData` to its own generated content types (`src/shared/types/cms/<provider>/`), which cannot ship inside these packages because they are regenerated per project via `pnpm cms:sync`. `StoryblokCMSService` additionally declares `implements CMSProviderService<TPageData>` and types `getAlternatePaths` with `TPageData` instead of `CMSPagePayload`. `MinimalStoryblokPageData` no longer extends `Record<string, unknown>` — the constraint must admit payload types without an index signature so excess-property checking stays intact on them — so a payload on the default generic is no longer indexable by arbitrary keys, and its `alternates` entries now carry `full_slug` (what slug resolution actually reads) instead of `slug`.
8
+
9
+ ### Patch Changes
10
+
11
+ **Dependencies**
12
+
13
+ - Updated dependency to @scayle/storefront@1.0.0-alpha.6
14
+
3
15
  ## 1.0.0-alpha.3
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -38,10 +38,10 @@ service:
38
38
 
39
39
  ```ts
40
40
  import { StoryblokCMSService } from '@scayle/storefront-cms-storyblok'
41
- import type { StoryblokPageData } from '@shared/types/cms/storyblok'
41
+ import type { CMSPageData } from '@shared/types/cms/storyblok'
42
42
 
43
43
  export const createCMSService = (storefront: StorefrontContext) =>
44
- new StoryblokCMSService<StoryblokPageData>(
44
+ new StoryblokCMSService<CMSPageData>(
45
45
  {
46
46
  accessToken: getRequiredEnv('STORYBLOK_CMS_ACCESS_TOKEN'),
47
47
  draftContentEnabled:
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { CMSCspConfig, CMSEditorData, CMSPagePayload, CMSProviderService } from "@scayle/storefront/cms";
1
+ import { CMSCspConfig, CMSEditorData, CMSProviderService } from "@scayle/storefront/cms";
2
2
  import { IncomingRequest, StorefrontContext } from "@scayle/storefront/types";
3
3
  /**
4
4
  * Configuration for the Storyblok CMS service.
@@ -14,9 +14,11 @@ interface StoryblokCMSServiceConfig {
14
14
  /**
15
15
  * Minimal generic default so the package builds and can be used standalone
16
16
  * without your project's generated types. Your project subclass binds `TPageData` to
17
- * its own generated `StoryblokPageData` type.
17
+ * its own generated `CMSPageData` type. No index signature: the constraint
18
+ * must admit project payload types that carry none, so excess-property
19
+ * checking stays intact on them.
18
20
  */
19
- interface MinimalStoryblokPageData extends Record<string, unknown> {
21
+ interface MinimalStoryblokPageData {
20
22
  story?: {
21
23
  content?: {
22
24
  component?: string;
@@ -24,7 +26,7 @@ interface MinimalStoryblokPageData extends Record<string, unknown> {
24
26
  };
25
27
  alternates?: {
26
28
  id: number;
27
- slug: string;
29
+ full_slug?: string;
28
30
  published: boolean;
29
31
  }[];
30
32
  full_slug?: string;
@@ -45,7 +47,7 @@ interface MinimalStoryblokPageData extends Record<string, unknown> {
45
47
  *
46
48
  * @see https://www.storyblok.com/docs/packages/storyblok-js
47
49
  */
48
- declare class StoryblokCMSService<TPageData extends MinimalStoryblokPageData = MinimalStoryblokPageData> implements CMSProviderService {
50
+ declare class StoryblokCMSService<TPageData extends MinimalStoryblokPageData = MinimalStoryblokPageData> implements CMSProviderService<TPageData> {
49
51
  /** Shared across all instances so the API client is created once, not per request. */
50
52
  private static client;
51
53
  readonly cspConfig: CMSCspConfig;
@@ -108,7 +110,7 @@ declare class StoryblokCMSService<TPageData extends MinimalStoryblokPageData = M
108
110
  * @param data CMS page payload containing a Storyblok story.
109
111
  * @returns Per-locale page path map, or undefined.
110
112
  */
111
- getAlternatePaths(data: CMSPagePayload): Record<string, string> | undefined;
113
+ getAlternatePaths(data: TPageData): Record<string, string> | undefined;
112
114
  }
113
115
  /**
114
116
  * CSP configuration for the Storyblok provider.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/StoryblokCMSService.ts","../src/csp.ts"],"mappings":";;;;;UAqCiB;;EAEf;;EAEA;;EAEA,gBAAgB;;;;;;;UAQD,iCAAiC;EAChD;IACE;MAAY;;;IACZ;MAAe;MAAY;MAAc;;IACzC;;;;;;;;;;;;;;;;;;cAmBS,oBACX,kBAAkB,2BAA2B,qCAClC;;iBAEI;WAEN,WAAW;mBAEH;mBACA;mBACA;mBACA;EAEjB,YAAY,QAAQ,2BAA2B,SAAS;UAOhD;EA8BR,aAAa,SAAS;EAItB,iBAAiB,SAAS,kBAAkB;;;;;;;;;;YAiBlC,gBACR,0BACA,SAAS,kBACR;;;;;;;;;;YAoBO,uBAAuB;IAC/B;MAAS;;MACP;UAQU;;;;;;;;;EAwCd,cACE,cACA,SAAS,kBACR,QAAQ;;;;;;;;;;EAgCX,qBACE,oBACA,SAAS,kBACR,QAAQ;;;;;;;;EAsDX,kBAAkB,MAAM,iBAAiB;;;;;;;cClS9B,WAAW"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/StoryblokCMSService.ts","../src/csp.ts"],"mappings":";;;;;UAoCiB;;EAEf;;EAEA;;EAEA,gBAAgB;;;;;;;;;UAUD;EACf;IACE;MAAY;;;IACZ;MAAe;MAAY;MAAoB;;IAC/C;;;;;;;;;;;;;;;;;;cAmBS,oBACX,kBAAkB,2BAA2B,qCAClC,mBAAmB;;iBAEf;WAEN,WAAW;mBAEH;mBACA;mBACA;mBACA;EAEjB,YAAY,QAAQ,2BAA2B,SAAS;UAOhD;EA8BR,aAAa,SAAS;EAItB,iBAAiB,SAAS,kBAAkB;;;;;;;;;;YAiBlC,gBACR,0BACA,SAAS,kBACR;;;;;;;;;;YAoBO,uBAAuB;IAC/B;MAAS;;MACP;UAQU;;;;;;;;;EAwCd,cACE,cACA,SAAS,kBACR,QAAQ;;;;;;;;;;EAgCX,qBACE,oBACA,SAAS,kBACR,QAAQ;;;;;;;;EAsDX,kBAAkB,MAAM,YAAY;;;;;;;cCnSzB,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["HOMEPAGE_SLUG","pageData"],"sources":["../src/utils/slug.ts","../src/csp.ts","../src/StoryblokCMSService.ts"],"sourcesContent":["/**\n * Storyblok story type. Minimal interface for slug resolution.\n * In the Storefront Application context, this is imported from `@shared/types/cms/storyblok`.\n * In the standalone package context, callers provide this shape directly.\n */\nexport interface StoryblokStory {\n full_slug?: string\n alternates?: Array<{ id: number; full_slug?: string; published: boolean }>\n}\n\n/** Extracts the language code portion of a storefront locale (e.g. `de` from `de-DE`). */\nexport const extractLanguageCode = (locale: string): string =>\n locale.split('-')[0]\n\n/** Slug used to identify the homepage story; mapped to `/` in generated hreflangs. */\nconst HOMEPAGE_SLUG = 'homepage'\n\n// A single quantifier on one character class anchored at one end of the string\n// can't backtrack (there's nothing to retry against), so this is linear-time\n// regardless of input length - safe even though `slug` is attacker-controlled.\nconst stripSlashes = (value: string): string =>\n // eslint-disable-next-line sonarjs/super-linear-regex\n value.trim().replace(/^\\/+/, '').replace(/\\/+$/, '')\n\n/**\n * Resolves a Storyblok slug from storefront locale and requested slug.\n * Used by the Storyblok CMS service before requesting a story from the CDN API.\n *\n * @param locale Storefront locale in BCP-47 format\n * @param slug Requested CMS slug\n * @param folderMapping Optional locale folder mapping\n * @returns Storyblok content slug\n *\n * @example\n * ```ts\n * resolveStoryblokSlug('de-DE', '/content/about', { de: 'de' })\n * // \"de/content/about\"\n * ```\n *\n * @see https://www.storyblok.com/docs/concepts/internationalization\n */\nexport const resolveStoryblokSlug = (\n locale: string,\n slug: string,\n folderMapping: Record<string, string> = {},\n): string => {\n const localeCode = extractLanguageCode(locale)\n const folder = folderMapping[localeCode] ?? localeCode\n\n let normalizedSlug = stripSlashes(slug)\n\n if (!normalizedSlug) {\n return `${folder}/${HOMEPAGE_SLUG}`\n }\n\n const localePrefix = `${localeCode}/`\n if (normalizedSlug === localeCode) {\n normalizedSlug = ''\n } else if (normalizedSlug.startsWith(localePrefix)) {\n normalizedSlug = normalizedSlug.slice(localePrefix.length)\n }\n\n if (!normalizedSlug) {\n return `${folder}/${HOMEPAGE_SLUG}`\n }\n\n if (normalizedSlug.startsWith(`${folder}/`)) {\n return normalizedSlug\n }\n\n return `${folder}/${normalizedSlug}`\n}\n\n/**\n * Finds folder mapping keys that point to a given folder name.\n * Used to discover locale aliases when building hreflang links\n * (e.g. folder `\"german\"` maps to key `\"de\"`).\n *\n * @param path Folder name from a Storyblok full slug.\n * @param folderMapping Locale-to-folder mapping from provider config.\n * @returns Array of mapping keys whose value matches `path` but differ from `path` itself.\n */\nexport function getFolderMappingKeysForPath(\n path?: string,\n folderMapping?: Record<string, string>,\n): string[] {\n if (!folderMapping || !path) {\n return []\n }\n\n return Object.keys(folderMapping).filter(\n (key) => folderMapping[key] === path && key !== path,\n )\n}\n\n/**\n * Extracts all locale-folder/slug pairs from a Storyblok story and its alternates.\n * Extends with aliases from `folderMapping` when a folder name maps to multiple locale\n * keys (e.g. folder `\"german\"` aliased as both `\"de\"` and `\"german\"`).\n *\n * Used to build per-locale hreflang links where each locale may have a different CMS slug.\n *\n * @param story Storyblok story data including `full_slug` and `alternates`.\n * @param folderMapping Optional locale-to-folder mapping from provider config.\n * @returns Array of `{ path, slug }` pairs where `path` is the locale/folder key and\n * `slug` is the page-relative path (e.g. `\"content/about\"`).\n *\n * @see https://www.storyblok.com/docs/concepts/internationalization\n */\nexport function getAllSourceSlugs(\n story: StoryblokStory,\n folderMapping?: Record<string, string>,\n): { path: string; slug: string }[] {\n const sourceSlugsFromCMS = [\n story.full_slug,\n ...(story.alternates?.map((a) => a.full_slug) ?? []),\n ]\n\n return sourceSlugsFromCMS.reduce<{ path: string; slug: string }[]>(\n (acc, sourceSlug) => {\n if (!sourceSlug) {\n return acc\n }\n\n const [path, ...rest] = sourceSlug.split('/')\n\n if (!path) {\n return acc\n }\n\n const slug = rest.join('/')\n const aliasKeys = getFolderMappingKeysForPath(path, folderMapping)\n\n return [\n ...acc,\n ...aliasKeys.map((key) => ({ path: key, slug })),\n { path, slug },\n ]\n },\n [],\n )\n}\n","import type { CMSCspConfig } from '@scayle/storefront/cms'\nimport type { IncomingRequest } from '@scayle/storefront/types'\n\n/**\n * Checks whether the request is a Storyblok Visual Editor session.\n *\n * Storyblok injects `_storyblok` into the iframe URL; both editor-mode detection\n * and preview CSP use this same predicate.\n *\n * @param request Inbound request\n * @returns True when `_storyblok` is present on the query string\n */\nexport const isStoryblokPreviewRequest = (request: IncomingRequest): boolean =>\n Boolean(request.query._storyblok)\n\n/**\n * CSP configuration for the Storyblok provider.\n * Allows the Storyblok visual editor to embed the storefront in an iframe\n * and load the bridge script for live editing.\n */\nexport const cspConfig: CMSCspConfig = {\n directives: {\n // Allows Storyblok to embed the storefront in an iframe for the Visual Editor.\n // https://www.storyblok.com/docs/guide/essentials/visual-editor\n 'frame-ancestors': \"'self' https://app.storyblok.com\",\n // Allows the Storyblok bridge script 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 // https://www.storyblok.com/docs/guide/essentials/visual-editor#bridge\n 'script-src': \"'self' 'unsafe-inline' https://app.storyblok.com\",\n // Allows the Storyblok bridge to communicate with the Storyblok API\n // for real-time content updates in the Visual Editor.\n // https://www.storyblok.com/docs/api/content-delivery/v2\n 'connect-src': \"'self' https://api.storyblok.com\",\n },\n}\n","import { storyblokInit, apiPlugin } from '@storyblok/js'\nimport type { StoryblokClient } from '@storyblok/js'\nimport {\n CMSContentNotFoundError,\n extractErrorStatus,\n ensureError,\n wrapClientInit,\n} from '@scayle/storefront/cms'\nimport type {\n CMSCspConfig,\n CMSEditorData,\n CMSPagePayload,\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 {\n resolveStoryblokSlug,\n getAllSourceSlugs,\n extractLanguageCode,\n} from './utils/slug'\nimport { cspConfig, isStoryblokPreviewRequest } from './csp'\n\nconst log = createLogger('cms')\n\n/** Cache TTL for published CMS content: 5 minutes. */\nconst CACHE_TTL_SECONDS = 5 * 60\n\n/** Slug used to identify the homepage story; mapped to `/` in generated hreflangs. */\nconst HOMEPAGE_SLUG = 'homepage' as const\n\n/**\n * Configuration for the Storyblok CMS service.\n */\nexport interface StoryblokCMSServiceConfig {\n /** The Storyblok API access token. */\n accessToken: string\n /** Enable draft content in editor mode. */\n draftContentEnabled: boolean\n /** Maps storefront locale codes to Storyblok folder names. Defaults to `{ de: 'de', en: 'en' }` when omitted. */\n folderMapping?: Record<string, string>\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 `TPageData` to\n * its own generated `StoryblokPageData` type.\n */\nexport interface MinimalStoryblokPageData extends Record<string, unknown> {\n story?: {\n content?: { component?: string; [key: string]: unknown }\n alternates?: { id: number; slug: string; published: boolean }[]\n full_slug?: string\n }\n}\n\n/**\n * Storyblok CMS provider service.\n * Manages a singleton API client that is lazily initialized on first use.\n * Generic over your project's generated Storyblok content-type shape\n * (`TPageData`); your project subclass binds this to its own generated types\n * from `src/shared/types/cms/storyblok`.\n *\n * This binding cannot move into this package: `TPageData` is generated by\n * `pnpm cms:sync` from your project's own Storyblok space, so its shape differs\n * across projects and is regenerated on demand. A versioned npm package ships one\n * fixed artifact for each project, so it can only stay generic here — the\n * concrete type has to be supplied where it's generated, in the Storefront Application.\n *\n * @see https://www.storyblok.com/docs/packages/storyblok-js\n */\nexport class StoryblokCMSService<\n TPageData extends MinimalStoryblokPageData = MinimalStoryblokPageData,\n> implements CMSProviderService {\n /** Shared across all instances so the API client is created once, not per request. */\n private static client: StoryblokClient | undefined\n\n readonly cspConfig: CMSCspConfig = cspConfig\n\n private readonly accessToken: string\n private readonly context: StorefrontContext\n private readonly draftContentEnabled: boolean\n private readonly folderMapping: Record<string, string>\n\n constructor(config: StoryblokCMSServiceConfig, context: StorefrontContext) {\n this.accessToken = config.accessToken\n this.draftContentEnabled = config.draftContentEnabled\n this.context = context\n this.folderMapping = config.folderMapping ?? { de: 'de', en: 'en' }\n }\n\n private getClient(): StoryblokClient {\n if (StoryblokCMSService.client) {\n return StoryblokCMSService.client\n }\n\n if (!this.accessToken) {\n throw new Error(\n 'Storyblok API client initialization failed: missing or empty access token. Check that STORYBLOK_CMS_ACCESS_TOKEN is set.',\n )\n }\n\n const { storyblokApi } = wrapClientInit(\n () =>\n storyblokInit({\n accessToken: this.accessToken,\n use: [apiPlugin],\n }),\n 'Storyblok API client initialization failed',\n )\n\n if (!storyblokApi) {\n throw new Error(\n 'Storyblok API client initialization failed: storyblokInit() did not return an API client instance. Ensure @storyblok/js package and its apiPlugin are correctly installed and compatible.',\n )\n }\n\n StoryblokCMSService.client = storyblokApi\n return StoryblokCMSService.client\n }\n\n isEditorMode(request: IncomingRequest): boolean {\n return isStoryblokPreviewRequest(request)\n }\n\n getCMSEditorData(request: IncomingRequest): CMSEditorData | undefined {\n if (!this.isEditorMode(request)) {\n return undefined\n }\n\n return {}\n }\n\n /**\n * Builds the Storyblok Content Delivery API query for a story lookup.\n * Override to change version resolution, resolved links, or add other\n * `client.get(...)` query params.\n *\n * @param useDraftContent Whether to fetch draft content version\n * @param request Inbound request for accessing query parameters\n * @returns Query object passed to `client.get('cdn/stories/...', query)`\n */\n protected buildStoryQuery(\n useDraftContent: boolean,\n request: IncomingRequest,\n ): Record<string, unknown> {\n const locale = this.context.country.locale\n const rawCv = request.query._storyblok\n return {\n version: useDraftContent ? 'draft' : 'published',\n cv: rawCv ? Number(rawCv) : undefined,\n language: extractLanguageCode(locale),\n resolve_links: 'url',\n }\n }\n\n /**\n * Transforms a Storyblok Content Delivery API response into the page payload.\n * Override to keep additional response fields beyond `story`.\n *\n * @param response Raw response from `client.get('cdn/stories/...')`\n * @param response.data Response body\n * @param response.data.story Story payload, or undefined when none matched\n * @returns Page payload, or undefined when the response has no story\n */\n protected transformStoryResponse(response: {\n data?: { story?: unknown }\n }): TPageData | undefined {\n if (!response.data?.story) {\n return undefined\n }\n\n return { story: response.data.story } as TPageData\n }\n\n private async fetchRawPageData(\n slug: string,\n locale: string,\n useDraftContent: boolean,\n request: IncomingRequest,\n ): Promise<TPageData | undefined> {\n const storyblokSlug = resolveStoryblokSlug(locale, slug, this.folderMapping)\n const client = this.getClient()\n const query = this.buildStoryQuery(useDraftContent, request)\n\n try {\n const response = await client.get(`cdn/stories/${storyblokSlug}`, query)\n\n return this.transformStoryResponse(response)\n } catch (error) {\n const status = extractErrorStatus(error)\n\n if (status === 404) {\n throw new CMSContentNotFoundError('Storyblok content not found', {\n cause: error,\n details: { slug, locale, storyblokSlug, version: query.version },\n })\n }\n\n const { message } = ensureError(error, 'Storyblok API request failed')\n throw new Error(\n `Storyblok API request failed (slug: \"${slug}\", locale: \"${locale}\", status: ${status ?? 'unknown'}): ${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 Storyblok 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.fetchRawPageData(slug, locale, useDraftContent, request)\n }\n\n return this.context.cache.getOrSet(\n `cms:storyblok:page:${slug}:${locale}`,\n // Cast required: StorageValue excludes undefined, but the fetch can return undefined for missing content\n () =>\n this.fetchRawPageData(slug, locale, useDraftContent, request) as never,\n CACHE_TTL_SECONDS,\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 Storyblok 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 slug = `c/c-${categoryId}`\n const useDraftContent =\n this.isEditorMode(request) && this.draftContentEnabled\n\n const fetchListing = async () => {\n try {\n return await this.fetchRawPageData(\n slug,\n locale,\n useDraftContent,\n request,\n )\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:storyblok: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 * Extracts per-locale page paths from a Storyblok story using its\n * `alternates` and the configured folder mapping.\n *\n * @param data CMS page payload containing a Storyblok story.\n * @returns Per-locale page path map, or undefined.\n */\n getAlternatePaths(data: CMSPagePayload): Record<string, string> | undefined {\n const pageData = data as MinimalStoryblokPageData\n const story = pageData?.story\n\n if (!story?.alternates?.length) {\n return undefined\n }\n\n const sourceSlugs = getAllSourceSlugs(story, this.folderMapping)\n\n if (sourceSlugs.length <= 1) {\n return undefined\n }\n\n return Object.fromEntries(\n sourceSlugs.map(({ path, slug }) => [\n path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mjs","names":["HOMEPAGE_SLUG"],"sources":["../src/utils/slug.ts","../src/csp.ts","../src/StoryblokCMSService.ts"],"sourcesContent":["/**\n * Storyblok story type. Minimal interface for slug resolution.\n * In the Storefront Application context, this is imported from `@shared/types/cms/storyblok`.\n * In the standalone package context, callers provide this shape directly.\n */\nexport interface StoryblokStory {\n full_slug?: string\n alternates?: Array<{ id: number; full_slug?: string; published: boolean }>\n}\n\n/** Extracts the language code portion of a storefront locale (e.g. `de` from `de-DE`). */\nexport const extractLanguageCode = (locale: string): string =>\n locale.split('-')[0]\n\n/** Slug used to identify the homepage story; mapped to `/` in generated hreflangs. */\nconst HOMEPAGE_SLUG = 'homepage'\n\n// A single quantifier on one character class anchored at one end of the string\n// can't backtrack (there's nothing to retry against), so this is linear-time\n// regardless of input length - safe even though `slug` is attacker-controlled.\nconst stripSlashes = (value: string): string =>\n // eslint-disable-next-line sonarjs/super-linear-regex\n value.trim().replace(/^\\/+/, '').replace(/\\/+$/, '')\n\n/**\n * Resolves a Storyblok slug from storefront locale and requested slug.\n * Used by the Storyblok CMS service before requesting a story from the CDN API.\n *\n * @param locale Storefront locale in BCP-47 format\n * @param slug Requested CMS slug\n * @param folderMapping Optional locale folder mapping\n * @returns Storyblok content slug\n *\n * @example\n * ```ts\n * resolveStoryblokSlug('de-DE', '/content/about', { de: 'de' })\n * // \"de/content/about\"\n * ```\n *\n * @see https://www.storyblok.com/docs/concepts/internationalization\n */\nexport const resolveStoryblokSlug = (\n locale: string,\n slug: string,\n folderMapping: Record<string, string> = {},\n): string => {\n const localeCode = extractLanguageCode(locale)\n const folder = folderMapping[localeCode] ?? localeCode\n\n let normalizedSlug = stripSlashes(slug)\n\n if (!normalizedSlug) {\n return `${folder}/${HOMEPAGE_SLUG}`\n }\n\n const localePrefix = `${localeCode}/`\n if (normalizedSlug === localeCode) {\n normalizedSlug = ''\n } else if (normalizedSlug.startsWith(localePrefix)) {\n normalizedSlug = normalizedSlug.slice(localePrefix.length)\n }\n\n if (!normalizedSlug) {\n return `${folder}/${HOMEPAGE_SLUG}`\n }\n\n if (normalizedSlug.startsWith(`${folder}/`)) {\n return normalizedSlug\n }\n\n return `${folder}/${normalizedSlug}`\n}\n\n/**\n * Finds folder mapping keys that point to a given folder name.\n * Used to discover locale aliases when building hreflang links\n * (e.g. folder `\"german\"` maps to key `\"de\"`).\n *\n * @param path Folder name from a Storyblok full slug.\n * @param folderMapping Locale-to-folder mapping from provider config.\n * @returns Array of mapping keys whose value matches `path` but differ from `path` itself.\n */\nexport function getFolderMappingKeysForPath(\n path?: string,\n folderMapping?: Record<string, string>,\n): string[] {\n if (!folderMapping || !path) {\n return []\n }\n\n return Object.keys(folderMapping).filter(\n (key) => folderMapping[key] === path && key !== path,\n )\n}\n\n/**\n * Extracts all locale-folder/slug pairs from a Storyblok story and its alternates.\n * Extends with aliases from `folderMapping` when a folder name maps to multiple locale\n * keys (e.g. folder `\"german\"` aliased as both `\"de\"` and `\"german\"`).\n *\n * Used to build per-locale hreflang links where each locale may have a different CMS slug.\n *\n * @param story Storyblok story data including `full_slug` and `alternates`.\n * @param folderMapping Optional locale-to-folder mapping from provider config.\n * @returns Array of `{ path, slug }` pairs where `path` is the locale/folder key and\n * `slug` is the page-relative path (e.g. `\"content/about\"`).\n *\n * @see https://www.storyblok.com/docs/concepts/internationalization\n */\nexport function getAllSourceSlugs(\n story: StoryblokStory,\n folderMapping?: Record<string, string>,\n): { path: string; slug: string }[] {\n const sourceSlugsFromCMS = [\n story.full_slug,\n ...(story.alternates?.map((a) => a.full_slug) ?? []),\n ]\n\n return sourceSlugsFromCMS.reduce<{ path: string; slug: string }[]>(\n (acc, sourceSlug) => {\n if (!sourceSlug) {\n return acc\n }\n\n const [path, ...rest] = sourceSlug.split('/')\n\n if (!path) {\n return acc\n }\n\n const slug = rest.join('/')\n const aliasKeys = getFolderMappingKeysForPath(path, folderMapping)\n\n return [\n ...acc,\n ...aliasKeys.map((key) => ({ path: key, slug })),\n { path, slug },\n ]\n },\n [],\n )\n}\n","import type { CMSCspConfig } from '@scayle/storefront/cms'\nimport type { IncomingRequest } from '@scayle/storefront/types'\n\n/**\n * Checks whether the request is a Storyblok Visual Editor session.\n *\n * Storyblok injects `_storyblok` into the iframe URL; both editor-mode detection\n * and preview CSP use this same predicate.\n *\n * @param request Inbound request\n * @returns True when `_storyblok` is present on the query string\n */\nexport const isStoryblokPreviewRequest = (request: IncomingRequest): boolean =>\n Boolean(request.query._storyblok)\n\n/**\n * CSP configuration for the Storyblok provider.\n * Allows the Storyblok visual editor to embed the storefront in an iframe\n * and load the bridge script for live editing.\n */\nexport const cspConfig: CMSCspConfig = {\n directives: {\n // Allows Storyblok to embed the storefront in an iframe for the Visual Editor.\n // https://www.storyblok.com/docs/guide/essentials/visual-editor\n 'frame-ancestors': \"'self' https://app.storyblok.com\",\n // Allows the Storyblok bridge script 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 // https://www.storyblok.com/docs/guide/essentials/visual-editor#bridge\n 'script-src': \"'self' 'unsafe-inline' https://app.storyblok.com\",\n // Allows the Storyblok bridge to communicate with the Storyblok API\n // for real-time content updates in the Visual Editor.\n // https://www.storyblok.com/docs/api/content-delivery/v2\n 'connect-src': \"'self' https://api.storyblok.com\",\n },\n}\n","import { storyblokInit, apiPlugin } from '@storyblok/js'\nimport type { StoryblokClient } from '@storyblok/js'\nimport {\n CMSContentNotFoundError,\n extractErrorStatus,\n ensureError,\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 {\n resolveStoryblokSlug,\n getAllSourceSlugs,\n extractLanguageCode,\n} from './utils/slug'\nimport { cspConfig, isStoryblokPreviewRequest } from './csp'\n\nconst log = createLogger('cms')\n\n/** Cache TTL for published CMS content: 5 minutes. */\nconst CACHE_TTL_SECONDS = 5 * 60\n\n/** Slug used to identify the homepage story; mapped to `/` in generated hreflangs. */\nconst HOMEPAGE_SLUG = 'homepage' as const\n\n/**\n * Configuration for the Storyblok CMS service.\n */\nexport interface StoryblokCMSServiceConfig {\n /** The Storyblok API access token. */\n accessToken: string\n /** Enable draft content in editor mode. */\n draftContentEnabled: boolean\n /** Maps storefront locale codes to Storyblok folder names. Defaults to `{ de: 'de', en: 'en' }` when omitted. */\n folderMapping?: Record<string, string>\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 `TPageData` to\n * its own generated `CMSPageData` type. No index signature: the constraint\n * must admit project payload types that carry none, so excess-property\n * checking stays intact on them.\n */\nexport interface MinimalStoryblokPageData {\n story?: {\n content?: { component?: string; [key: string]: unknown }\n alternates?: { id: number; full_slug?: string; published: boolean }[]\n full_slug?: string\n }\n}\n\n/**\n * Storyblok CMS provider service.\n * Manages a singleton API client that is lazily initialized on first use.\n * Generic over your project's generated Storyblok content-type shape\n * (`TPageData`); your project subclass binds this to its own generated types\n * from `src/shared/types/cms/storyblok`.\n *\n * This binding cannot move into this package: `TPageData` is generated by\n * `pnpm cms:sync` from your project's own Storyblok space, so its shape differs\n * across projects and is regenerated on demand. A versioned npm package ships one\n * fixed artifact for each project, so it can only stay generic here — the\n * concrete type has to be supplied where it's generated, in the Storefront Application.\n *\n * @see https://www.storyblok.com/docs/packages/storyblok-js\n */\nexport class StoryblokCMSService<\n TPageData extends MinimalStoryblokPageData = MinimalStoryblokPageData,\n> implements CMSProviderService<TPageData> {\n /** Shared across all instances so the API client is created once, not per request. */\n private static client: StoryblokClient | undefined\n\n readonly cspConfig: CMSCspConfig = cspConfig\n\n private readonly accessToken: string\n private readonly context: StorefrontContext\n private readonly draftContentEnabled: boolean\n private readonly folderMapping: Record<string, string>\n\n constructor(config: StoryblokCMSServiceConfig, context: StorefrontContext) {\n this.accessToken = config.accessToken\n this.draftContentEnabled = config.draftContentEnabled\n this.context = context\n this.folderMapping = config.folderMapping ?? { de: 'de', en: 'en' }\n }\n\n private getClient(): StoryblokClient {\n if (StoryblokCMSService.client) {\n return StoryblokCMSService.client\n }\n\n if (!this.accessToken) {\n throw new Error(\n 'Storyblok API client initialization failed: missing or empty access token. Check that STORYBLOK_CMS_ACCESS_TOKEN is set.',\n )\n }\n\n const { storyblokApi } = wrapClientInit(\n () =>\n storyblokInit({\n accessToken: this.accessToken,\n use: [apiPlugin],\n }),\n 'Storyblok API client initialization failed',\n )\n\n if (!storyblokApi) {\n throw new Error(\n 'Storyblok API client initialization failed: storyblokInit() did not return an API client instance. Ensure @storyblok/js package and its apiPlugin are correctly installed and compatible.',\n )\n }\n\n StoryblokCMSService.client = storyblokApi\n return StoryblokCMSService.client\n }\n\n isEditorMode(request: IncomingRequest): boolean {\n return isStoryblokPreviewRequest(request)\n }\n\n getCMSEditorData(request: IncomingRequest): CMSEditorData | undefined {\n if (!this.isEditorMode(request)) {\n return undefined\n }\n\n return {}\n }\n\n /**\n * Builds the Storyblok Content Delivery API query for a story lookup.\n * Override to change version resolution, resolved links, or add other\n * `client.get(...)` query params.\n *\n * @param useDraftContent Whether to fetch draft content version\n * @param request Inbound request for accessing query parameters\n * @returns Query object passed to `client.get('cdn/stories/...', query)`\n */\n protected buildStoryQuery(\n useDraftContent: boolean,\n request: IncomingRequest,\n ): Record<string, unknown> {\n const locale = this.context.country.locale\n const rawCv = request.query._storyblok\n return {\n version: useDraftContent ? 'draft' : 'published',\n cv: rawCv ? Number(rawCv) : undefined,\n language: extractLanguageCode(locale),\n resolve_links: 'url',\n }\n }\n\n /**\n * Transforms a Storyblok Content Delivery API response into the page payload.\n * Override to keep additional response fields beyond `story`.\n *\n * @param response Raw response from `client.get('cdn/stories/...')`\n * @param response.data Response body\n * @param response.data.story Story payload, or undefined when none matched\n * @returns Page payload, or undefined when the response has no story\n */\n protected transformStoryResponse(response: {\n data?: { story?: unknown }\n }): TPageData | undefined {\n if (!response.data?.story) {\n return undefined\n }\n\n return { story: response.data.story } as TPageData\n }\n\n private async fetchRawPageData(\n slug: string,\n locale: string,\n useDraftContent: boolean,\n request: IncomingRequest,\n ): Promise<TPageData | undefined> {\n const storyblokSlug = resolveStoryblokSlug(locale, slug, this.folderMapping)\n const client = this.getClient()\n const query = this.buildStoryQuery(useDraftContent, request)\n\n try {\n const response = await client.get(`cdn/stories/${storyblokSlug}`, query)\n\n return this.transformStoryResponse(response)\n } catch (error) {\n const status = extractErrorStatus(error)\n\n if (status === 404) {\n throw new CMSContentNotFoundError('Storyblok content not found', {\n cause: error,\n details: { slug, locale, storyblokSlug, version: query.version },\n })\n }\n\n const { message } = ensureError(error, 'Storyblok API request failed')\n throw new Error(\n `Storyblok API request failed (slug: \"${slug}\", locale: \"${locale}\", status: ${status ?? 'unknown'}): ${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 Storyblok 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.fetchRawPageData(slug, locale, useDraftContent, request)\n }\n\n return this.context.cache.getOrSet(\n `cms:storyblok:page:${slug}:${locale}`,\n // Cast required: StorageValue excludes undefined, but the fetch can return undefined for missing content\n () =>\n this.fetchRawPageData(slug, locale, useDraftContent, request) as never,\n CACHE_TTL_SECONDS,\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 Storyblok 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 slug = `c/c-${categoryId}`\n const useDraftContent =\n this.isEditorMode(request) && this.draftContentEnabled\n\n const fetchListing = async () => {\n try {\n return await this.fetchRawPageData(\n slug,\n locale,\n useDraftContent,\n request,\n )\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:storyblok: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 * Extracts per-locale page paths from a Storyblok story using its\n * `alternates` and the configured folder mapping.\n *\n * @param data CMS page payload containing a Storyblok story.\n * @returns Per-locale page path map, or undefined.\n */\n getAlternatePaths(data: TPageData): Record<string, string> | undefined {\n const story = data?.story\n\n if (!story?.alternates?.length) {\n return undefined\n }\n\n const sourceSlugs = getAllSourceSlugs(story, this.folderMapping)\n\n if (sourceSlugs.length <= 1) {\n return undefined\n }\n\n return Object.fromEntries(\n sourceSlugs.map(({ path, slug }) => [\n path,\n !slug || slug === HOMEPAGE_SLUG ? '/' : `/${slug}`,\n ]),\n )\n }\n}\n"],"mappings":";;;AAWA,MAAa,uBAAuB,WAClC,OAAO,MAAM,GAAG,CAAC,CAAC;AAGpB,MAAMA,kBAAgB;AAKtB,MAAM,gBAAgB,UAEpB,MAAM,KAAK,CAAC,CAAC,QAAQ,QAAQ,EAAE,CAAC,CAAC,QAAQ,QAAQ,EAAE;;;;;;;;;;;;;;;;AAmBrD;AAME,SAAM,kBAAS,OAAc,eAAe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AAA;EAEjB;CACE;CAEA,MAAK,cAAU,MAAA,SAAA;EACf,MAAK,SAAA,KAAA,QAAuB,QAAA;EAAmB,MAAI,kBAAA,KAAA,aAAA,OAAA,KAAA,KAAA;EAAM,IAAA,iBAAI;GAAK,IAAA,MAAA;IACpE,SAAA;IAEQ;IACN;GAIA,CAAA;GAMA,OAAQ,KAAA,iBAAiB,MAAA,QAAA,iBAEP,OAAA;EACZ;EACA,OAAM,KAAA,QAAS,MAAA,SAAA,sBAAA,KAAA,GAAA,gBAAA,KAAA,iBAAA,MAAA,QAAA,iBAAA,OAAA,GAAA,iBAAA;CACjB;CAUJ,MAAA,qBAAoB,YAAS,SAAA;EAC7B,MAAA,SAAO,KAAA,QAAoB,QAAA;EAC7B,MAAA,OAAA,OAAA;EAEA,MAAA,kBAAgD,KAAA,aAAA,OAAA,KAAA,KAAA;EAC9C,MAAA,eAAO,YAA0B;GACnC,IAAA;IAEA,OAAA,MAAA,KAAiB,iBAAqD,MAAA,QAAA,iBAAA,OAAA;GACpE,SAAU,OAAA;IAIV,IAAA,iBAAQ,yBAAA;IACV,IAAA,MAAA;;;;;;;;;;GAWU,IAAA,MAAA;IAIR,SAAM;IACN;IACA;GACE,CAAA;GACA,OAAI,aAAe;EACnB;EACA,OAAA,KAAA,QAAe,MAAA,SAAA,qBAAA,WAAA,GAAA,gBAAA,aAAA,GAAA,iBAAA;CACjB;;;;;;;;;AAYF,SAAU,qBAAuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-cms-storyblok",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.4",
4
4
  "description": "Storyblok CMS provider integration for the SCAYLE Storefront Application V3",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -22,23 +22,23 @@
22
22
  "node": ">= 24.0.0"
23
23
  },
24
24
  "peerDependencies": {
25
- "@storyblok/js": "^6.3.0",
26
- "@scayle/storefront": "1.0.0-alpha.5"
25
+ "@scayle/storefront": "1.0.0-alpha.6",
26
+ "@storyblok/js": "^6.3.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@arethetypeswrong/cli": "0.18.5",
30
+ "@scayle/eslint-config-storefront": "5.1.1",
31
+ "@scayle/storefront": "1.0.0-alpha.6",
32
+ "@scayle/vitest-config-storefront": "1.0.0",
30
33
  "@storyblok/js": "^6.3.0",
31
34
  "@types/node": "^24",
32
35
  "@vitest/coverage-v8": "4.1.11",
33
- "eslint": "10.8.1",
36
+ "eslint": "10.9.1",
34
37
  "eslint-formatter-gitlab": "7.2.0",
35
- "publint": "0.3.23",
38
+ "publint": "0.3.24",
36
39
  "typescript": "6.0.3",
37
40
  "obuild": "0.4.38",
38
- "vitest": "4.1.11",
39
- "@scayle/eslint-config-storefront": "5.0.0",
40
- "@scayle/storefront": "1.0.0-alpha.5",
41
- "@scayle/vitest-config-storefront": "1.0.0"
41
+ "vitest": "4.1.11"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "obuild",