diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..c0f2556f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,33 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Dependency directories +node_modules/ +jspm_packages/ + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +dist +.vercel +.DS_Store +*-temp.json + +# Files and folders that start with a dot +.* + +# yaml files +*.yaml + +# Markdown files +*.md \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..ba00df8c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,18 @@ +{ + "arrowParens": "avoid", + "bracketSpacing": true, + "embeddedLanguageFormatting": "auto", + "endOfLine": "crlf", + "experimentalTernaries": true, + "jsxSingleQuote": true, + "printWidth": 120, + "proseWrap": "always", + "quoteProps": "as-needed", + "rangeStart": 0, + "requirePragma": false, + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "all", + "useTabs": false +} diff --git a/__test__/test-website/next.config.ts b/__test__/test-website/next.config.ts index e9ffa308..5e891cf0 100644 --- a/__test__/test-website/next.config.ts +++ b/__test__/test-website/next.config.ts @@ -1,4 +1,4 @@ -import type { NextConfig } from "next"; +import type { NextConfig } from 'next'; const nextConfig: NextConfig = { /* config options here */ diff --git a/__test__/test-website/src/app/en/layout.tsx b/__test__/test-website/src/app/en/layout.tsx index 2c409353..733dbeee 100644 --- a/__test__/test-website/src/app/en/layout.tsx +++ b/__test__/test-website/src/app/en/layout.tsx @@ -36,10 +36,7 @@ import { ctString, ctWithCollision, } from '@/components/with-repeated-properties'; -import { - initContentTypeRegistry, - initDisplayTemplateRegistry, -} from '@optimizely/cms-sdk'; +import { initContentTypeRegistry, initDisplayTemplateRegistry } from '@optimizely/cms-sdk'; import { initReactComponentRegistry } from '@optimizely/cms-sdk/react/server'; initContentTypeRegistry([ @@ -103,7 +100,7 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - + {children} ); diff --git a/__test__/test-website/src/app/missing-content-types/layout.tsx b/__test__/test-website/src/app/missing-content-types/layout.tsx index a14e64fc..6cab6a7e 100644 --- a/__test__/test-website/src/app/missing-content-types/layout.tsx +++ b/__test__/test-website/src/app/missing-content-types/layout.tsx @@ -1,16 +1,12 @@ export const metadata = { title: 'Next.js', description: 'Generated by Next.js', -} +}; -export default function RootLayout({ - children, -}: { - children: React.ReactNode -}) { +export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - + {children} - ) + ); } diff --git a/__test__/test-website/src/app/missing-content-types/page.tsx b/__test__/test-website/src/app/missing-content-types/page.tsx index 2f2395b8..ccfb5b1c 100644 --- a/__test__/test-website/src/app/missing-content-types/page.tsx +++ b/__test__/test-website/src/app/missing-content-types/page.tsx @@ -1,8 +1,4 @@ -import { - ct4, - ct5, - notSynced, -} from '@/components/missing-content-types/not-synced'; +import { ct4, ct5, notSynced } from '@/components/missing-content-types/not-synced'; import { GraphClient, initContentTypeRegistry } from '@optimizely/cms-sdk'; import React from 'react'; diff --git a/__test__/test-website/src/app/multi-host/[...slug]/page.tsx b/__test__/test-website/src/app/multi-host/[...slug]/page.tsx index adf71b1b..542b67f0 100644 --- a/__test__/test-website/src/app/multi-host/[...slug]/page.tsx +++ b/__test__/test-website/src/app/multi-host/[...slug]/page.tsx @@ -16,8 +16,7 @@ export default async function Page({ params }: Props) { const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, { graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY, }); - const host = - process.env.NEXTJS_HOST ?? `https://localhost:${process.env.PORT ?? 3000}`; + const host = process.env.NEXTJS_HOST ?? `https://localhost:${process.env.PORT ?? 3000}`; const content = await client.getContentByPath(`/${slug.join('/')}/`, { host, diff --git a/__test__/test-website/src/app/multi-host/layout.tsx b/__test__/test-website/src/app/multi-host/layout.tsx index a14e64fc..6cab6a7e 100644 --- a/__test__/test-website/src/app/multi-host/layout.tsx +++ b/__test__/test-website/src/app/multi-host/layout.tsx @@ -1,16 +1,12 @@ export const metadata = { title: 'Next.js', description: 'Generated by Next.js', -} +}; -export default function RootLayout({ - children, -}: { - children: React.ReactNode -}) { +export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - + {children} - ) + ); } diff --git a/__test__/test-website/src/app/preview/page.tsx b/__test__/test-website/src/app/preview/page.tsx index c3cd8c4d..786dc9ee 100644 --- a/__test__/test-website/src/app/preview/page.tsx +++ b/__test__/test-website/src/app/preview/page.tsx @@ -15,9 +15,9 @@ export default async function Page({ searchParams }: Props) { const response = await client .getPreviewContent( // TODO: check types in runtime properly - (await searchParams) as PreviewParams + (await searchParams) as PreviewParams, ) - .catch((err) => { + .catch(err => { console.log(err.errors); console.log(err.request); @@ -29,9 +29,7 @@ export default async function Page({ searchParams }: Props) { return ( <> - + diff --git a/__test__/test-website/src/app/related/[...slug]/layout.tsx b/__test__/test-website/src/app/related/[...slug]/layout.tsx index 93a32778..d63b58ed 100644 --- a/__test__/test-website/src/app/related/[...slug]/layout.tsx +++ b/__test__/test-website/src/app/related/[...slug]/layout.tsx @@ -11,7 +11,7 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - + {children} ); diff --git a/__test__/test-website/src/app/related/[...slug]/page.tsx b/__test__/test-website/src/app/related/[...slug]/page.tsx index 1efc5e88..ab35e8ed 100644 --- a/__test__/test-website/src/app/related/[...slug]/page.tsx +++ b/__test__/test-website/src/app/related/[...slug]/page.tsx @@ -24,7 +24,7 @@ export default async function Page({ params }: Props) {

Links from this page

Children

Ancestors (breadcrumbs)

    - {ancestors?.map((l) => ( + {ancestors?.map(l => (
  1. {l?._metadata?.displayName} ({l?._metadata?.url?.default})
  2. diff --git a/__test__/test-website/src/components/missing-content-types/not-included-in-registry.tsx b/__test__/test-website/src/components/missing-content-types/not-included-in-registry.tsx index c1d98e0b..f4152c7f 100644 --- a/__test__/test-website/src/components/missing-content-types/not-included-in-registry.tsx +++ b/__test__/test-website/src/components/missing-content-types/not-included-in-registry.tsx @@ -4,8 +4,7 @@ import { contentType } from '@optimizely/cms-sdk'; export const notInRegistry = contentType({ baseType: '_component', key: 'test_c6', - displayName: - "test_c6: This content type is not added in the 'initContentTypeRegistry')", + displayName: "test_c6: This content type is not added in the 'initContentTypeRegistry')", properties: { p1: { type: 'string' }, }, diff --git a/__test__/test-website/src/components/missing-content-types/referencing.tsx b/__test__/test-website/src/components/missing-content-types/referencing.tsx index 75b04fdd..e833e3e8 100644 --- a/__test__/test-website/src/components/missing-content-types/referencing.tsx +++ b/__test__/test-website/src/components/missing-content-types/referencing.tsx @@ -3,8 +3,7 @@ import { contentType } from '@optimizely/cms-sdk'; // This content type IS synced to the CMS. export const ct4 = contentType({ baseType: '_page', - displayName: - 'test_c4: Refer to a content type that is not synced to graph (missing in the CMS)', + displayName: 'test_c4: Refer to a content type that is not synced to graph (missing in the CMS)', key: 'test_c4_refs_missing', properties: { diff --git a/__test__/test-website/src/components/with-display-templates.tsx b/__test__/test-website/src/components/with-display-templates.tsx index a8b946e2..a09a157d 100644 --- a/__test__/test-website/src/components/with-display-templates.tsx +++ b/__test__/test-website/src/components/with-display-templates.tsx @@ -1,9 +1,4 @@ -import { - BlankSectionContentType, - contentType, - displayTemplate, - ContentProps, -} from '@optimizely/cms-sdk'; +import { BlankSectionContentType, contentType, displayTemplate, ContentProps } from '@optimizely/cms-sdk'; import { OptimizelyComposition, OptimizelyGridSection, @@ -226,11 +221,7 @@ export function BlankSection2({ content }: BlankSectionProps) { return ( <>

    This is BlankSection2 {content.key}

    - + ); } diff --git a/__test__/test-website/src/components/with-repeated-properties.tsx b/__test__/test-website/src/components/with-repeated-properties.tsx index 624d212b..8f4d4d9c 100644 --- a/__test__/test-website/src/components/with-repeated-properties.tsx +++ b/__test__/test-website/src/components/with-repeated-properties.tsx @@ -49,29 +49,13 @@ export const ctWithCollision = contentType({ properties: { collision: { type: 'content', - allowedTypes: [ - ctString, - ctBoolean, - ctInteger, - ctRich, - ctLink, - ctContentReference, - ctArray, - ], + allowedTypes: [ctString, ctBoolean, ctInteger, ctRich, ctLink, ctContentReference, ctArray], }, p2: { type: 'array', items: { type: 'content', - allowedTypes: [ - ctString, - ctBoolean, - ctInteger, - ctRich, - ctLink, - ctContentReference, - ctArray, - ], + allowedTypes: [ctString, ctBoolean, ctInteger, ctRich, ctLink, ctContentReference, ctArray], }, }, }, diff --git a/__test__/test-website/tsconfig.json b/__test__/test-website/tsconfig.json index b575f7da..61b9d358 100644 --- a/__test__/test-website/tsconfig.json +++ b/__test__/test-website/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "ES2017", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -23,19 +19,9 @@ } ], "paths": { - "@/*": [ - "./src/*" - ] + "@/*": ["./src/*"] } }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - ".next/dev/types/**/*.ts" - ], - "exclude": [ - "node_modules" - ] + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"], + "exclude": ["node_modules"] } diff --git a/__test__/test-website/with-display-templates.config.mjs b/__test__/test-website/with-display-templates.config.mjs index 955dcdf8..9fe0fc83 100644 --- a/__test__/test-website/with-display-templates.config.mjs +++ b/__test__/test-website/with-display-templates.config.mjs @@ -1,8 +1,5 @@ import { buildConfig } from '@optimizely/cms-sdk'; export default buildConfig({ - components: [ - './src/components/with-display-templates.tsx', - './src/components/with-repeated-properties.tsx', - ], + components: ['./src/components/with-display-templates.tsx', './src/components/with-repeated-properties.tsx'], }); diff --git a/package.json b/package.json index d7ce9eb4..4310dd41 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,15 @@ "build:samples": "pnpm --filter \"./samples/**\" build", "clean:all": "pnpm -r clean", "test": "echo \"Error: no test specified\" && exit 1", - "publish:all": "pnpm --filter \"./packages/**\" publish --access public --no-git-checks" + "publish:all": "pnpm --filter \"./packages/**\" publish --access public --no-git-checks", + "update-hooks": "pnpm simple-git-hooks" }, "packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6", "devDependencies": { - "lerna": "^8.2.2" + "lerna": "^8.2.2", + "prettier": "3.8.3", + "pretty-quick": "^4.2.2", + "simple-git-hooks": "^2.13.1" }, "pnpm": { "onlyBuiltDependencies": [ @@ -25,11 +29,16 @@ "lightningcss" ], "supportedArchitectures": { - "os": ["current"], - "cpu": ["current"] + "os": [ + "current" + ], + "cpu": [ + "current" + ] }, "overrides": { "@redocly/ajv": "npm:ajv@^8.18.0" } } -} \ No newline at end of file +} + diff --git a/packages/optimizely-cms-cli/src/baseCommand.ts b/packages/optimizely-cms-cli/src/baseCommand.ts index 004af7ff..72f6388b 100644 --- a/packages/optimizely-cms-cli/src/baseCommand.ts +++ b/packages/optimizely-cms-cli/src/baseCommand.ts @@ -1,7 +1,5 @@ import { Command, Flags, Interfaces, Errors } from '@oclif/core'; -export type Flags = Interfaces.InferredFlags< - (typeof BaseCommand)['baseFlags'] & T['flags'] ->; +export type Flags = Interfaces.InferredFlags<(typeof BaseCommand)['baseFlags'] & T['flags']>; export type Args = Interfaces.InferredArgs; /** @@ -20,14 +18,14 @@ function handleFlagsError(err: any) { if (requiredFlags.length > 0) { const givenFlags = Object.keys(userFlags); - const missingFlags = requiredFlags.filter((f) => !givenFlags.includes(f)); + const missingFlags = requiredFlags.filter(f => !givenFlags.includes(f)); if (missingFlags.length === 1) { throw new Error(`Missing required flag --${missingFlags[0]}`); } if (missingFlags.length > 1) { - const missingFlagsString = missingFlags.map((f) => `--${f}`).join(','); + const missingFlagsString = missingFlags.map(f => `--${f}`).join(','); throw new Error('Missing required flags: ' + missingFlagsString); } } @@ -39,8 +37,7 @@ export abstract class BaseCommand extends Command { // define flags that can be inherited by any command that extends BaseCommand static baseFlags = { host: Flags.string({ - description: - 'CMS instance URL including scheme. For example: `https://my-instance.cms.optimizely.com`', + description: 'CMS instance URL including scheme. For example: `https://my-instance.cms.optimizely.com`', }), }; diff --git a/packages/optimizely-cms-cli/src/commands/config/pull.ts b/packages/optimizely-cms-cli/src/commands/config/pull.ts index 7d07d162..fc6e4d17 100644 --- a/packages/optimizely-cms-cli/src/commands/config/pull.ts +++ b/packages/optimizely-cms-cli/src/commands/config/pull.ts @@ -52,10 +52,7 @@ export default class ConfigPull extends BaseCommand { // Non-2xx responses have undefined data; check error/response instead if (error || (response && !response.ok)) { const status = (error as any)?.status ?? response?.status; - const title = - (error as any)?.title ?? - (error as any)?.message ?? - response?.statusText; + const title = (error as any)?.title ?? (error as any)?.message ?? response?.statusText; const detail = (error as any)?.detail; // Build formatted error message @@ -127,14 +124,11 @@ export default class ConfigPull extends BaseCommand { } catch (serializeError) { spinner.fail('Failed to serialize response to JSON'); process.exitCode = 1; - throw new Error( - 'Response contains unserializable data (circular references or BigInt values)', - ); + throw new Error('Response contains unserializable data (circular references or BigInt values)'); } return; } catch (error) { - const errorMessage = - error instanceof Error ? error.message : String(error); + const errorMessage = error instanceof Error ? error.message : String(error); spinner.fail(errorMessage); process.exitCode = 1; throw error; @@ -142,24 +136,24 @@ export default class ConfigPull extends BaseCommand { } // Prompt for output directory if not provided - const outputPath = flags.output - ? flags.output - : isInteractive - ? await input({ - message: 'Where should the generated files be saved?', - default: './src/content-types', - }) - : './src/content-types'; // Default for non-interactive environments + const outputPath = + flags.output ? flags.output + : isInteractive ? + await input({ + message: 'Where should the generated files be saved?', + default: './src/content-types', + }) + : './src/content-types'; // Default for non-interactive environments // Prompt for grouping if not provided isGroupBy = flags.group ?? - (isInteractive - ? await confirm({ - message: 'Should the generated files be grouped?', - default: false, - }) - : false); // Default to non-grouped in non-interactive environments + (isInteractive ? + await confirm({ + message: 'Should the generated files be grouped?', + default: false, + }) + : false); // Default to non-grouped in non-interactive environments const outputDir = resolve(process.cwd(), outputPath); @@ -227,25 +221,17 @@ export default class ConfigPull extends BaseCommand { // Process and match display templates to content types if (manifest.displayTemplates && manifest.displayTemplates.length > 0) { - const processedTemplates = processDisplayTemplates( - manifest.displayTemplates, - ); + const processedTemplates = processDisplayTemplates(manifest.displayTemplates); // Build a set of all content type keys for quick lookup - const allContentTypeKeys = new Set( - manifest.contentTypes.map((ct: any) => ct.key), - ); + const allContentTypeKeys = new Set(manifest.contentTypes.map((ct: any) => ct.key)); for (const template of processedTemplates) { // Templates with baseType or nodeType cannot be matched to a specific content type // Only templates with contentType field can be matched - if ( - template.contentType && - allContentTypeKeys.has(template.contentType) - ) { + if (template.contentType && allContentTypeKeys.has(template.contentType)) { // Match found - group with content type - const existing = - displayTemplatesByContentType.get(template.contentType) || []; + const existing = displayTemplatesByContentType.get(template.contentType) || []; existing.push(template); displayTemplatesByContentType.set(template.contentType, existing); } else { @@ -271,19 +257,13 @@ export default class ConfigPull extends BaseCommand { ); // List generated files for the group - console.log( - chalk.cyan.bold( - `\nGenerated files for group "${parsedGroupName}":`, - ), - ); + console.log(chalk.cyan.bold(`\nGenerated files for group "${parsedGroupName}":`)); for (const file of generatedFiles) { console.log(chalk.dim(' -'), chalk.green(file)); } console.log(); // Add extra spacing between groups - spinner.succeed( - `Generated ${generatedFiles.length} content type file(s) in ${groupDir}`, - ); + spinner.succeed(`Generated ${generatedFiles.length} content type file(s) in ${groupDir}`); } // Handle orphaned display templates @@ -294,22 +274,15 @@ export default class ConfigPull extends BaseCommand { const displayTemplatesDir = join(outputDir, 'displayTemplates'); await mkdir(displayTemplatesDir, { recursive: true }); - const orphanedFiles = await generateDisplayTemplateFiles( - orphanedDisplayTemplates, - displayTemplatesDir, - ); + const orphanedFiles = await generateDisplayTemplateFiles(orphanedDisplayTemplates, displayTemplatesDir); - console.log( - chalk.cyan.bold('\nDisplay templates (no matching content type):'), - ); + console.log(chalk.cyan.bold('\nDisplay templates (no matching content type):')); for (const file of orphanedFiles) { console.log(chalk.dim(' -'), chalk.green(file)); } console.log(); // Add extra spacing between groups - spinner.succeed( - `Generated ${orphanedFiles.length} display template(s) in ${displayTemplatesDir}`, - ); + spinner.succeed(`Generated ${orphanedFiles.length} display template(s) in ${displayTemplatesDir}`); console.log(); // Add extra spacing between groups } } else { @@ -327,15 +300,11 @@ export default class ConfigPull extends BaseCommand { } console.log(); // Add extra spacing between groups - spinner.succeed( - `Generated ${generatedContentTypeFiles.length} content type file(s) in ${outputDir}`, - ); + spinner.succeed(`Generated ${generatedContentTypeFiles.length} content type file(s) in ${outputDir}`); // Generate display template files if available if (manifest.displayTemplates && manifest.displayTemplates.length > 0) { - const processedDisplayTemplates = processDisplayTemplates( - manifest.displayTemplates, - ); + const processedDisplayTemplates = processDisplayTemplates(manifest.displayTemplates); console.log(); // Add extra spacing between groups spinner.start('Generating display template files'); @@ -344,11 +313,10 @@ export default class ConfigPull extends BaseCommand { const displayTemplatesDir = join(outputDir, 'display-templates'); await mkdir(displayTemplatesDir, { recursive: true }); - const generatedDisplayTemplateFiles = - await generateDisplayTemplateFiles( - processedDisplayTemplates, - displayTemplatesDir, - ); + const generatedDisplayTemplateFiles = await generateDisplayTemplateFiles( + processedDisplayTemplates, + displayTemplatesDir, + ); // List generated display template files console.log(chalk.cyan.bold('\nGenerated display template files:')); @@ -365,11 +333,11 @@ export default class ConfigPull extends BaseCommand { } } } catch (error) { - const errorMessage = - error instanceof Error ? error.message : String(error); + const errorMessage = error instanceof Error ? error.message : String(error); spinner.fail(errorMessage); process.exitCode = 1; throw error; } } } + diff --git a/packages/optimizely-cms-cli/src/commands/config/push.ts b/packages/optimizely-cms-cli/src/commands/config/push.ts index 79117028..2f092ca1 100644 --- a/packages/optimizely-cms-cli/src/commands/config/push.ts +++ b/packages/optimizely-cms-cli/src/commands/config/push.ts @@ -5,11 +5,7 @@ import chalk from 'chalk'; import { BaseCommand } from '../../baseCommand.js'; import { writeFile, access } from 'node:fs/promises'; import { createApiClient } from '../../service/cmsRestClient.js'; -import { - findMetaData, - readFromPath, - normalizePropertyGroups, -} from '../../service/utils.js'; +import { findMetaData, readFromPath, normalizePropertyGroups } from '../../service/utils.js'; import { mapContentToManifest } from '../../mapper/contentToPackage.js'; import { pathToFileURL } from 'node:url'; import { constants } from 'node:fs'; @@ -28,12 +24,10 @@ export default class ConfigPush extends BaseCommand { description: 'do not send anything to the server', }), force: Flags.boolean({ - description: - 'Force updates the content type even though the changes might result in data loss.', + description: 'Force updates the content type even though the changes might result in data loss.', }), }; - static override description = - 'Push content type definitions to the CMS from a configuration file'; + static override description = 'Push content type definitions to the CMS from a configuration file'; static override examples = [ '<%= config.bin %> <%= command.id %>', '<%= config.bin %> <%= command.id %> ./custom-config.mjs', @@ -76,20 +70,13 @@ export default class ConfigPush extends BaseCommand { } //the pattern is relative to the config file - const configPathDirectory = pathToFileURL( - path.dirname(configFilePath), - ).href; + const configPathDirectory = pathToFileURL(path.dirname(configFilePath)).href; // extracts metadata(contentTypes, displayTemplates) from the component paths - const { contentTypes, displayTemplates } = await findMetaData( - componentPaths, - configPathDirectory, - ); + const { contentTypes, displayTemplates } = await findMetaData(componentPaths, configPathDirectory); // Validate and normalize property groups - const normalizedPropertyGroups = propertyGroups - ? normalizePropertyGroups(propertyGroups) - : []; + const normalizedPropertyGroups = propertyGroups ? normalizePropertyGroups(propertyGroups) : []; const metaData = { contentTypes: mapContentToManifest(contentTypes), @@ -143,9 +130,7 @@ export default class ConfigPush extends BaseCommand { if (response.error.status === 404) { spinner.fail(chalk.red('Feature Not Active')); console.error( - chalk.red( - 'The requested feature "preview3_packages_enabled" is not enabled in your environment.', - ), + chalk.red('The requested feature "preview3_packages_enabled" is not enabled in your environment.'), ); console.error( chalk.dim( diff --git a/packages/optimizely-cms-cli/src/commands/content/delete.ts b/packages/optimizely-cms-cli/src/commands/content/delete.ts index 29900516..05b9d61f 100644 --- a/packages/optimizely-cms-cli/src/commands/content/delete.ts +++ b/packages/optimizely-cms-cli/src/commands/content/delete.ts @@ -45,9 +45,7 @@ export default class ContentDelete extends BaseCommand { }); if (r.response.ok) { - spinner.succeed( - chalk.green(`Content type "${args.key}" deleted successfully`), - ); + spinner.succeed(chalk.green(`Content type "${args.key}" deleted successfully`)); } else { spinner.fail(chalk.red(`Failed to delete content type "${args.key}"`)); @@ -57,11 +55,7 @@ export default class ContentDelete extends BaseCommand { } else if (r.error.status === 409) { console.error(chalk.red('Cannot delete: Content type is in use')); } else { - console.error( - chalk.red( - `Error ${r.error.status}: ${r.error.title || 'Unknown error'}`, - ), - ); + console.error(chalk.red(`Error ${r.error.status}: ${r.error.title || 'Unknown error'}`)); if (r.error.detail) { console.error(chalk.dim(r.error.detail)); } diff --git a/packages/optimizely-cms-cli/src/commands/danger/delete-all-content-types.ts b/packages/optimizely-cms-cli/src/commands/danger/delete-all-content-types.ts index c9f7bcbb..1d820618 100644 --- a/packages/optimizely-cms-cli/src/commands/danger/delete-all-content-types.ts +++ b/packages/optimizely-cms-cli/src/commands/danger/delete-all-content-types.ts @@ -4,9 +4,7 @@ import { BaseCommand } from '../../baseCommand.js'; import ora from 'ora'; import { createApiClient } from '../../service/cmsRestClient.js'; -export default class DangerDeleteAllContentTypes extends BaseCommand< - typeof DangerDeleteAllContentTypes -> { +export default class DangerDeleteAllContentTypes extends BaseCommand { static override args = {}; static override description = '⚠️ [DANGER] Delete ALL user-defined content types from the CMS (excludes system types)'; @@ -42,9 +40,7 @@ export default class DangerDeleteAllContentTypes extends BaseCommand< process.exit(1); } - const deletedTypes = contentTypes.filter( - (t) => t.source !== 'system' && t.source !== 'serverModel', - ); + const deletedTypes = contentTypes.filter(t => t.source !== 'system' && t.source !== 'serverModel'); if (deletedTypes.length === 0) { console.log(chalk.yellow('There are no user-defined content types in the CMS')); diff --git a/packages/optimizely-cms-cli/src/commands/login.ts b/packages/optimizely-cms-cli/src/commands/login.ts index eaafcadb..a965292f 100644 --- a/packages/optimizely-cms-cli/src/commands/login.ts +++ b/packages/optimizely-cms-cli/src/commands/login.ts @@ -5,19 +5,14 @@ import { readEnvCredentials } from '../service/config.js'; import { getToken } from '../service/cmsRestClient.js'; export default class Login extends Command { - static override description = - 'Verify your Optimizely CMS credentials configured in environment variables'; - static override examples = [ - '<%= config.bin %> <%= command.id %>', - '<%= config.bin %> <%= command.id %> --verbose', - ]; + static override description = 'Verify your Optimizely CMS credentials configured in environment variables'; + static override examples = ['<%= config.bin %> <%= command.id %>', '<%= config.bin %> <%= command.id %> --verbose']; static override flags = { verbose: Flags.boolean({ description: 'Show detailed output during authentication', }), host: Flags.string({ - description: - 'CMS instance URL including scheme. For example: `https://my-instance.cms.optimizely.com`', + description: 'CMS instance URL including scheme. For example: `https://my-instance.cms.optimizely.com`', }), }; @@ -30,26 +25,17 @@ export default class Login extends Command { const spinner = ora('Checking your credentials...').start(); try { - const token = await getToken( - credentials.clientId, - credentials.clientSecret, - flags.host, - ); + const token = await getToken(credentials.clientId, credentials.clientSecret, flags.host); if (token) { spinner.succeed(chalk.green('Your credentials are correct')); if (flags.verbose) { - console.log( - chalk.dim('Client ID:'), - chalk.cyan(credentials.clientId), - ); + console.log(chalk.dim('Client ID:'), chalk.cyan(credentials.clientId)); console.log(chalk.dim('Token received successfully')); } } else { spinner.fail(chalk.red('The API did not return a token')); - console.error( - chalk.red('Authentication failed: No token received from the API'), - ); + console.error(chalk.red('Authentication failed: No token received from the API')); process.exit(1); } } catch (err) { diff --git a/packages/optimizely-cms-cli/src/generators/contentTypeGenerator.ts b/packages/optimizely-cms-cli/src/generators/contentTypeGenerator.ts index fd37881f..f9180d46 100644 --- a/packages/optimizely-cms-cli/src/generators/contentTypeGenerator.ts +++ b/packages/optimizely-cms-cli/src/generators/contentTypeGenerator.ts @@ -1,10 +1,6 @@ import { writeFile } from 'node:fs/promises'; import { join } from 'node:path'; -import { - ContentType, - ContentTypeProperties, - DisplayTemplate, -} from './manifest.js'; +import { ContentType, ContentTypeProperties, DisplayTemplate } from './manifest.js'; import { generateDisplayTemplateCode } from './displayTemplateGenerator.js'; /** @@ -19,20 +15,15 @@ export async function generateContentTypeFiles( currentGroup?: string, ): Promise { const generatedFiles = await Promise.all( - contentTypes.map(async (contentType) => { + contentTypes.map(async contentType => { const fileName = generateFileName(contentType.key); const filePath = join(outputDir, fileName); // Generate content type code - let fileContent = generateContentTypeCode( - contentType, - contentTypeToGroupMap, - currentGroup, - ); + let fileContent = generateContentTypeCode(contentType, contentTypeToGroupMap, currentGroup); // Append display templates for this specific content type - const relatedTemplates = - displayTemplatesByContentType.get(contentType.key) || []; + const relatedTemplates = displayTemplatesByContentType.get(contentType.key) || []; if (relatedTemplates.length > 0) { // Update import to include displayTemplate fileContent = fileContent.replace( @@ -73,9 +64,7 @@ export function cleanKey(key: string): string { const cleanKey = key.replace(/[^a-zA-Z0-9_]/g, ''); if (!cleanKey || !/[a-zA-Z0-9]/.test(cleanKey)) { - throw new Error( - `Invalid key "${key}": must contain at least one alphanumeric character`, - ); + throw new Error(`Invalid key "${key}": must contain at least one alphanumeric character`); } return cleanKey; @@ -102,18 +91,13 @@ export function generateContentTypeCode( // Collect component imports const componentImports = new Set(); - const properties = contentType.properties - ? generatePropertiesCode( - contentType.properties, - contentType.key, - componentImports, - ) - : '{}'; + const properties = + contentType.properties ? generatePropertiesCode(contentType.properties, contentType.key, componentImports) : '{}'; // Generate import statements const imports = ["import { contentType } from '@optimizely/cms-sdk';"]; if (componentImports.size > 0) { - const importStatements = Array.from(componentImports).map((key) => { + const importStatements = Array.from(componentImports).map(key => { const fileName = generateFileName(key); const exportName = generateExportName(key); @@ -134,16 +118,15 @@ export function generateContentTypeCode( // Generate compositionBehaviors if present const compositionBehaviors = - contentType.compositionBehaviors && - contentType.compositionBehaviors.length > 0 - ? `\n compositionBehaviors: [${contentType.compositionBehaviors.map((b) => `'${escapeSingleQuote(b)}'`).join(', ')}],` - : ''; + contentType.compositionBehaviors && contentType.compositionBehaviors.length > 0 ? + `\n compositionBehaviors: [${contentType.compositionBehaviors.map(b => `'${escapeSingleQuote(b)}'`).join(', ')}],` + : ''; // Generate mayContainTypes if present const mayContainTypes = - contentType.mayContainTypes && contentType.mayContainTypes.length > 0 - ? `\n mayContainTypes: [${contentType.mayContainTypes.map((t) => `'${escapeSingleQuote(t)}'`).join(', ')}],` - : ''; + contentType.mayContainTypes && contentType.mayContainTypes.length > 0 ? + `\n mayContainTypes: [${contentType.mayContainTypes.map(t => `'${escapeSingleQuote(t)}'`).join(', ')}],` + : ''; const code = `${imports.join('\n')} @@ -179,14 +162,8 @@ function generatePropertiesCode( componentImports: Set, ): string { const propertyEntries = Object.entries(properties).map(([name, prop]) => { - const safeKey = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name) - ? name - : `'${escapeSingleQuote(name)}'`; - const propertyDef = generatePropertyDefinition( - prop, - contentTypeKey, - componentImports, - ); + const safeKey = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name) ? name : `'${escapeSingleQuote(name)}'`; + const propertyDef = generatePropertyDefinition(prop, contentTypeKey, componentImports); return ` ${safeKey}: ${propertyDef}`; }); @@ -201,10 +178,7 @@ function generatePropertiesCode( * Pushes common metadata fields to the parts array. * Handles: displayName, description, isRequired, isLocalized, group, sortOrder, indexingType */ -function pushMetadataFields( - property: ContentTypeProperties.Base, - parts: string[], -): void { +function pushMetadataFields(property: ContentTypeProperties.Base, parts: string[]): void { if ('displayName' in property && property.displayName) { parts.push(`displayName: '${escapeSingleQuote(property.displayName)}'`); } @@ -244,11 +218,7 @@ function generatePropertyDefinition( ): string { if ('items' in property && property.type === 'array') { // Array type - generate items definition - const itemDef = generatePropertyDefinition( - property.items, - contentTypeKey, - componentImports, - ); + const itemDef = generatePropertyDefinition(property.items, contentTypeKey, componentImports); // Collect array-level properties const parts: string[] = []; @@ -301,7 +271,7 @@ function generatePropertyDefinition( const normalized = normalizeEnumValues(property.enum, 'string'); const enumValues = normalized .map( - (v) => + v => `\n { value: '${escapeSingleQuote(String(v.value))}', displayName: '${escapeSingleQuote(v.displayName)}' }`, ) .join(','); @@ -322,10 +292,7 @@ function generatePropertyDefinition( if ('enum' in property && property.enum) { const normalized = normalizeEnumValues(property.enum, 'number'); const enumValues = normalized - .map( - (v) => - `\n { value: ${v.value}, displayName: '${escapeSingleQuote(v.displayName)}' }`, - ) + .map(v => `\n { value: ${v.value}, displayName: '${escapeSingleQuote(v.displayName)}' }`) .join(','); parts.push(`enum: [${enumValues},\n ]`); } @@ -344,26 +311,18 @@ function generatePropertyDefinition( // Content/ContentReference-specific properties if (property.type === 'content' || property.type === 'contentReference') { - if ( - 'allowedTypes' in property && - property.allowedTypes && - property.allowedTypes.length > 0 - ) { + if ('allowedTypes' in property && property.allowedTypes && property.allowedTypes.length > 0) { const types = property.allowedTypes - .map((t) => (t === '_self' ? contentTypeKey : t)) - .map((t) => `'${escapeSingleQuote(t)}'`) + .map(t => (t === '_self' ? contentTypeKey : t)) + .map(t => `'${escapeSingleQuote(t)}'`) .join(', '); parts.push(`allowedTypes: [${types}]`); } - if ( - 'restrictedTypes' in property && - property.restrictedTypes && - property.restrictedTypes.length > 0 - ) { + if ('restrictedTypes' in property && property.restrictedTypes && property.restrictedTypes.length > 0) { const types = property.restrictedTypes - .map((t) => (t === '_self' ? contentTypeKey : t)) - .map((t) => `'${escapeSingleQuote(t)}'`) + .map(t => (t === '_self' ? contentTypeKey : t)) + .map(t => `'${escapeSingleQuote(t)}'`) .join(', '); parts.push(`restrictedTypes: [${types}]`); } @@ -441,3 +400,4 @@ export function escapeSingleQuote(str: string): string { // Escape single quotes for single-quoted string literals return withoutOuterQuotes.replace(/'/g, "\\'"); } + diff --git a/packages/optimizely-cms-cli/src/generators/displayTemplateGenerator.ts b/packages/optimizely-cms-cli/src/generators/displayTemplateGenerator.ts index ecb5392e..f083099b 100644 --- a/packages/optimizely-cms-cli/src/generators/displayTemplateGenerator.ts +++ b/packages/optimizely-cms-cli/src/generators/displayTemplateGenerator.ts @@ -1,11 +1,7 @@ import { writeFile } from 'node:fs/promises'; import { join } from 'node:path'; import { DisplayTemplate } from './manifest.js'; -import { - cleanKey, - escapeSingleQuote, - generateFileName, -} from './contentTypeGenerator.js'; +import { cleanKey, escapeSingleQuote, generateFileName } from './contentTypeGenerator.js'; /** * Generates TypeScript display template definition files from a manifest @@ -15,7 +11,7 @@ export async function generateDisplayTemplateFiles( outputDir: string, ): Promise { const generatedFiles = await Promise.all( - displayTemplates.map(async (displayTemplate) => { + displayTemplates.map(async displayTemplate => { const fileName = generateFileName(displayTemplate.key); const filePath = join(outputDir, fileName); const fileContent = generateDisplayTemplateCode(displayTemplate); @@ -66,25 +62,19 @@ export function generateDisplayTemplateCode(displayTemplate: DisplayTemplate): s const optionalFields: string[] = []; if (displayTemplate.displayName) { - optionalFields.push( - `displayName: '${escapeSingleQuote(displayTemplate.displayName)}'`, - ); + optionalFields.push(`displayName: '${escapeSingleQuote(displayTemplate.displayName)}'`); } if (displayTemplate.isDefault !== undefined) { optionalFields.push(`isDefault: ${displayTemplate.isDefault}`); } - if ( - displayTemplate.settings && - Object.keys(displayTemplate.settings).length > 0 - ) { + if (displayTemplate.settings && Object.keys(displayTemplate.settings).length > 0) { const settingsCode = generateSettingsCode(displayTemplate.settings, 2); optionalFields.push(`settings: ${settingsCode}`); } - const optionalFieldsStr = - optionalFields.length > 0 ? ',\n ' + optionalFields.join(',\n ') : ''; + const optionalFieldsStr = optionalFields.length > 0 ? ',\n ' + optionalFields.join(',\n ') : ''; const code = `import { displayTemplate } from '@optimizely/cms-sdk'; @@ -111,17 +101,12 @@ function generateExportName(key: string): string { /** * Generates TypeScript code for settings object */ -function generateSettingsCode( - settings: Record, - indentLevel: number = 0, -): string { +function generateSettingsCode(settings: Record, indentLevel: number = 0): string { const indent = ' '.repeat(indentLevel); const innerIndent = ' '.repeat(indentLevel + 1); const entries = Object.entries(settings).map(([key, value]) => { - const safeKey = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key) - ? key - : `'${escapeSingleQuote(key)}'`; + const safeKey = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key) ? key : `'${escapeSingleQuote(key)}'`; const valueCode = generateValueCode(value, indentLevel + 1); return `${innerIndent}${safeKey}: ${valueCode}`; }); @@ -159,9 +144,7 @@ function generateValueCode(value: any, indentLevel: number): string { } const indent = ' '.repeat(indentLevel); const innerIndent = ' '.repeat(indentLevel + 1); - const items = value.map( - (item) => `${innerIndent}${generateValueCode(item, indentLevel + 1)}`, - ); + const items = value.map(item => `${innerIndent}${generateValueCode(item, indentLevel + 1)}`); return `[\n${items.join(',\n')},\n${indent}]`; } @@ -171,4 +154,3 @@ function generateValueCode(value: any, indentLevel: number): string { return String(value); } - diff --git a/packages/optimizely-cms-cli/src/generators/manifest.ts b/packages/optimizely-cms-cli/src/generators/manifest.ts index 84edb3a7..41e03ff9 100644 --- a/packages/optimizely-cms-cli/src/generators/manifest.ts +++ b/packages/optimizely-cms-cli/src/generators/manifest.ts @@ -5,11 +5,7 @@ * They're based on SDK types but adapted for the generator's expectations. */ -import { - ContentTypes, - Properties, - DisplayTemplates, -} from '@optimizely/cms-sdk'; +import { ContentTypes, Properties, DisplayTemplates } from '@optimizely/cms-sdk'; /** Manifest - the JSON accepted/returned by the API */ export type Manifest = { @@ -24,9 +20,7 @@ export type Manifest = { * - Simplified settings type (Record instead of structured SettingsType) * - No __type marker or tag field */ -export type DisplayTemplate = Partial< - Omit -> & { +export type DisplayTemplate = Partial> & { key: string; settings?: Record; }; @@ -38,10 +32,7 @@ export type DisplayTemplate = Partial< * - properties uses our adapted ContentTypeProperties.All * - compositionBehaviors added as optional (only on ComponentContentType in SDK, but needed at API level) */ -export type ContentType = Omit< - ContentTypes.AnyContentType, - 'mayContainTypes' | 'properties' -> & { +export type ContentType = Omit & { mayContainTypes?: string[]; properties?: Record; compositionBehaviors?: ('sectionEnabled' | 'elementEnabled')[]; @@ -89,18 +80,12 @@ export namespace ContentTypeProperties { }; // Content/ContentReference properties - allowedTypes/restrictedTypes must be strings for API format - export type Content = Omit< - Properties.ContentProperty, - 'allowedTypes' | 'restrictedTypes' - > & { + export type Content = Omit & { allowedTypes?: string[]; restrictedTypes?: string[]; }; - export type ContentReference = Omit< - Properties.ContentReferenceProperty, - 'allowedTypes' | 'restrictedTypes' - > & { + export type ContentReference = Omit & { allowedTypes?: string[]; restrictedTypes?: string[]; }; @@ -114,10 +99,7 @@ export namespace ContentTypeProperties { export type Json = Properties.JsonProperty; export type Link = Properties.LinkProperty; // Component property - contentType must be string for API format - export type Component = Omit< - Properties.ComponentProperty, - 'contentType' - > & { + export type Component = Omit, 'contentType'> & { contentType: string; }; diff --git a/packages/optimizely-cms-cli/src/hooks/init/logo.ts b/packages/optimizely-cms-cli/src/hooks/init/logo.ts index 51e03e45..59aa0e66 100644 --- a/packages/optimizely-cms-cli/src/hooks/init/logo.ts +++ b/packages/optimizely-cms-cli/src/hooks/init/logo.ts @@ -2,10 +2,8 @@ import { Hook } from '@oclif/core'; const hook: Hook<'init'> = async function (opts) { // Only show logo for help command or when --help flag is used - const showHelp = opts.id === 'help' || - process.argv.includes('--help') || - process.argv.includes('-h') || - process.argv.length === 2; // No args provided + const showHelp = + opts.id === 'help' || process.argv.includes('--help') || process.argv.includes('-h') || process.argv.length === 2; // No args provided if (showHelp) { console.log(''); diff --git a/packages/optimizely-cms-cli/src/mapper/contentToPackage.ts b/packages/optimizely-cms-cli/src/mapper/contentToPackage.ts index 6835d596..7ebe9ba3 100644 --- a/packages/optimizely-cms-cli/src/mapper/contentToPackage.ts +++ b/packages/optimizely-cms-cli/src/mapper/contentToPackage.ts @@ -1,9 +1,5 @@ import { AnyContentType } from '../service/utils.js'; -import { - transformProperties, - validateContentTypeKey, - parseChildContentType, -} from '../utils/mapping.js'; +import { transformProperties, validateContentTypeKey, parseChildContentType } from '../utils/mapping.js'; import chalk from 'chalk'; /** @@ -13,10 +9,7 @@ import chalk from 'chalk'; * @param allowedKeys - Set of valid content type keys for validation. * @returns */ -function transformContentType( - contentType: AnyContentType, - allowedKeys?: Set, -): any { +function transformContentType(contentType: AnyContentType, allowedKeys?: Set): any { validateContentTypeKey(contentType.key); const { key, properties = {} } = contentType; @@ -60,8 +53,6 @@ export function mapContentToManifest(contentTypes: AnyContentType[]): any[] { ); } - const allowedKeys = new Set(deduplicatedContentTypes.map((ct) => ct.key)); - return deduplicatedContentTypes.map((ct) => - transformContentType(ct, allowedKeys), - ); + const allowedKeys = new Set(deduplicatedContentTypes.map(ct => ct.key)); + return deduplicatedContentTypes.map(ct => transformContentType(ct, allowedKeys)); } diff --git a/packages/optimizely-cms-cli/src/service/apiSchema/openapi-schema-types.ts b/packages/optimizely-cms-cli/src/service/apiSchema/openapi-schema-types.ts index b8cb7fce..41edfa10 100644 --- a/packages/optimizely-cms-cli/src/service/apiSchema/openapi-schema-types.ts +++ b/packages/optimizely-cms-cli/src/service/apiSchema/openapi-schema-types.ts @@ -1,4247 +1,4310 @@ export interface paths { - "/blueprints": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List blueprints - * @description List blueprints using the provided parameters. - */ - get: operations["Blueprints_List"]; - put?: never; - /** - * Create blueprint - * @description Create a new blueprint. - */ - post: operations["Blueprints_Create"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/blueprints/{key}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get blueprint - * @description Get the blueprint with the provided key. - */ - get: operations["Blueprints_Get"]; - put?: never; - post?: never; - /** - * Delete blueprint - * @description Deletes the blueprint with the provided key. - */ - delete: operations["Blueprints_Delete"]; - options?: never; - head?: never; - /** - * Patch blueprint - * @description Patch an existing blueprint. - */ - patch: operations["Blueprints_Patch"]; - trace?: never; - }; - "/content": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Create content - * @description Create a new content item. - */ - post: operations["Content_Create"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}:copy": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Copy content - * @description Create a copy of the content item with the provided key. - */ - post: operations["Content_Copy"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}:undelete": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Restore content - * @description Restore the deleted content item with the provided key. If a content item with the provided key is not deleted an error is returned. - */ - post: operations["Content_Undelete"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get content node - * @description Get content node with the provided key. - */ - get: operations["Content_GetNode"]; - put?: never; - post?: never; - /** - * Delete content - * @description Deletes the content item with the provided key. If a content item with the provided key does not exist an error is returned. - */ - delete: operations["Content_Delete"]; - options?: never; - head?: never; - /** - * Patch content - * @description Patch an existing content item. If a content item with the provided key does not exist an error is returned. - */ - patch: operations["Content_PatchNode"]; - trace?: never; + '/blueprints': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - "/content/{key}/assets": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List assets - * @description List the assets that belongs to a content instance. - */ - get: operations["Content_ListAssets"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/items": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List content in container - * @description List the content items located in a specific container. - */ - get: operations["Content_ListItems"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/locales/{locale}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List locale versions - * @description List versions of the content with the provided key and locale. - */ - get: operations["Content_ListLocaleVersions"]; - put?: never; - post?: never; - /** - * Delete locale - * @description Deletes a branch of the content with the provided key and locale. Returns the published or latest content item in the locale that was deleted. If a content item with the provided key does not exist an error is returned. - */ - delete: operations["Content_DeleteLocale"]; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/path": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get content path - * @description Get the content path with the provided key. - */ - get: operations["Content_GetPath"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/versions": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List versions - * @description List versions of the content item with the provided key and the provided options. - */ - get: operations["Content_ListVersions"]; - put?: never; - /** - * Create version - * @description Create a new version of a content item. - */ - post: operations["Content_CreateVersion"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/versions/{version}:approve": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Approve the active step of an approval for a content version that is in review. For multi-step approvals, the version remains in review until all steps are approved. */ - post: operations["Content_Approve"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/versions/{version}:draft": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Change content version into draft status. */ - post: operations["Content_Draft"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/versions/{version}:publish": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Publish content version */ - post: operations["Content_Publish"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/versions/{version}:ready": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Make content ready to publish, if approvals are required the version will automatically be moved to in review. */ - post: operations["Content_Ready"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/versions/{version}:reject": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** Reject a content version that is in review. The version transitions to rejected status regardless of remaining approval steps. */ - post: operations["Content_Reject"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/{key}/versions/{version}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get version - * @description Get the content item with the provided key and version. - */ - get: operations["Content_GetVersion"]; - put?: never; - post?: never; - /** - * Delete version - * @description Deletes the content item with the provided key and version and returns the deleted item. If a content item with the provided key does not exist an error is returned. - */ - delete: operations["Content_DeleteVersion"]; - options?: never; - head?: never; - /** - * Patch version - * @description Patch an existing content item and returns the updated content item. If a content item with the provided key does not exist an error is returned. - */ - patch: operations["Content_PatchVersion"]; - trace?: never; + /** + * List blueprints + * @description List blueprints using the provided parameters. + */ + get: operations['Blueprints_List']; + put?: never; + /** + * Create blueprint + * @description Create a new blueprint. + */ + post: operations['Blueprints_Create']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/blueprints/{key}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - "/content/{key}/versions/{version}/media": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Download content media file. - * @description Download the media file for a specific content item version. - */ - get: operations["Content_GetMedia"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/content/versions": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Query versions - * @description List content versions based on the provided query options. - */ - get: operations["Content_ListAllVersions"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/contentsources": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List content sources - * @description List content sources using the provided options. - */ - get: operations["ContentSources_List"]; - put?: never; - /** - * Create contentsource - * @description Create a new contentsource. - */ - post: operations["ContentSources_Create"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/contentsources/{key}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get contentsource - * @description Get the contentsource with the provided key. - */ - get: operations["ContentSources_Get"]; - put?: never; - post?: never; - /** - * Delete contentsource - * @description Deletes the contentsource with the provided key. - */ - delete: operations["ContentSources_Delete"]; - options?: never; - head?: never; - /** - * Patch contentsource - * @description Patch an existing contentsource. - */ - patch: operations["ContentSources_Patch"]; - trace?: never; + /** + * Get blueprint + * @description Get the blueprint with the provided key. + */ + get: operations['Blueprints_Get']; + put?: never; + post?: never; + /** + * Delete blueprint + * @description Deletes the blueprint with the provided key. + */ + delete: operations['Blueprints_Delete']; + options?: never; + head?: never; + /** + * Patch blueprint + * @description Patch an existing blueprint. + */ + patch: operations['Blueprints_Patch']; + trace?: never; + }; + '/content': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - "/contenttypebindings": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List content type bindings - * @description List type bindings using the provided options. - */ - get: operations["ContentTypeBindings_List"]; - put?: never; - /** - * Create contenttypebinding - * @description Create a new contenttypebinding. - */ - post: operations["ContentTypeBindings_Create"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/contenttypebindings/{key}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get contenttypebinding - * @description Get the contenttypebinding with the provided key. - */ - get: operations["ContentTypeBindings_Get"]; - put?: never; - post?: never; - /** - * Delete contenttypebinding - * @description Deletes the contenttypebinding with the provided key. - */ - delete: operations["ContentTypeBindings_Delete"]; - options?: never; - head?: never; - /** - * Patch contenttypebinding - * @description Patch an existing contenttypebinding. - */ - patch: operations["ContentTypeBindings_Patch"]; - trace?: never; + get?: never; + put?: never; + /** + * Create content + * @description Create a new content item. + */ + post: operations['Content_Create']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}:copy': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - "/contenttypes": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List content types - * @description List content types using the provided parameters. - */ - get: operations["ContentTypes_List"]; - put?: never; - /** - * Create content type - * @description Create a new content type. - */ - post: operations["ContentTypes_Create"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/contenttypes/{key}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get content type - * @description Get the content type with the provided key. - */ - get: operations["ContentTypes_Get"]; - put?: never; - post?: never; - /** - * Delete content type - * @description Deletes the content type with the provided key. - */ - delete: operations["ContentTypes_Delete"]; - options?: never; - head?: never; - /** - * Patch content type - * @description Patch an existing content type. - */ - patch: operations["ContentTypes_Patch"]; - trace?: never; + get?: never; + put?: never; + /** + * Copy content + * @description Create a copy of the content item with the provided key. + */ + post: operations['Content_Copy']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}:undelete': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - "/displaytemplates": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List display templates - * @description List display templates using the provided parameters. - */ - get: operations["DisplayTemplates_List"]; - put?: never; - /** - * Create display template - * @description Create a new display template. - */ - post: operations["DisplayTemplates_Create"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/displaytemplates/{key}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get display template - * @description Get the display template with the provided key. - */ - get: operations["DisplayTemplates_Get"]; - put?: never; - post?: never; - /** - * Delete display template - * @description Deletes the display template with the provided key. - */ - delete: operations["DisplayTemplates_Delete"]; - options?: never; - head?: never; - /** - * Patch display template - * @description Patch an existing display template. - */ - patch: operations["DisplayTemplates_Patch"]; - trace?: never; + get?: never; + put?: never; + /** + * Restore content + * @description Restore the deleted content item with the provided key. If a content item with the provided key is not deleted an error is returned. + */ + post: operations['Content_Undelete']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - "/locales": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List locales - * @description List all locales (language branches) available in the CMS. - */ - get: operations["Locales_List"]; - put?: never; - /** - * Create locale - * @description Create a new locale. - */ - post: operations["Locales_Create"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/locales/{key}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get locale - * @description Get the locale with the provided key. - */ - get: operations["Locales_Get"]; - put?: never; - post?: never; - /** - * Delete locale - * @description Deletes the locale with the provided key. - */ - delete: operations["Locales_Delete"]; - options?: never; - head?: never; - /** - * Patch locale - * @description Patch an existing locale. - */ - patch: operations["Locales_Patch"]; - trace?: never; + /** + * Get content node + * @description Get content node with the provided key. + */ + get: operations['Content_GetNode']; + put?: never; + post?: never; + /** + * Delete content + * @description Deletes the content item with the provided key. If a content item with the provided key does not exist an error is returned. + */ + delete: operations['Content_Delete']; + options?: never; + head?: never; + /** + * Patch content + * @description Patch an existing content item. If a content item with the provided key does not exist an error is returned. + */ + patch: operations['Content_PatchNode']; + trace?: never; + }; + '/content/{key}/assets': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - "/manifest": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Export manifest - * @description Export a CMS content manifest. - */ - get: operations["Manifest_Export"]; - put?: never; - /** - * Import manifest - * @description Import a CMS content manifest. - */ - post: operations["Manifest_Import"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/propertyformats": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List property formats - * @description List all property formats using the provided options. - */ - get: operations["PropertyFormats_List"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/propertyformats/{key}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get property format - * @description Get the property format with the provided key. - */ - get: operations["PropertyFormats_Get"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/propertygroups": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * List property groups - * @description List property groups using the provided options. - */ - get: operations["PropertyGroups_List"]; - put?: never; - /** - * Create property group - * @description Create a new property group. - */ - post: operations["PropertyGroups_Create"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/propertygroups/{key}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get property group - * @description Get the property group with the provided key. - */ - get: operations["PropertyGroups_Get"]; - put?: never; - post?: never; - /** - * Delete property group - * @description Deletes the property group with the provided key. - */ - delete: operations["PropertyGroups_Delete"]; - options?: never; - head?: never; - /** - * Patch property group - * @description Patch an existing property group. - */ - patch: operations["PropertyGroups_Patch"]; - trace?: never; + /** + * List assets + * @description List the assets that belongs to a content instance. + */ + get: operations['Content_ListAssets']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/items': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List content in container + * @description List the content items located in a specific container. + */ + get: operations['Content_ListItems']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/locales/{locale}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List locale versions + * @description List versions of the content with the provided key and locale. + */ + get: operations['Content_ListLocaleVersions']; + put?: never; + post?: never; + /** + * Delete locale + * @description Deletes a branch of the content with the provided key and locale. Returns the published or latest content item in the locale that was deleted. If a content item with the provided key does not exist an error is returned. + */ + delete: operations['Content_DeleteLocale']; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/path': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get content path + * @description Get the content path with the provided key. + */ + get: operations['Content_GetPath']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/versions': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List versions + * @description List versions of the content item with the provided key and the provided options. + */ + get: operations['Content_ListVersions']; + put?: never; + /** + * Create version + * @description Create a new version of a content item. + */ + post: operations['Content_CreateVersion']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/versions/{version}:approve': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Approve the active step of an approval for a content version that is in review. For multi-step approvals, the version remains in review until all steps are approved. */ + post: operations['Content_Approve']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/versions/{version}:draft': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Change content version into draft status. */ + post: operations['Content_Draft']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/versions/{version}:publish': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Publish content version */ + post: operations['Content_Publish']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/versions/{version}:ready': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Make content ready to publish, if approvals are required the version will automatically be moved to in review. */ + post: operations['Content_Ready']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/versions/{version}:reject': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; + get?: never; + put?: never; + /** Reject a content version that is in review. The version transitions to rejected status regardless of remaining approval steps. */ + post: operations['Content_Reject']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/{key}/versions/{version}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get version + * @description Get the content item with the provided key and version. + */ + get: operations['Content_GetVersion']; + put?: never; + post?: never; + /** + * Delete version + * @description Deletes the content item with the provided key and version and returns the deleted item. If a content item with the provided key does not exist an error is returned. + */ + delete: operations['Content_DeleteVersion']; + options?: never; + head?: never; + /** + * Patch version + * @description Patch an existing content item and returns the updated content item. If a content item with the provided key does not exist an error is returned. + */ + patch: operations['Content_PatchVersion']; + trace?: never; + }; + '/content/{key}/versions/{version}/media': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Download content media file. + * @description Download the media file for a specific content item version. + */ + get: operations['Content_GetMedia']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/content/versions': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Query versions + * @description List content versions based on the provided query options. + */ + get: operations['Content_ListAllVersions']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/contentsources': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List content sources + * @description List content sources using the provided options. + */ + get: operations['ContentSources_List']; + put?: never; + /** + * Create contentsource + * @description Create a new contentsource. + */ + post: operations['ContentSources_Create']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/contentsources/{key}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get contentsource + * @description Get the contentsource with the provided key. + */ + get: operations['ContentSources_Get']; + put?: never; + post?: never; + /** + * Delete contentsource + * @description Deletes the contentsource with the provided key. + */ + delete: operations['ContentSources_Delete']; + options?: never; + head?: never; + /** + * Patch contentsource + * @description Patch an existing contentsource. + */ + patch: operations['ContentSources_Patch']; + trace?: never; + }; + '/contenttypebindings': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List content type bindings + * @description List type bindings using the provided options. + */ + get: operations['ContentTypeBindings_List']; + put?: never; + /** + * Create contenttypebinding + * @description Create a new contenttypebinding. + */ + post: operations['ContentTypeBindings_Create']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/contenttypebindings/{key}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get contenttypebinding + * @description Get the contenttypebinding with the provided key. + */ + get: operations['ContentTypeBindings_Get']; + put?: never; + post?: never; + /** + * Delete contenttypebinding + * @description Deletes the contenttypebinding with the provided key. + */ + delete: operations['ContentTypeBindings_Delete']; + options?: never; + head?: never; + /** + * Patch contenttypebinding + * @description Patch an existing contenttypebinding. + */ + patch: operations['ContentTypeBindings_Patch']; + trace?: never; + }; + '/contenttypes': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List content types + * @description List content types using the provided parameters. + */ + get: operations['ContentTypes_List']; + put?: never; + /** + * Create content type + * @description Create a new content type. + */ + post: operations['ContentTypes_Create']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/contenttypes/{key}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get content type + * @description Get the content type with the provided key. + */ + get: operations['ContentTypes_Get']; + put?: never; + post?: never; + /** + * Delete content type + * @description Deletes the content type with the provided key. + */ + delete: operations['ContentTypes_Delete']; + options?: never; + head?: never; + /** + * Patch content type + * @description Patch an existing content type. + */ + patch: operations['ContentTypes_Patch']; + trace?: never; + }; + '/displaytemplates': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List display templates + * @description List display templates using the provided parameters. + */ + get: operations['DisplayTemplates_List']; + put?: never; + /** + * Create display template + * @description Create a new display template. + */ + post: operations['DisplayTemplates_Create']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/displaytemplates/{key}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get display template + * @description Get the display template with the provided key. + */ + get: operations['DisplayTemplates_Get']; + put?: never; + post?: never; + /** + * Delete display template + * @description Deletes the display template with the provided key. + */ + delete: operations['DisplayTemplates_Delete']; + options?: never; + head?: never; + /** + * Patch display template + * @description Patch an existing display template. + */ + patch: operations['DisplayTemplates_Patch']; + trace?: never; + }; + '/locales': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List locales + * @description List all locales (language branches) available in the CMS. + */ + get: operations['Locales_List']; + put?: never; + /** + * Create locale + * @description Create a new locale. + */ + post: operations['Locales_Create']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/locales/{key}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get locale + * @description Get the locale with the provided key. + */ + get: operations['Locales_Get']; + put?: never; + post?: never; + /** + * Delete locale + * @description Deletes the locale with the provided key. + */ + delete: operations['Locales_Delete']; + options?: never; + head?: never; + /** + * Patch locale + * @description Patch an existing locale. + */ + patch: operations['Locales_Patch']; + trace?: never; + }; + '/manifest': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Export manifest + * @description Export a CMS content manifest. + */ + get: operations['Manifest_Export']; + put?: never; + /** + * Import manifest + * @description Import a CMS content manifest. + */ + post: operations['Manifest_Import']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/propertyformats': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List property formats + * @description List all property formats using the provided options. + */ + get: operations['PropertyFormats_List']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/propertyformats/{key}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get property format + * @description Get the property format with the provided key. + */ + get: operations['PropertyFormats_Get']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/propertygroups': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List property groups + * @description List property groups using the provided options. + */ + get: operations['PropertyGroups_List']; + put?: never; + /** + * Create property group + * @description Create a new property group. + */ + post: operations['PropertyGroups_Create']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/propertygroups/{key}': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get property group + * @description Get the property group with the provided key. + */ + get: operations['PropertyGroups_Get']; + put?: never; + post?: never; + /** + * Delete property group + * @description Deletes the property group with the provided key. + */ + delete: operations['PropertyGroups_Delete']; + options?: never; + head?: never; + /** + * Patch property group + * @description Patch an existing property group. + */ + patch: operations['PropertyGroups_Patch']; + trace?: never; + }; } export type webhooks = Record; export interface components { - schemas: { - /** @description Options for approving or rejecting a content version. */ - ApprovalDecisionOptions: { - /** @description An optional comment to include with the approval decision. May be required depending on the approval definition configuration. */ - comment?: string | null; - /** @description Indicates if the approval should be forced, bypassing the normal approval flow. Requires 'admin' access rights. */ - force?: boolean; - }; - /** @description Describes the items of a content type property of type 'array'. */ - ArrayItem: { - /** - * @description The fundamental data type for the items in the array (e.g., string, integer, content reference). - * @enum {string} - */ - type: "string" | "url" | "boolean" | "integer" | "float" | "dateTime" | "contentReference" | "content" | "link" | "richText" | "json" | "component"; - /** @description The property format that defines specialized handling and validation for this array item. */ - format?: string; - /** @description The content type that items in the array may contain, when the 'type' is set to 'component'. */ - contentType?: string; - /** @description The minimum value that properties of this type should be able to contain. Value type must match the type of the array item. */ - minimum?: ((number | null) | (number | null) | (string | null) | (string | null)) | null; - /** @description The maximum value that array items of this type should be able to contain. Value type must match the type of the array item. */ - maximum?: ((number | null) | (number | null) | (string | null) | (string | null)) | null; - /** - * Format: int32 - * @description The minimum string length that array items of this type should be able to contain. - */ - minLength?: number | null; - /** - * Format: int32 - * @description The maximum string length that array items of this type should be able to contain. - */ - maxLength?: number | null; - /** - * Format: regex - * @description Regular expression pattern that limits what strings that array items of this type should be able to contain. - */ - pattern?: string; - /** @description A predefined list of allowed values for array items of this type. The enumeration values must match the property's data type. Allowed for string, integer, float and date-time property types. */ - enum?: components["schemas"]["EnumerationValue"][] | null; - /** @description Defines content and base types that array items of this type may contain. */ - allowedTypes?: string[]; - /** @description Defines content and base types that array items of this type may not contain. */ - restrictedTypes?: string[]; - /** @description Defines editor specific settings for this item. The settings are specific to the item and editor type. */ - editorSettings?: { - [key: string]: unknown; - } | null; - }; - /** @description Represents a blueprint of a content item. */ - Blueprint: { - /** @description The unique identifier (key) of the resource. */ - key?: string; - /** @description The display name of this blueprint. */ - displayName: string; - /** @description The content type of this blueprint. */ - readonly contentType: string; - /** - * Format: date-time - * @description A timestamp indicating when this resource was first created. - */ - readonly created?: string; - /** @description The name of the user or application that created this resource. */ - readonly createdBy?: string; - /** - * Format: date-time - * @description Indicates the last time this resource was modified. - */ - readonly lastModified?: string; - /** @description The name of the user or application that last modified this resource. */ - readonly lastModifiedBy?: string; - content: components["schemas"]["BlueprintData"]; - }; - /** @description Represents the data part of a Blueprint. */ - BlueprintData: components["schemas"]["ContentData"] & { - composition?: components["schemas"]["CompositionNode"]; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - BlueprintPage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["Blueprint"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description Defines display settings for a CompositionNode."/> */ - CompositionDisplaySettings: { - /** @description The display template that these settings apply to. */ - displayTemplate: string; - /** @description The display settings of this CompositionNode. */ - settings?: { - [key: string]: string; - } | null; - }; - /** @description Specifies a node in a content composition. */ - CompositionNode: { - /** @description Specifies an identifier of this CompositionNode. */ - id?: string; - /** @description The display name of this ContentType. */ - displayName?: string; - /** @description The node type of this CompositionNode. */ - nodeType: string; - /** @description The node layout type of this CompositionNode */ - layoutType?: string; - displaySettings?: components["schemas"]["CompositionDisplaySettings"]; - /** @description Represents a content component. */ - component?: components["schemas"]["ContentData"] & { - /** @description An optional display option for the content component. */ - displayOption?: string; - /** @description An optional group for the personalizable component. */ - segmentationGroup?: string; - /** @description Specifies the settings for the content component. */ - segments?: string[] | null; - /** @description The display name of the content component. If 'reference' is set, the name is automatically set to the name of the referenced content. */ - displayName?: string; - /** - * Format: uri - * @description A reference to the content of this component. Cannot be assigned together with 'contentType' or 'properties'. - */ - reference?: string | null; - /** @description The key of the content type that this is an embedded instance of. */ - contentType?: string; - }; - /** @description The child nodes for this CompositionNode. */ - nodes?: components["schemas"]["CompositionNode"][] | null; - }; - /** @description Associates a content item with another source content item, establishing a relationship defined by a content type binding. Used for linking managed content to external or reference content. */ - ContentBinding: { - /** @description The binding definition key that controls how the source content item is linked and accessed. */ - contentTypeBinding?: string; - /** - * Format: uri - * @description The reference to the source content item that is being bound. This cannot be empty. - */ - source: string; - }; - /** @description Represents a content component. */ - ContentComponent: components["schemas"]["ContentData"] & { - /** @description An optional display option for the content component. */ - displayOption?: string; - /** @description An optional group for the personalizable component. */ - segmentationGroup?: string; - /** @description Specifies the settings for the content component. */ - segments?: string[] | null; - /** @description The display name of the content component. If 'reference' is set, the name is automatically set to the name of the referenced content. */ - displayName?: string; - /** - * Format: uri - * @description A reference to the content of this component. Cannot be assigned together with 'contentType' or 'properties'. - */ - reference?: string | null; - /** @description The key of the content type that this is an embedded instance of. */ - contentType?: string; - }; - /** @description Base structure for content data. Contains properties defined by the content type and optional bindings to source content. Property values must conform to the types defined in the associated ContentType definition. */ - ContentData: { - binding?: components["schemas"]["ContentBinding"]; - /** @description Properties as they are defined by corresponding component or content type. */ - properties?: { - [key: string]: components["schemas"]["PropertyData"]; - }; - }; - /** @description Metadata about a content item in the content hierarchy, including ownership, localization, and audit information. This represents the structural information without the actual property values. */ - ContentNode: { - /** @description The unique identifier (key) of the resource. */ - key?: string; - /** @description The content item that contains this item in the hierarchy. */ - container?: string; - /** @description The content item that owns this item. Content that is owned by another content is also known as an asset. Cannot be combined with container. */ - owner?: string; - /** @description The content type that defines the structure and available properties for this item. */ - readonly contentType?: string; - /** @description The locale for which this content was originally created. This locale will include properties that are shared across all locales. */ - readonly primaryLocale?: string; - /** @description The complete list of locales for which this content has been created for. */ - locales?: string[]; - /** - * Format: date-time - * @description The date and time when this content was last modified. - */ - readonly lastModified?: string; - /** @description The username of the user that last modified this content. */ - readonly lastModifiedBy?: string; - /** - * Format: date-time - * @description The date and time when this content was first created. - */ - readonly created?: string; - /** @description The username of the user who created this content. */ - readonly createdBy?: string; - /** - * Format: date-time - * @description If populated, the date and time when this content was deleted. - */ - readonly deleted?: string | null; - /** @description The username of the user who deleted this content. Only populated if the content is deleted. */ - readonly deletedBy?: string; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - ContentNodePage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["ContentNode"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description Describes a content source used within CMS. */ - ContentSource: { - /** @description The unique identifier (key) of the resource. */ - key?: string; - /** @description Specifies the type of source. For example 'graph' for a GraphQL content source. */ - type: string; - /** @description The key of the source that this ContentSource relates to. */ - sourceKey: string; - /** @description Specifies the source type of this source. */ - sourceType: string; - /** @description The display name of this ContentSource. */ - displayName: string; - /** - * Format: date-time - * @description A timestamp indicating when this resource was first created. - */ - readonly created?: string; - /** @description The name of the user or application that created this resource. */ - readonly createdBy?: string; - /** - * Format: date-time - * @description Indicates the last time this resource was modified. - */ - readonly lastModified?: string; - /** @description The name of the user or application that last modified this resource. */ - readonly lastModifiedBy?: string; - /** - * @description Represents the base of the corresponding content type. - * @enum {string} - */ - baseType: "_page" | "_component" | "_media" | "_image" | "_video" | "_folder" | "_experience" | "_section" | "_element"; - propertyMappings: components["schemas"]["PropertyMappings"]; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - ContentSourcePage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["ContentSource"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description A writable implementation of an ContentType. */ - ContentType: { - /** @description The unique identifier (key) of the resource. */ - key?: string; - /** @description The display name of this ContentType. */ - displayName: string; - /** @description A description of this ContentType. */ - description?: string; - /** @description The base type of this ContentType. Ignored for contracts; required for all other content types. */ - baseType?: string | null; - /** @description Specifies if the ContentType is a contract type. */ - isContract?: boolean; - /** @description A string that is used to indicate the source of this ContentType. */ - readonly source?: string; - /** - * Format: int32 - * @description A value that is used to when sorting ContentType instances. - */ - sortOrder?: number; - /** @description Provides a set of content types that can be created in containers of this type */ - mayContainTypes?: string[]; - /** @description Provides a set of media file extensions that this content type can handle. */ - mediaFileExtensions?: string[]; - /** @description Provides a set of composition behaviors specifying how this content type can be used within compositions. */ - compositionBehaviors?: ("sectionEnabled" | "elementEnabled" | "formsElementEnabled")[]; - /** @description Provides a set of contract content types that this content type is bound to. */ - contracts?: string[]; - /** - * Format: date-time - * @description A timestamp indicating when this resource was first created. - */ - readonly created?: string; - /** @description The name of the user or application that created this resource. */ - readonly createdBy?: string; - /** - * Format: date-time - * @description Indicates the last time this resource was modified. - */ - readonly lastModified?: string; - /** @description The name of the user or application that last modified this resource. */ - readonly lastModifiedBy?: string; - /** @description Dictionary with all custom properties of this ContentType. */ - properties?: { - [key: string]: components["schemas"]["ContentTypeProperty"]; - }; - /** @description The access rights assigned to this content type that defines who can create content of this type. If no access rights are assigned, everyone will be able to create content of this type. An empty array means that no new content of this type can be created. */ - accessRights?: components["schemas"]["SecurityIdentity"][] | null; - }; - /** @description Defines the binding between two content types. */ - ContentTypeBinding: { - /** @description The unique identifier (key) of the resource. */ - key?: string; - /** @description Specifies the key of the content type that this binding is from. */ - from: string; - /** @description Specifies the key of the content type that this binding is to. */ - to: string; - /** - * Format: date-time - * @description A timestamp indicating when this resource was first created. - */ - readonly created?: string; - /** @description The name of the user or application that created this resource. */ - readonly createdBy?: string; - /** - * Format: date-time - * @description Indicates the last time this resource was modified. - */ - readonly lastModified?: string; - /** @description The name of the user or application that last modified this resource. */ - readonly lastModifiedBy?: string; - /** @description Object map with all property mappings for this content type binding. */ - propertyMappings?: { - [key: string]: components["schemas"]["PropertyMapping"]; - }; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - ContentTypeBindingPage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["ContentTypeBinding"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - ContentTypePage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["ContentType"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description Defines a single property within a content type, including its data type, validation rules, and editorial metadata. */ - ContentTypeProperty: { - /** - * @description The fundamental data type of this property (e.g., string, integer, content reference). - * @enum {string} - */ - type: "string" | "url" | "boolean" | "integer" | "float" | "dateTime" | "contentReference" | "content" | "link" | "richText" | "json" | "array" | "component"; - /** @description The property format that defines specialized handling and validation for this property. */ - format?: string; - /** @description The content type key that this property contains when the type is 'component'. */ - contentType?: string; - /** @description The user-friendly name for this property, displayed in editorial interfaces. */ - displayName?: string; - /** @description A description explaining the purpose and usage of this property for content editors. */ - description?: string; - /** @description Whether the property value is translated separately for each locale or shared across all locales. */ - isLocalized?: boolean; - /** @description Whether content items must always provide a value for this property before publication. */ - isRequired?: boolean; - /** @description The property group this field belongs to for organizational purposes in the editor. Leave empty to allow automatic grouping. */ - group?: string; - /** - * Format: int32 - * @description The display order of this property within its group (lower numbers appear first). - */ - sortOrder?: number; - /** - * @description Indicates how this property will be indexed in the search engine. If not explicitly set, the property will be indexed using the default indexing setting of the search engine. - * @enum {string} - */ - indexingType?: "disabled" | "queryable" | "searchable"; - /** - * @description Indicates how this property is displayed in the editing interface. If not explicitly set, the property will be available for editing. - * @enum {string} - */ - displayMode?: "available" | "hidden"; - /** @description The lowest value (inclusive) allowed for numeric or date properties. Type must match the property's data type. */ - minimum?: ((number | null) | (number | null) | (string | null) | (string | null)) | null; - /** @description The highest value (inclusive) allowed for numeric or date properties. Type must match the property's data type. */ - maximum?: ((number | null) | (number | null) | (string | null) | (string | null)) | null; - /** @description A predefined list of allowed values for this property. The enumeration values must match the property's data type. Allowed for string, integer, float and date-time property types. */ - enum?: components["schemas"]["EnumerationValue"][] | null; - /** - * Format: int32 - * @description The minimum character length for string-type properties. - */ - minLength?: number | null; - /** - * Format: int32 - * @description The maximum character length for string-type properties. - */ - maxLength?: number | null; - /** - * Format: regex - * @description Regular expression pattern that limits what value that a string type property must match. - */ - pattern?: string; - /** - * Format: int32 - * @description The minimum number of items allowed in array-type properties. - */ - minItems?: number | null; - /** - * Format: int32 - * @description The maximum number of items allowed in array-type properties. - */ - maxItems?: number | null; - /** @description Content types and base types that this property is permitted to contain. Used by properties of content or content reference type. */ - allowedTypes?: string[]; - /** @description Content types and base types that items in this property are forbidden from containing. Used by properties of content or content reference type. */ - restrictedTypes?: string[]; - /** @description Defines editor specific settings for this property. Editor settings are specific to the item and editor type. */ - editorSettings?: { - [key: string]: unknown; - } | null; - items?: components["schemas"]["ArrayItem"]; - }; - /** @description Represents a version of a content item. */ - ContentVersion: components["schemas"]["ContentData"] & { - /** @description The key that identifies this content version. */ - key?: string; - /** @description The locale of this content version. */ - locale?: string; - /** @description The version identifier of this instance. */ - version?: string; - /** @description The variation of this content version, if any. Variations are used to represent different states or forms of the same content item. A variation has its own publishing lifecycle. A variation cannot be published before the default version of same locale has been published. */ - variation?: string; - /** @description The content type of this content item. */ - contentType?: string; - /** @description The display name of this content version. */ - displayName: string; - /** - * Format: date-time - * @description Indicates a time when this content was published or should be published. - */ - published?: string | null; - /** - * Format: date-time - * @description Indicates a time when this content expired or should expire. - */ - expired?: string | null; - /** - * @description The status of this content version. - * @enum {string} - */ - status?: "draft" | "ready" | "published" | "previous" | "scheduled" | "rejected" | "inReview"; - /** - * Format: date-time - * @description The timestamp when a scheduled version will be published. Only present when status is 'scheduled'. - */ - delayPublishUntil?: string | null; - /** @description A string that represents the segment that should be used when routing or generate routes to the current content instance. */ - routeSegment?: string; - /** @description A simple route (shortcut URL) used to access pages and experiences. */ - simpleRoute?: string; - /** Format: date-time */ - lastModified?: string; - lastModifiedBy?: string; - composition?: components["schemas"]["CompositionNode"]; - media?: components["schemas"]["MediaData"]; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - ContentVersionPage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["ContentVersion"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description Options for copying content. */ - CopyContentOptions: { - /** @description Indicates if deleted content could be used as source. */ - allowDeleted?: boolean; - /** @description Optional key of the container where the copied content should be placed. */ - container?: string | null; - /** @description Optional key of the owner where the copied content should be placed. */ - owner?: string | null; - }; - /** @description Describes a setting for a display template. */ - DisplaySetting: { - /** @description The display name of this display setting. */ - displayName: string; - /** @description The suggested editor for this display setting. */ - editor?: string; - /** - * Format: int32 - * @description The sort order of this display setting within the template. - */ - sortOrder?: number; - /** @description The available choices for this display setting. */ - choices?: { - [key: string]: components["schemas"]["DisplaySettingChoice"]; - }; - }; - /** @description Describes a setting for a display template. */ - DisplaySettingChoice: { - /** @description The display name of this display setting choice. */ - displayName: string; - /** - * Format: int32 - * @description The sort order of this choice within the setting. - */ - sortOrder?: number; - }; - /** @description Describes a display template that can be assigned to content. */ - DisplayTemplate: { - /** @description The unique identifier (key) of the resource. */ - key?: string; - /** @description The display name of this display template. */ - displayName: string; - /** @description The optional node type this display template is valid for. */ - nodeType?: string; - /** @description The optional base type this display template is valid for. */ - baseType?: string | null; - /** @description The optional key of the content type this display template is valid for. */ - contentType?: string; - /** @description If this is the default display template for the associated base type, node type or content type. */ - isDefault?: boolean; - /** - * Format: date-time - * @description A timestamp indicating when this display template was first created. - */ - readonly created?: string; - /** @description The username of the user that created this display template. */ - readonly createdBy?: string; - /** - * Format: date-time - * @description A timestamp indicating when this display template was last modified. - */ - readonly lastModified?: string; - /** @description The username of the user that last modified this display template. */ - readonly lastModifiedBy?: string; - /** @description The available settings for this display template. */ - settings?: { - [key: string]: components["schemas"]["DisplaySetting"]; - }; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - DisplayTemplatePage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["DisplayTemplate"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description Describes one value in an enumeration of possible values. */ - EnumerationValue: { - /** @description The defined enumeration value. Value type must match the property type. */ - value: (number | null) | (number | null) | (string | null) | (string | null); - /** @description The display name of the enumeration value. */ - displayName: string; - }; - /** @description Represents a HTML hyperlink with URL, display text, and optional rendering properties. */ - Link: { - /** - * Format: uri - * @description The URL that the link points to. - */ - url?: string | null; - /** @description Specifies how the URL should be displayed in the browsing context (e.g., '_blank' for new window, '_self' for current window). */ - target?: string; - /** @description The title text or tooltip displayed when hovering over the link. */ - title?: string; - /** @description The visible text or label displayed to users for this link. */ - text?: string; - /** @description Additional attributes associated with the link. */ - attributes?: { - [key: string]: string; - }; - }; - /** @description Represents a locale that can be used for content. */ - Locale: { - /** @description The unique identifier (key) of the resource. This is the IETF BCP-47 language tag (e.g., "en", "en-US", "sv-SE"). */ - key: string; - /** @description The display name of this locale. */ - displayName: string; - /** @description Indicates whether this locale is enabled and can be used to create content. */ - isEnabled?: boolean; - /** @description A string that represents the segment that should be used when routing or generate routes to the current locale */ - routeSegment: string; - /** - * Format: int32 - * @description A value that is used when sorting locales. - */ - sortOrder?: number; - /** @description The access rights assigned to this locale that defines who can create content in this locale. If no access rights are assigned, everyone will be able to create content in this locale. An empty array means that no user will be allowed to create or change content in this locale. */ - accessRights?: components["schemas"]["SecurityIdentity"][] | null; - /** - * Format: date-time - * @description A timestamp indicating when this locale was first created. - */ - readonly created?: string; - /** @description The username of the user that created this locale. */ - readonly createdBy?: string; - /** Format: date-time */ - readonly lastModified?: string; - /** @description The username of the user that last modified this locale. */ - readonly lastModifiedBy?: string; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - LocalePage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["Locale"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description Manifest that describes CMS definitions. */ - Manifest: { - /** @description List of locales that are part of this manifest. */ - locales?: components["schemas"]["Locale"][] | null; - /** @description List of content type property groups that are part of this manifest. */ - propertyGroups?: components["schemas"]["PropertyGroup"][] | null; - /** @description List of content types that are part of this manifest. */ - contentTypes?: components["schemas"]["ContentType"][] | null; - /** @description List of display templates that are part of this manifest. */ - displayTemplates?: components["schemas"]["DisplayTemplate"][] | null; - /** - * Format: date-time - * @description A timestamp indicating the last time an item included in this manifest was modified. - */ - lastModified?: string; - }; - /** @description Describes a message from a manifest importing operation. */ - ManifestImportMessage: { - /** @description The section where the message originated from. */ - section?: string; - /** @description The message describing an outcome or error. */ - message?: string; - /** @description The identifier of the resource that was the reason for this message to be created. */ - resource?: string | null; - }; - /** @description The result of a manifest import operation. */ - ManifestImportResult: { - /** @description List of messages describing the outcome from the manifest import. */ - readonly outcomes?: components["schemas"]["ManifestImportMessage"][]; - /** @description List of error messages from the manifest import. */ - readonly errors?: components["schemas"]["ManifestImportMessage"][]; - }; - /** @description Represents media data attached to a content item. */ - MediaData: { - /** @description The key referencing the media. */ - key?: string; - }; - /** @description Represents a new content and the initial data required to create it. */ - NewContent: { - /** @description The key that identifies the content item to be created. If not provided, a new key will be generated. */ - key?: string; - /** @description The content type for the content item to be created. */ - contentType: string; - /** @description The key that identifies the container content where this content item should be created. */ - container?: string; - /** @description The key that identifies the owner for the content item to be created. Content that is owned by another content is also known as an asset. */ - owner?: string; - initialVersion: components["schemas"]["ContentVersion"]; - }; - /** @description Represents the result of creating a new content item. */ - NewContentNode: components["schemas"]["ContentNode"] & { - initialVersion?: components["schemas"]["ContentVersion"]; - }; - ProblemDetails: { - /** - * Format: uri - * @description A URI reference that identifies the problem type. - */ - type?: string | null; - /** @description A short, human-readable summary of the problem type. */ - title?: string | null; - /** - * Format: int32 - * @description The HTTP status code generated by the origin server for this occurrence of the problem. - */ - status?: number | null; - /** @description A human-readable explanation specific to this occurrence of the problem. */ - detail?: string | null; - /** - * Format: uri - * @description A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. - */ - instance?: string | null; - /** @description Error code that identifies the problem type. */ - code?: string | null; - /** @description An array of error details with more detailed information about the problem. */ - errors?: { - /** @description A granular explanation of one specific error related to a field, header or query parameter. */ - detail?: string; - /** - * @description A string that may provide a hint to which field that was the source of the error. - * @example properties.header.displayName - */ - field?: string | null; - }[] | null; - } & { - [key: string]: unknown; - }; - /** @description A single property value for a content item. The value's type and format are determined by the property definition in the content type schema. */ - PropertyData: { - /** @description The property value, which can be a string, number, boolean, object, array, or null depending on the property type defined in the content type. */ - value?: unknown; - }; - /** @description Represent the definition of semantic property formats for content items. */ - PropertyFormat: { - /** @description The unique identifier (key) of the resource. */ - key?: string; - /** - * @description The underlying data type used for this PropertyFormat. - * @enum {string} - */ - dataType?: "string" | "url" | "boolean" | "integer" | "float" | "dateTime" | "contentReference" | "content" | "link" | "richText" | "json" | "array" | "component"; - /** - * @description The underlying item type used for this PropertyFormat. - * @enum {string} - */ - readonly itemType?: "string" | "url" | "boolean" | "integer" | "float" | "dateTime" | "contentReference" | "content" | "link" | "richText" | "json" | "array" | "component"; - /** @description The display name of this PropertyFormat. */ - displayName?: string; - /** @description Indicates if this property format has been deleted. */ - readonly isDeleted?: boolean; - /** - * Format: date-time - * @description A timestamp indicating when this display template was first created. - */ - readonly created?: string; - /** @description The username of the user that created this display template. */ - readonly createdBy?: string; - /** - * Format: date-time - * @description A timestamp indicating when this display template was last modified. - */ - readonly lastModified?: string; - /** @description The username of the user that last modified this display template. */ - readonly lastModifiedBy?: string; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - PropertyFormatPage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["PropertyFormat"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description Describes a property group of a ContentType in the CMS. */ - PropertyGroup: { - /** @description The unique identifier (key) of the resource. */ - key: string; - /** @description The display name of this PropertyGroup. */ - displayName: string; - /** @description A string that is used to indicate the source of this PropertyGroup. */ - readonly source?: string; - /** - * Format: int32 - * @description An value that is used to when sorting PropertyGroup instances. - */ - sortOrder?: number; - /** - * Format: date-time - * @description A timestamp indicating when this property group was first created. - */ - readonly created?: string; - /** @description The username of the user that created this property group. */ - readonly createdBy?: string; - /** Format: date-time */ - readonly lastModified?: string; - /** @description The username of the user that last modified this property group. */ - readonly lastModifiedBy?: string; - }; - /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ - PropertyGroupPage: { - /** @description The items in this paged collection. */ - items?: components["schemas"]["PropertyGroup"][]; - /** - * Format: int32 - * @description The zero-based index of the current page. - */ - readonly pageIndex?: number; - /** - * Format: int32 - * @description The number of items in each page. Not necessarily the same as the number of items in this page. - */ - readonly pageSize?: number; - /** - * Format: int32 - * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. - */ - readonly totalCount?: number | null; - }; - /** @description Specifies the binding for a property. */ - PropertyMapping: { - /** @description Specifies the path to the property on the corresponding content type to bind from. */ - from: string; - /** @description Optional binding key that can be used to specify that an already existing binding should be used to map content properties. */ - binding?: string; - }; - /** @description Represents a mapping between a property in an external source and its corresponding property in the CMS. Used to define how external properties are mapped to CMS property identifiers and names. */ - PropertyMappings: { - /** @description The key to use for the item in the source. Required if the SourceType is not of type '_Item'. */ - key?: string; - /** @description The key to use for the item in cms. Required if the SourceType is not of type '_Item'. */ - displayName?: string; - /** @description Specifies the format of the source identifier key. */ - keyFormat?: string | null; - }; - /** @description Options for publishing a content version. */ - PublishContentOptions: { - /** - * Format: date-time - * @description Gets or sets the date and time at which the content should be published, sets the version into 'scheduled' state if a future date is specified. - */ - delayUntil?: string | null; - /** @description Indicates if validations such as approvals and required properties should be bypassed, requires 'admin' access rights. */ - force?: boolean; - }; - /** @description Options for transitioning a content version to ready status. */ - ReadyContentOptions: { - /** @description An optional comment to include when starting the approval process. May be required depending on the approval definition configuration. */ - comment?: string | null; - }; - /** @description Identifies a user, role or application that can be assigned access associated with a resource. */ - SecurityIdentity: { - /** @description The unique name of the user, role or application that this identifier references. */ - name: string; + schemas: { + /** @description Options for approving or rejecting a content version. */ + ApprovalDecisionOptions: { + /** @description An optional comment to include with the approval decision. May be required depending on the approval definition configuration. */ + comment?: string | null; + /** @description Indicates if the approval should be forced, bypassing the normal approval flow. Requires 'admin' access rights. */ + force?: boolean; + }; + /** @description Describes the items of a content type property of type 'array'. */ + ArrayItem: { + /** + * @description The fundamental data type for the items in the array (e.g., string, integer, content reference). + * @enum {string} + */ + type: + | 'string' + | 'url' + | 'boolean' + | 'integer' + | 'float' + | 'dateTime' + | 'contentReference' + | 'content' + | 'link' + | 'richText' + | 'json' + | 'component'; + /** @description The property format that defines specialized handling and validation for this array item. */ + format?: string; + /** @description The content type that items in the array may contain, when the 'type' is set to 'component'. */ + contentType?: string; + /** @description The minimum value that properties of this type should be able to contain. Value type must match the type of the array item. */ + minimum?: ((number | null) | (number | null) | (string | null) | (string | null)) | null; + /** @description The maximum value that array items of this type should be able to contain. Value type must match the type of the array item. */ + maximum?: ((number | null) | (number | null) | (string | null) | (string | null)) | null; + /** + * Format: int32 + * @description The minimum string length that array items of this type should be able to contain. + */ + minLength?: number | null; + /** + * Format: int32 + * @description The maximum string length that array items of this type should be able to contain. + */ + maxLength?: number | null; + /** + * Format: regex + * @description Regular expression pattern that limits what strings that array items of this type should be able to contain. + */ + pattern?: string; + /** @description A predefined list of allowed values for array items of this type. The enumeration values must match the property's data type. Allowed for string, integer, float and date-time property types. */ + enum?: components['schemas']['EnumerationValue'][] | null; + /** @description Defines content and base types that array items of this type may contain. */ + allowedTypes?: string[]; + /** @description Defines content and base types that array items of this type may not contain. */ + restrictedTypes?: string[]; + /** @description Defines editor specific settings for this item. The settings are specific to the item and editor type. */ + editorSettings?: { + [key: string]: unknown; + } | null; + }; + /** @description Represents a blueprint of a content item. */ + Blueprint: { + /** @description The unique identifier (key) of the resource. */ + key?: string; + /** @description The display name of this blueprint. */ + displayName: string; + /** @description The content type of this blueprint. */ + readonly contentType: string; + /** + * Format: date-time + * @description A timestamp indicating when this resource was first created. + */ + readonly created?: string; + /** @description The name of the user or application that created this resource. */ + readonly createdBy?: string; + /** + * Format: date-time + * @description Indicates the last time this resource was modified. + */ + readonly lastModified?: string; + /** @description The name of the user or application that last modified this resource. */ + readonly lastModifiedBy?: string; + content: components['schemas']['BlueprintData']; + }; + /** @description Represents the data part of a Blueprint. */ + BlueprintData: components['schemas']['ContentData'] & { + composition?: components['schemas']['CompositionNode']; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + BlueprintPage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['Blueprint'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description Defines display settings for a CompositionNode."/> */ + CompositionDisplaySettings: { + /** @description The display template that these settings apply to. */ + displayTemplate: string; + /** @description The display settings of this CompositionNode. */ + settings?: { + [key: string]: string; + } | null; + }; + /** @description Specifies a node in a content composition. */ + CompositionNode: { + /** @description Specifies an identifier of this CompositionNode. */ + id?: string; + /** @description The display name of this ContentType. */ + displayName?: string; + /** @description The node type of this CompositionNode. */ + nodeType: string; + /** @description The node layout type of this CompositionNode */ + layoutType?: string; + displaySettings?: components['schemas']['CompositionDisplaySettings']; + /** @description Represents a content component. */ + component?: components['schemas']['ContentData'] & { + /** @description An optional display option for the content component. */ + displayOption?: string; + /** @description An optional group for the personalizable component. */ + segmentationGroup?: string; + /** @description Specifies the settings for the content component. */ + segments?: string[] | null; + /** @description The display name of the content component. If 'reference' is set, the name is automatically set to the name of the referenced content. */ + displayName?: string; + /** + * Format: uri + * @description A reference to the content of this component. Cannot be assigned together with 'contentType' or 'properties'. + */ + reference?: string | null; + /** @description The key of the content type that this is an embedded instance of. */ + contentType?: string; + }; + /** @description The child nodes for this CompositionNode. */ + nodes?: components['schemas']['CompositionNode'][] | null; + }; + /** @description Associates a content item with another source content item, establishing a relationship defined by a content type binding. Used for linking managed content to external or reference content. */ + ContentBinding: { + /** @description The binding definition key that controls how the source content item is linked and accessed. */ + contentTypeBinding?: string; + /** + * Format: uri + * @description The reference to the source content item that is being bound. This cannot be empty. + */ + source: string; + }; + /** @description Represents a content component. */ + ContentComponent: components['schemas']['ContentData'] & { + /** @description An optional display option for the content component. */ + displayOption?: string; + /** @description An optional group for the personalizable component. */ + segmentationGroup?: string; + /** @description Specifies the settings for the content component. */ + segments?: string[] | null; + /** @description The display name of the content component. If 'reference' is set, the name is automatically set to the name of the referenced content. */ + displayName?: string; + /** + * Format: uri + * @description A reference to the content of this component. Cannot be assigned together with 'contentType' or 'properties'. + */ + reference?: string | null; + /** @description The key of the content type that this is an embedded instance of. */ + contentType?: string; + }; + /** @description Base structure for content data. Contains properties defined by the content type and optional bindings to source content. Property values must conform to the types defined in the associated ContentType definition. */ + ContentData: { + binding?: components['schemas']['ContentBinding']; + /** @description Properties as they are defined by corresponding component or content type. */ + properties?: { + [key: string]: components['schemas']['PropertyData']; + }; + }; + /** @description Metadata about a content item in the content hierarchy, including ownership, localization, and audit information. This represents the structural information without the actual property values. */ + ContentNode: { + /** @description The unique identifier (key) of the resource. */ + key?: string; + /** @description The content item that contains this item in the hierarchy. */ + container?: string; + /** @description The content item that owns this item. Content that is owned by another content is also known as an asset. Cannot be combined with container. */ + owner?: string; + /** @description The content type that defines the structure and available properties for this item. */ + readonly contentType?: string; + /** @description The locale for which this content was originally created. This locale will include properties that are shared across all locales. */ + readonly primaryLocale?: string; + /** @description The complete list of locales for which this content has been created for. */ + locales?: string[]; + /** + * Format: date-time + * @description The date and time when this content was last modified. + */ + readonly lastModified?: string; + /** @description The username of the user that last modified this content. */ + readonly lastModifiedBy?: string; + /** + * Format: date-time + * @description The date and time when this content was first created. + */ + readonly created?: string; + /** @description The username of the user who created this content. */ + readonly createdBy?: string; + /** + * Format: date-time + * @description If populated, the date and time when this content was deleted. + */ + readonly deleted?: string | null; + /** @description The username of the user who deleted this content. Only populated if the content is deleted. */ + readonly deletedBy?: string; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + ContentNodePage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['ContentNode'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description Describes a content source used within CMS. */ + ContentSource: { + /** @description The unique identifier (key) of the resource. */ + key?: string; + /** @description Specifies the type of source. For example 'graph' for a GraphQL content source. */ + type: string; + /** @description The key of the source that this ContentSource relates to. */ + sourceKey: string; + /** @description Specifies the source type of this source. */ + sourceType: string; + /** @description The display name of this ContentSource. */ + displayName: string; + /** + * Format: date-time + * @description A timestamp indicating when this resource was first created. + */ + readonly created?: string; + /** @description The name of the user or application that created this resource. */ + readonly createdBy?: string; + /** + * Format: date-time + * @description Indicates the last time this resource was modified. + */ + readonly lastModified?: string; + /** @description The name of the user or application that last modified this resource. */ + readonly lastModifiedBy?: string; + /** + * @description Represents the base of the corresponding content type. + * @enum {string} + */ + baseType: + | '_page' + | '_component' + | '_media' + | '_image' + | '_video' + | '_folder' + | '_experience' + | '_section' + | '_element'; + propertyMappings: components['schemas']['PropertyMappings']; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + ContentSourcePage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['ContentSource'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description A writable implementation of an ContentType. */ + ContentType: { + /** @description The unique identifier (key) of the resource. */ + key?: string; + /** @description The display name of this ContentType. */ + displayName: string; + /** @description A description of this ContentType. */ + description?: string; + /** @description The base type of this ContentType. Ignored for contracts; required for all other content types. */ + baseType?: string | null; + /** @description Specifies if the ContentType is a contract type. */ + isContract?: boolean; + /** @description A string that is used to indicate the source of this ContentType. */ + readonly source?: string; + /** + * Format: int32 + * @description A value that is used to when sorting ContentType instances. + */ + sortOrder?: number; + /** @description Provides a set of content types that can be created in containers of this type */ + mayContainTypes?: string[]; + /** @description Provides a set of media file extensions that this content type can handle. */ + mediaFileExtensions?: string[]; + /** @description Provides a set of composition behaviors specifying how this content type can be used within compositions. */ + compositionBehaviors?: ('sectionEnabled' | 'elementEnabled' | 'formsElementEnabled')[]; + /** @description Provides a set of contract content types that this content type is bound to. */ + contracts?: string[]; + /** + * Format: date-time + * @description A timestamp indicating when this resource was first created. + */ + readonly created?: string; + /** @description The name of the user or application that created this resource. */ + readonly createdBy?: string; + /** + * Format: date-time + * @description Indicates the last time this resource was modified. + */ + readonly lastModified?: string; + /** @description The name of the user or application that last modified this resource. */ + readonly lastModifiedBy?: string; + /** @description Dictionary with all custom properties of this ContentType. */ + properties?: { + [key: string]: components['schemas']['ContentTypeProperty']; + }; + /** @description The access rights assigned to this content type that defines who can create content of this type. If no access rights are assigned, everyone will be able to create content of this type. An empty array means that no new content of this type can be created. */ + accessRights?: components['schemas']['SecurityIdentity'][] | null; + }; + /** @description Defines the binding between two content types. */ + ContentTypeBinding: { + /** @description The unique identifier (key) of the resource. */ + key?: string; + /** @description Specifies the key of the content type that this binding is from. */ + from: string; + /** @description Specifies the key of the content type that this binding is to. */ + to: string; + /** + * Format: date-time + * @description A timestamp indicating when this resource was first created. + */ + readonly created?: string; + /** @description The name of the user or application that created this resource. */ + readonly createdBy?: string; + /** + * Format: date-time + * @description Indicates the last time this resource was modified. + */ + readonly lastModified?: string; + /** @description The name of the user or application that last modified this resource. */ + readonly lastModifiedBy?: string; + /** @description Object map with all property mappings for this content type binding. */ + propertyMappings?: { + [key: string]: components['schemas']['PropertyMapping']; + }; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + ContentTypeBindingPage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['ContentTypeBinding'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + ContentTypePage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['ContentType'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description Defines a single property within a content type, including its data type, validation rules, and editorial metadata. */ + ContentTypeProperty: { + /** + * @description The fundamental data type of this property (e.g., string, integer, content reference). + * @enum {string} + */ + type: + | 'string' + | 'url' + | 'boolean' + | 'integer' + | 'float' + | 'dateTime' + | 'contentReference' + | 'content' + | 'link' + | 'richText' + | 'json' + | 'array' + | 'component'; + /** @description The property format that defines specialized handling and validation for this property. */ + format?: string; + /** @description The content type key that this property contains when the type is 'component'. */ + contentType?: string; + /** @description The user-friendly name for this property, displayed in editorial interfaces. */ + displayName?: string; + /** @description A description explaining the purpose and usage of this property for content editors. */ + description?: string; + /** @description Whether the property value is translated separately for each locale or shared across all locales. */ + isLocalized?: boolean; + /** @description Whether content items must always provide a value for this property before publication. */ + isRequired?: boolean; + /** @description The property group this field belongs to for organizational purposes in the editor. Leave empty to allow automatic grouping. */ + group?: string; + /** + * Format: int32 + * @description The display order of this property within its group (lower numbers appear first). + */ + sortOrder?: number; + /** + * @description Indicates how this property will be indexed in the search engine. If not explicitly set, the property will be indexed using the default indexing setting of the search engine. + * @enum {string} + */ + indexingType?: 'disabled' | 'queryable' | 'searchable'; + /** + * @description Indicates how this property is displayed in the editing interface. If not explicitly set, the property will be available for editing. + * @enum {string} + */ + displayMode?: 'available' | 'hidden'; + /** @description The lowest value (inclusive) allowed for numeric or date properties. Type must match the property's data type. */ + minimum?: ((number | null) | (number | null) | (string | null) | (string | null)) | null; + /** @description The highest value (inclusive) allowed for numeric or date properties. Type must match the property's data type. */ + maximum?: ((number | null) | (number | null) | (string | null) | (string | null)) | null; + /** @description A predefined list of allowed values for this property. The enumeration values must match the property's data type. Allowed for string, integer, float and date-time property types. */ + enum?: components['schemas']['EnumerationValue'][] | null; + /** + * Format: int32 + * @description The minimum character length for string-type properties. + */ + minLength?: number | null; + /** + * Format: int32 + * @description The maximum character length for string-type properties. + */ + maxLength?: number | null; + /** + * Format: regex + * @description Regular expression pattern that limits what value that a string type property must match. + */ + pattern?: string; + /** + * Format: int32 + * @description The minimum number of items allowed in array-type properties. + */ + minItems?: number | null; + /** + * Format: int32 + * @description The maximum number of items allowed in array-type properties. + */ + maxItems?: number | null; + /** @description Content types and base types that this property is permitted to contain. Used by properties of content or content reference type. */ + allowedTypes?: string[]; + /** @description Content types and base types that items in this property are forbidden from containing. Used by properties of content or content reference type. */ + restrictedTypes?: string[]; + /** @description Defines editor specific settings for this property. Editor settings are specific to the item and editor type. */ + editorSettings?: { + [key: string]: unknown; + } | null; + items?: components['schemas']['ArrayItem']; + }; + /** @description Represents a version of a content item. */ + ContentVersion: components['schemas']['ContentData'] & { + /** @description The key that identifies this content version. */ + key?: string; + /** @description The locale of this content version. */ + locale?: string; + /** @description The version identifier of this instance. */ + version?: string; + /** @description The variation of this content version, if any. Variations are used to represent different states or forms of the same content item. A variation has its own publishing lifecycle. A variation cannot be published before the default version of same locale has been published. */ + variation?: string; + /** @description The content type of this content item. */ + contentType?: string; + /** @description The display name of this content version. */ + displayName: string; + /** + * Format: date-time + * @description Indicates a time when this content was published or should be published. + */ + published?: string | null; + /** + * Format: date-time + * @description Indicates a time when this content expired or should expire. + */ + expired?: string | null; + /** + * @description The status of this content version. + * @enum {string} + */ + status?: 'draft' | 'ready' | 'published' | 'previous' | 'scheduled' | 'rejected' | 'inReview'; + /** + * Format: date-time + * @description The timestamp when a scheduled version will be published. Only present when status is 'scheduled'. + */ + delayPublishUntil?: string | null; + /** @description A string that represents the segment that should be used when routing or generate routes to the current content instance. */ + routeSegment?: string; + /** @description A simple route (shortcut URL) used to access pages and experiences. */ + simpleRoute?: string; + /** Format: date-time */ + lastModified?: string; + lastModifiedBy?: string; + composition?: components['schemas']['CompositionNode']; + media?: components['schemas']['MediaData']; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + ContentVersionPage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['ContentVersion'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description Options for copying content. */ + CopyContentOptions: { + /** @description Indicates if deleted content could be used as source. */ + allowDeleted?: boolean; + /** @description Optional key of the container where the copied content should be placed. */ + container?: string | null; + /** @description Optional key of the owner where the copied content should be placed. */ + owner?: string | null; + }; + /** @description Describes a setting for a display template. */ + DisplaySetting: { + /** @description The display name of this display setting. */ + displayName: string; + /** @description The suggested editor for this display setting. */ + editor?: string; + /** + * Format: int32 + * @description The sort order of this display setting within the template. + */ + sortOrder?: number; + /** @description The available choices for this display setting. */ + choices?: { + [key: string]: components['schemas']['DisplaySettingChoice']; + }; + }; + /** @description Describes a setting for a display template. */ + DisplaySettingChoice: { + /** @description The display name of this display setting choice. */ + displayName: string; + /** + * Format: int32 + * @description The sort order of this choice within the setting. + */ + sortOrder?: number; + }; + /** @description Describes a display template that can be assigned to content. */ + DisplayTemplate: { + /** @description The unique identifier (key) of the resource. */ + key?: string; + /** @description The display name of this display template. */ + displayName: string; + /** @description The optional node type this display template is valid for. */ + nodeType?: string; + /** @description The optional base type this display template is valid for. */ + baseType?: string | null; + /** @description The optional key of the content type this display template is valid for. */ + contentType?: string; + /** @description If this is the default display template for the associated base type, node type or content type. */ + isDefault?: boolean; + /** + * Format: date-time + * @description A timestamp indicating when this display template was first created. + */ + readonly created?: string; + /** @description The username of the user that created this display template. */ + readonly createdBy?: string; + /** + * Format: date-time + * @description A timestamp indicating when this display template was last modified. + */ + readonly lastModified?: string; + /** @description The username of the user that last modified this display template. */ + readonly lastModifiedBy?: string; + /** @description The available settings for this display template. */ + settings?: { + [key: string]: components['schemas']['DisplaySetting']; + }; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + DisplayTemplatePage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['DisplayTemplate'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description Describes one value in an enumeration of possible values. */ + EnumerationValue: { + /** @description The defined enumeration value. Value type must match the property type. */ + value: (number | null) | (number | null) | (string | null) | (string | null); + /** @description The display name of the enumeration value. */ + displayName: string; + }; + /** @description Represents a HTML hyperlink with URL, display text, and optional rendering properties. */ + Link: { + /** + * Format: uri + * @description The URL that the link points to. + */ + url?: string | null; + /** @description Specifies how the URL should be displayed in the browsing context (e.g., '_blank' for new window, '_self' for current window). */ + target?: string; + /** @description The title text or tooltip displayed when hovering over the link. */ + title?: string; + /** @description The visible text or label displayed to users for this link. */ + text?: string; + /** @description Additional attributes associated with the link. */ + attributes?: { + [key: string]: string; + }; + }; + /** @description Represents a locale that can be used for content. */ + Locale: { + /** @description The unique identifier (key) of the resource. This is the IETF BCP-47 language tag (e.g., "en", "en-US", "sv-SE"). */ + key: string; + /** @description The display name of this locale. */ + displayName: string; + /** @description Indicates whether this locale is enabled and can be used to create content. */ + isEnabled?: boolean; + /** @description A string that represents the segment that should be used when routing or generate routes to the current locale */ + routeSegment: string; + /** + * Format: int32 + * @description A value that is used when sorting locales. + */ + sortOrder?: number; + /** @description The access rights assigned to this locale that defines who can create content in this locale. If no access rights are assigned, everyone will be able to create content in this locale. An empty array means that no user will be allowed to create or change content in this locale. */ + accessRights?: components['schemas']['SecurityIdentity'][] | null; + /** + * Format: date-time + * @description A timestamp indicating when this locale was first created. + */ + readonly created?: string; + /** @description The username of the user that created this locale. */ + readonly createdBy?: string; + /** Format: date-time */ + readonly lastModified?: string; + /** @description The username of the user that last modified this locale. */ + readonly lastModifiedBy?: string; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + LocalePage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['Locale'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description Manifest that describes CMS definitions. */ + Manifest: { + /** @description List of locales that are part of this manifest. */ + locales?: components['schemas']['Locale'][] | null; + /** @description List of content type property groups that are part of this manifest. */ + propertyGroups?: components['schemas']['PropertyGroup'][] | null; + /** @description List of content types that are part of this manifest. */ + contentTypes?: components['schemas']['ContentType'][] | null; + /** @description List of display templates that are part of this manifest. */ + displayTemplates?: components['schemas']['DisplayTemplate'][] | null; + /** + * Format: date-time + * @description A timestamp indicating the last time an item included in this manifest was modified. + */ + lastModified?: string; + }; + /** @description Describes a message from a manifest importing operation. */ + ManifestImportMessage: { + /** @description The section where the message originated from. */ + section?: string; + /** @description The message describing an outcome or error. */ + message?: string; + /** @description The identifier of the resource that was the reason for this message to be created. */ + resource?: string | null; + }; + /** @description The result of a manifest import operation. */ + ManifestImportResult: { + /** @description List of messages describing the outcome from the manifest import. */ + readonly outcomes?: components['schemas']['ManifestImportMessage'][]; + /** @description List of error messages from the manifest import. */ + readonly errors?: components['schemas']['ManifestImportMessage'][]; + }; + /** @description Represents media data attached to a content item. */ + MediaData: { + /** @description The key referencing the media. */ + key?: string; + }; + /** @description Represents a new content and the initial data required to create it. */ + NewContent: { + /** @description The key that identifies the content item to be created. If not provided, a new key will be generated. */ + key?: string; + /** @description The content type for the content item to be created. */ + contentType: string; + /** @description The key that identifies the container content where this content item should be created. */ + container?: string; + /** @description The key that identifies the owner for the content item to be created. Content that is owned by another content is also known as an asset. */ + owner?: string; + initialVersion: components['schemas']['ContentVersion']; + }; + /** @description Represents the result of creating a new content item. */ + NewContentNode: components['schemas']['ContentNode'] & { + initialVersion?: components['schemas']['ContentVersion']; + }; + ProblemDetails: { + /** + * Format: uri + * @description A URI reference that identifies the problem type. + */ + type?: string | null; + /** @description A short, human-readable summary of the problem type. */ + title?: string | null; + /** + * Format: int32 + * @description The HTTP status code generated by the origin server for this occurrence of the problem. + */ + status?: number | null; + /** @description A human-readable explanation specific to this occurrence of the problem. */ + detail?: string | null; + /** + * Format: uri + * @description A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. + */ + instance?: string | null; + /** @description Error code that identifies the problem type. */ + code?: string | null; + /** @description An array of error details with more detailed information about the problem. */ + errors?: + | { + /** @description A granular explanation of one specific error related to a field, header or query parameter. */ + detail?: string; /** - * @description The type of the security entity that this identifier references. Will default to 'role' if not specified. - * @enum {string} + * @description A string that may provide a hint to which field that was the source of the error. + * @example properties.header.displayName */ - type?: "user" | "role" | "application"; - }; + field?: string | null; + }[] + | null; + } & { + [key: string]: unknown; + }; + /** @description A single property value for a content item. The value's type and format are determined by the property definition in the content type schema. */ + PropertyData: { + /** @description The property value, which can be a string, number, boolean, object, array, or null depending on the property type defined in the content type. */ + value?: unknown; + }; + /** @description Represent the definition of semantic property formats for content items. */ + PropertyFormat: { + /** @description The unique identifier (key) of the resource. */ + key?: string; + /** + * @description The underlying data type used for this PropertyFormat. + * @enum {string} + */ + dataType?: + | 'string' + | 'url' + | 'boolean' + | 'integer' + | 'float' + | 'dateTime' + | 'contentReference' + | 'content' + | 'link' + | 'richText' + | 'json' + | 'array' + | 'component'; + /** + * @description The underlying item type used for this PropertyFormat. + * @enum {string} + */ + readonly itemType?: + | 'string' + | 'url' + | 'boolean' + | 'integer' + | 'float' + | 'dateTime' + | 'contentReference' + | 'content' + | 'link' + | 'richText' + | 'json' + | 'array' + | 'component'; + /** @description The display name of this PropertyFormat. */ + displayName?: string; + /** @description Indicates if this property format has been deleted. */ + readonly isDeleted?: boolean; + /** + * Format: date-time + * @description A timestamp indicating when this display template was first created. + */ + readonly created?: string; + /** @description The username of the user that created this display template. */ + readonly createdBy?: string; + /** + * Format: date-time + * @description A timestamp indicating when this display template was last modified. + */ + readonly lastModified?: string; + /** @description The username of the user that last modified this display template. */ + readonly lastModifiedBy?: string; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + PropertyFormatPage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['PropertyFormat'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description Describes a property group of a ContentType in the CMS. */ + PropertyGroup: { + /** @description The unique identifier (key) of the resource. */ + key: string; + /** @description The display name of this PropertyGroup. */ + displayName: string; + /** @description A string that is used to indicate the source of this PropertyGroup. */ + readonly source?: string; + /** + * Format: int32 + * @description An value that is used to when sorting PropertyGroup instances. + */ + sortOrder?: number; + /** + * Format: date-time + * @description A timestamp indicating when this property group was first created. + */ + readonly created?: string; + /** @description The username of the user that created this property group. */ + readonly createdBy?: string; + /** Format: date-time */ + readonly lastModified?: string; + /** @description The username of the user that last modified this property group. */ + readonly lastModifiedBy?: string; + }; + /** @description Represents a single page of items in a paged collection, including paging metadata such as the current page index, page size, and an estimated total item count. */ + PropertyGroupPage: { + /** @description The items in this paged collection. */ + items?: components['schemas']['PropertyGroup'][]; + /** + * Format: int32 + * @description The zero-based index of the current page. + */ + readonly pageIndex?: number; + /** + * Format: int32 + * @description The number of items in each page. Not necessarily the same as the number of items in this page. + */ + readonly pageSize?: number; + /** + * Format: int32 + * @description The estimated total number of items in the collection. May be omitted if the total count is unknown. + */ + readonly totalCount?: number | null; + }; + /** @description Specifies the binding for a property. */ + PropertyMapping: { + /** @description Specifies the path to the property on the corresponding content type to bind from. */ + from: string; + /** @description Optional binding key that can be used to specify that an already existing binding should be used to map content properties. */ + binding?: string; + }; + /** @description Represents a mapping between a property in an external source and its corresponding property in the CMS. Used to define how external properties are mapped to CMS property identifiers and names. */ + PropertyMappings: { + /** @description The key to use for the item in the source. Required if the SourceType is not of type '_Item'. */ + key?: string; + /** @description The key to use for the item in cms. Required if the SourceType is not of type '_Item'. */ + displayName?: string; + /** @description Specifies the format of the source identifier key. */ + keyFormat?: string | null; + }; + /** @description Options for publishing a content version. */ + PublishContentOptions: { + /** + * Format: date-time + * @description Gets or sets the date and time at which the content should be published, sets the version into 'scheduled' state if a future date is specified. + */ + delayUntil?: string | null; + /** @description Indicates if validations such as approvals and required properties should be bypassed, requires 'admin' access rights. */ + force?: boolean; + }; + /** @description Options for transitioning a content version to ready status. */ + ReadyContentOptions: { + /** @description An optional comment to include when starting the approval process. May be required depending on the approval definition configuration. */ + comment?: string | null; + }; + /** @description Identifies a user, role or application that can be assigned access associated with a resource. */ + SecurityIdentity: { + /** @description The unique name of the user, role or application that this identifier references. */ + name: string; + /** + * @description The type of the security entity that this identifier references. Will default to 'role' if not specified. + * @enum {string} + */ + type?: 'user' | 'role' | 'application'; + }; + }; + responses: { + /** @description Bad Request */ + BadRequest: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/problem+json': components['schemas']['ProblemDetails']; + }; + }; + /** @description Unauthorized */ + Unauthorized: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/problem+json': components['schemas']['ProblemDetails']; + }; + }; + /** @description Forbidden */ + Forbidden: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/problem+json': components['schemas']['ProblemDetails']; + }; + }; + /** @description Not Found */ + NotFound: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/problem+json': components['schemas']['ProblemDetails']; + }; + }; + /** @description Conflict */ + Conflict: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/problem+json': components['schemas']['ProblemDetails']; + }; + }; + /** @description Too Many Requests */ + TooManyRequests: { + headers: { + /** @description Indicates how long the client should wait before making a new request. */ + 'Retry-After'?: number; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ProblemDetails']; + }; + }; + /** @description Internal Server Error */ + InternalServerError: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/problem+json': components['schemas']['ProblemDetails']; + }; + }; + /** @description Precondition Failed */ + PreconditionFailed: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/problem+json': components['schemas']['ProblemDetails']; + }; + }; + }; + parameters: { + /** + * @description Indicates which content validation rules should be bypassed. Use with caution as this may allow creation of invalid content that could cause issues in production. Accepts '*' to bypass all validation rules, or a comma-separated list of specific validations to skip: 'data' (skip data validation such as required fields), 'references' (skip reference validation such as checking if referenced content exists). Examples: '*', 'data', 'data,references' + * @example data,references + */ + SkipValidation: ('*' | 'data' | 'references')[]; + /** + * @description Indicates which content source validation rules should be bypassed. Provide a comma-separated list of rule identifiers (for example, 'references' to skip reference validation, such as checking whether a referenced content type exists or is a valid type). If this header is omitted or empty, all validation rules are applied. + * @example references + */ + SkipContentSourceValidation: 'references'[]; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + Blueprints_List: { + parameters: { + query?: { + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['BlueprintPage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Blueprints_Create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The blueprint that should be created. */ + requestBody: { + content: { + 'application/json': components['schemas']['Blueprint']; + }; + }; + responses: { + /** @description Created */ + 201: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + /** @description Indicates the URL of the newly-created resource. */ + Location?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['Blueprint']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Blueprints_Get: { + parameters: { + query?: never; + header?: { + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + /** @description The key of the blueprint to retrieve. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['Blueprint']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Blueprints_Delete: { + parameters: { + query?: never; + header?: { + /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the blueprint to delete. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['Blueprint']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Blueprints_Patch: { + parameters: { + query?: never; + header?: { + /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the blueprint to patch. */ + key: string; + }; + cookie?: never; + }; + /** @description The values of the blueprint that should be patched formatted according to RFC7396. */ + requestBody: { + content: { + 'application/merge-patch+json': components['schemas']['Blueprint']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['Blueprint']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_Create: { + parameters: { + query?: never; + header?: { + /** + * @description Indicates which content validation rules should be bypassed. Use with caution as this may allow creation of invalid content that could cause issues in production. Accepts '*' to bypass all validation rules, or a comma-separated list of specific validations to skip: 'data' (skip data validation such as required fields), 'references' (skip reference validation such as checking if referenced content exists). Examples: '*', 'data', 'data,references' + * @example data,references + */ + 'cms-skip-validation'?: components['parameters']['SkipValidation']; + }; + path?: never; + cookie?: never; + }; + /** @description The content item that should be created. */ + requestBody: { + content: { + 'application/json': components['schemas']['NewContent']; + 'multipart/form-data': { + content: components['schemas']['NewContent']; + /** + * Format: binary + * @description The media file to upload. + */ + file: string; + }; + }; }; responses: { - /** @description Bad Request */ - BadRequest: { - headers: { - [name: string]: unknown; - }; - content: { - "application/problem+json": components["schemas"]["ProblemDetails"]; - }; - }; - /** @description Unauthorized */ - Unauthorized: { - headers: { - [name: string]: unknown; - }; - content: { - "application/problem+json": components["schemas"]["ProblemDetails"]; - }; - }; - /** @description Forbidden */ - Forbidden: { - headers: { - [name: string]: unknown; - }; - content: { - "application/problem+json": components["schemas"]["ProblemDetails"]; - }; - }; - /** @description Not Found */ - NotFound: { - headers: { - [name: string]: unknown; - }; - content: { - "application/problem+json": components["schemas"]["ProblemDetails"]; - }; - }; - /** @description Conflict */ - Conflict: { - headers: { - [name: string]: unknown; - }; - content: { - "application/problem+json": components["schemas"]["ProblemDetails"]; - }; - }; - /** @description Too Many Requests */ - TooManyRequests: { - headers: { - /** @description Indicates how long the client should wait before making a new request. */ - "Retry-After"?: number; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ProblemDetails"]; - }; - }; - /** @description Internal Server Error */ - InternalServerError: { - headers: { - [name: string]: unknown; - }; - content: { - "application/problem+json": components["schemas"]["ProblemDetails"]; - }; - }; - /** @description Precondition Failed */ - PreconditionFailed: { - headers: { - [name: string]: unknown; - }; - content: { - "application/problem+json": components["schemas"]["ProblemDetails"]; - }; - }; + /** @description Created */ + 201: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + /** @description Indicates the URL of the newly-created resource. */ + Location?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['NewContentNode']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_Copy: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The key of the content item to copy. */ + key: string; + }; + cookie?: never; + }; + /** @description Optional instructions for how to copy content. */ + requestBody?: { + content: { + 'application/json': components['schemas']['CopyContentOptions']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentNode']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_Undelete: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The key of the content item to undelete. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentNode']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_GetNode: { + parameters: { + query?: never; + header?: { + /** @description Indicates that metadata for a deleted content may be returned. */ + 'cms-allow-deleted'?: boolean; + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + /** @description The key of the content to retrieve the node for. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentNode']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_Delete: { + parameters: { + query?: never; + header?: { + /** @description Indicates that the content item should be permanently deleted immediately or if it should be soft deleted first. */ + 'cms-permanent-delete'?: boolean; + /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content item to delete. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentNode']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_PatchNode: { + parameters: { + query?: never; + header?: { + /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content item to patch. */ + key: string; + }; + cookie?: never; + }; + /** @description The values of the content item that should be patched. */ + requestBody: { + content: { + 'application/merge-patch+json': components['schemas']['ContentNode']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentNode']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_ListAssets: { + parameters: { + query?: { + /** @description Indicates which content types or base types to include in the list. */ + contentTypes?: string[]; + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path: { + /** @description The key of the content to retrieve assets for. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentNodePage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_ListItems: { + parameters: { + query?: { + /** @description Indicates which content types or base types to include in the list. */ + contentTypes?: string[]; + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path: { + /** @description The key of the content to retrieve items for. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentNodePage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_ListLocaleVersions: { + parameters: { + query?: { + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path: { + /** @description The key of the content item for which versions should be listed. */ + key: string; + /** @description The locale of the content item for which versions should be listed. */ + locale: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersionPage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_DeleteLocale: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The key of the content item that should be deleted. */ + key: string; + /** @description The locale that should be deleted for the content item. */ + locale: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_GetPath: { + parameters: { + query?: { + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path: { + /** @description The key of the content path to retrieve. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentNodePage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_ListVersions: { + parameters: { + query?: { + /** @description Optional list of locales that should be included. Locale must be a valid IETF BCP-47 language tag. Use 'NEUTRAL' to include locale-neutral content. */ + locales?: string[]; + /** @description Optional list of status values that versions must have one of to be included. */ + statuses?: ('draft' | 'ready' | 'published' | 'previous' | 'scheduled' | 'rejected' | 'inReview')[]; + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path: { + /** @description The key of the content item for which versions should be listed. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersionPage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_CreateVersion: { + parameters: { + query?: never; + header?: { + /** + * @description Indicates which content validation rules should be bypassed. Use with caution as this may allow creation of invalid content that could cause issues in production. Accepts '*' to bypass all validation rules, or a comma-separated list of specific validations to skip: 'data' (skip data validation such as required fields), 'references' (skip reference validation such as checking if referenced content exists). Examples: '*', 'data', 'data,references' + * @example data,references + */ + 'cms-skip-validation'?: components['parameters']['SkipValidation']; + }; + path: { + /** @description The key of the content item for which a new content version should be created. */ + key: string; + }; + cookie?: never; + }; + /** @description The content version that should be created. */ + requestBody: { + content: { + 'application/json': components['schemas']['ContentVersion']; + 'multipart/form-data': { + content: components['schemas']['ContentVersion']; + /** + * Format: binary + * @description The media file to upload. + */ + file: string; + }; + }; + }; + responses: { + /** @description Created */ + 201: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + /** @description Indicates the URL of the newly-created resource. */ + Location?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_Approve: { + parameters: { + query?: never; + header?: { + /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content item. */ + key: string; + /** @description The version of the content item. */ + version: string; + }; + cookie?: never; + }; + /** @description Options for the approval decision. Use 'force' to bypass the normal approval flow (requires admin access). */ + requestBody?: { + content: { + 'application/json': components['schemas']['ApprovalDecisionOptions']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_Draft: { + parameters: { + query?: never; + header?: { + /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content item. */ + key: string; + /** @description The version of the content item. */ + version: string; + }; + cookie?: never; }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_Publish: { + parameters: { + query?: never; + header?: { + /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content item to publish. */ + key: string; + /** @description The version of the content item to publish. */ + version: string; + }; + cookie?: never; + }; + /** @description Optional instructions for how to publish content. */ + requestBody?: { + content: { + 'application/json': components['schemas']['PublishContentOptions']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_Ready: { + parameters: { + query?: never; + header?: { + /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content item. */ + key: string; + /** @description The version of the content item. */ + version: string; + }; + cookie?: never; + }; + /** @description Optional instructions such as a comment for the approval. */ + requestBody?: { + content: { + 'application/json': components['schemas']['ReadyContentOptions']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_Reject: { + parameters: { + query?: never; + header?: { + /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content item. */ + key: string; + /** @description The version of the content item. */ + version: string; + }; + cookie?: never; + }; + /** @description Options for the rejection decision. Use 'force' to bypass the normal approval flow (requires admin access). */ + requestBody?: { + content: { + 'application/json': components['schemas']['ApprovalDecisionOptions']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_GetVersion: { + parameters: { + query?: never; + header?: { + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + key: string; + version: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_DeleteVersion: { + parameters: { + query?: never; + header?: { + /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content item that should be deleted. */ + key: string; + /** @description The version of the content item that should be deleted. */ + version: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_PatchVersion: { parameters: { + query?: never; + header?: { /** * @description Indicates which content validation rules should be bypassed. Use with caution as this may allow creation of invalid content that could cause issues in production. Accepts '*' to bypass all validation rules, or a comma-separated list of specific validations to skip: 'data' (skip data validation such as required fields), 'references' (skip reference validation such as checking if referenced content exists). Examples: '*', 'data', 'data,references' * @example data,references */ - SkipValidation: ("*" | "data" | "references")[]; + 'cms-skip-validation'?: components['parameters']['SkipValidation']; + /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content item that should be patched. */ + key: string; + /** @description The version of the content item that should be patched. */ + version: string; + }; + cookie?: never; + }; + /** @description The content information that should be patched. */ + requestBody: { + content: { + 'application/merge-patch+json': components['schemas']['ContentVersion']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersion']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_GetMedia: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The key of the content item. */ + key: string; + /** @description The version of the content item. */ + version: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Content_ListAllVersions: { + parameters: { + query?: { + /** @description Optional list of locales that should be included. Locale must be a valid IETF BCP-47 language tag. Use 'NEUTRAL' to include locale-neutral content. */ + locales?: string[]; + /** @description Optional list of status values that versions must have one of to be included. */ + statuses?: ('draft' | 'ready' | 'published' | 'previous' | 'scheduled' | 'rejected' | 'inReview')[]; + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentVersionPage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentSources_List: { + parameters: { + query?: { + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentSourcePage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentSources_Create: { + parameters: { + query?: never; + header?: { + /** + * @description Indicates which content source validation rules should be bypassed. Provide a comma-separated list of rule identifiers (for example, 'references' to skip reference validation, such as checking whether a referenced content type exists or is a valid type). If this header is omitted or empty, all validation rules are applied. + * @example references + */ + 'cms-skip-content-source-validation'?: components['parameters']['SkipContentSourceValidation']; + }; + path?: never; + cookie?: never; + }; + /** @description The contentsource that should be created. */ + requestBody: { + content: { + 'application/json': components['schemas']['ContentSource']; + }; + }; + responses: { + /** @description Created */ + 201: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + /** @description Indicates the URL of the newly-created resource. */ + Location?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentSource']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentSources_Get: { + parameters: { + query?: never; + header?: { + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + /** @description The key of the contentsource to retrieve. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentSource']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentSources_Delete: { + parameters: { + query?: never; + header?: { + /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the contentsource to delete. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentSource']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentSources_Patch: { + parameters: { + query?: never; + header?: { /** * @description Indicates which content source validation rules should be bypassed. Provide a comma-separated list of rule identifiers (for example, 'references' to skip reference validation, such as checking whether a referenced content type exists or is a valid type). If this header is omitted or empty, all validation rules are applied. * @example references */ - SkipContentSourceValidation: "references"[]; + 'cms-skip-content-source-validation'?: components['parameters']['SkipContentSourceValidation']; + /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the contentsource to patch. */ + key: string; + }; + cookie?: never; }; - requestBodies: never; - headers: never; - pathItems: never; -} -export type $defs = Record; -export interface operations { - Blueprints_List: { - parameters: { - query?: { - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BlueprintPage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Blueprints_Create: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** @description The blueprint that should be created. */ - requestBody: { - content: { - "application/json": components["schemas"]["Blueprint"]; - }; - }; - responses: { - /** @description Created */ - 201: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - /** @description Indicates the URL of the newly-created resource. */ - Location?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Blueprint"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Blueprints_Get: { - parameters: { - query?: never; - header?: { - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - /** @description The key of the blueprint to retrieve. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Blueprint"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Blueprints_Delete: { - parameters: { - query?: never; - header?: { - /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the blueprint to delete. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Blueprint"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Blueprints_Patch: { - parameters: { - query?: never; - header?: { - /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the blueprint to patch. */ - key: string; - }; - cookie?: never; - }; - /** @description The values of the blueprint that should be patched formatted according to RFC7396. */ - requestBody: { - content: { - "application/merge-patch+json": components["schemas"]["Blueprint"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Blueprint"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_Create: { - parameters: { - query?: never; - header?: { - /** - * @description Indicates which content validation rules should be bypassed. Use with caution as this may allow creation of invalid content that could cause issues in production. Accepts '*' to bypass all validation rules, or a comma-separated list of specific validations to skip: 'data' (skip data validation such as required fields), 'references' (skip reference validation such as checking if referenced content exists). Examples: '*', 'data', 'data,references' - * @example data,references - */ - "cms-skip-validation"?: components["parameters"]["SkipValidation"]; - }; - path?: never; - cookie?: never; - }; - /** @description The content item that should be created. */ - requestBody: { - content: { - "application/json": components["schemas"]["NewContent"]; - "multipart/form-data": { - content: components["schemas"]["NewContent"]; - /** - * Format: binary - * @description The media file to upload. - */ - file: string; - }; - }; - }; - responses: { - /** @description Created */ - 201: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - /** @description Indicates the URL of the newly-created resource. */ - Location?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["NewContentNode"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_Copy: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The key of the content item to copy. */ - key: string; - }; - cookie?: never; - }; - /** @description Optional instructions for how to copy content. */ - requestBody?: { - content: { - "application/json": components["schemas"]["CopyContentOptions"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentNode"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_Undelete: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The key of the content item to undelete. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentNode"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_GetNode: { - parameters: { - query?: never; - header?: { - /** @description Indicates that metadata for a deleted content may be returned. */ - "cms-allow-deleted"?: boolean; - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - /** @description The key of the content to retrieve the node for. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentNode"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_Delete: { - parameters: { - query?: never; - header?: { - /** @description Indicates that the content item should be permanently deleted immediately or if it should be soft deleted first. */ - "cms-permanent-delete"?: boolean; - /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content item to delete. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentNode"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_PatchNode: { - parameters: { - query?: never; - header?: { - /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content item to patch. */ - key: string; - }; - cookie?: never; - }; - /** @description The values of the content item that should be patched. */ - requestBody: { - content: { - "application/merge-patch+json": components["schemas"]["ContentNode"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentNode"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_ListAssets: { - parameters: { - query?: { - /** @description Indicates which content types or base types to include in the list. */ - contentTypes?: string[]; - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path: { - /** @description The key of the content to retrieve assets for. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentNodePage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_ListItems: { - parameters: { - query?: { - /** @description Indicates which content types or base types to include in the list. */ - contentTypes?: string[]; - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path: { - /** @description The key of the content to retrieve items for. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentNodePage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_ListLocaleVersions: { - parameters: { - query?: { - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path: { - /** @description The key of the content item for which versions should be listed. */ - key: string; - /** @description The locale of the content item for which versions should be listed. */ - locale: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersionPage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_DeleteLocale: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The key of the content item that should be deleted. */ - key: string; - /** @description The locale that should be deleted for the content item. */ - locale: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_GetPath: { - parameters: { - query?: { - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path: { - /** @description The key of the content path to retrieve. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentNodePage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_ListVersions: { - parameters: { - query?: { - /** @description Optional list of locales that should be included. Locale must be a valid IETF BCP-47 language tag. Use 'NEUTRAL' to include locale-neutral content. */ - locales?: string[]; - /** @description Optional list of status values that versions must have one of to be included. */ - statuses?: ("draft" | "ready" | "published" | "previous" | "scheduled" | "rejected" | "inReview")[]; - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path: { - /** @description The key of the content item for which versions should be listed. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersionPage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_CreateVersion: { - parameters: { - query?: never; - header?: { - /** - * @description Indicates which content validation rules should be bypassed. Use with caution as this may allow creation of invalid content that could cause issues in production. Accepts '*' to bypass all validation rules, or a comma-separated list of specific validations to skip: 'data' (skip data validation such as required fields), 'references' (skip reference validation such as checking if referenced content exists). Examples: '*', 'data', 'data,references' - * @example data,references - */ - "cms-skip-validation"?: components["parameters"]["SkipValidation"]; - }; - path: { - /** @description The key of the content item for which a new content version should be created. */ - key: string; - }; - cookie?: never; - }; - /** @description The content version that should be created. */ - requestBody: { - content: { - "application/json": components["schemas"]["ContentVersion"]; - "multipart/form-data": { - content: components["schemas"]["ContentVersion"]; - /** - * Format: binary - * @description The media file to upload. - */ - file: string; - }; - }; - }; - responses: { - /** @description Created */ - 201: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - /** @description Indicates the URL of the newly-created resource. */ - Location?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_Approve: { - parameters: { - query?: never; - header?: { - /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content item. */ - key: string; - /** @description The version of the content item. */ - version: string; - }; - cookie?: never; - }; - /** @description Options for the approval decision. Use 'force' to bypass the normal approval flow (requires admin access). */ - requestBody?: { - content: { - "application/json": components["schemas"]["ApprovalDecisionOptions"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_Draft: { - parameters: { - query?: never; - header?: { - /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content item. */ - key: string; - /** @description The version of the content item. */ - version: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_Publish: { - parameters: { - query?: never; - header?: { - /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content item to publish. */ - key: string; - /** @description The version of the content item to publish. */ - version: string; - }; - cookie?: never; - }; - /** @description Optional instructions for how to publish content. */ - requestBody?: { - content: { - "application/json": components["schemas"]["PublishContentOptions"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_Ready: { - parameters: { - query?: never; - header?: { - /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content item. */ - key: string; - /** @description The version of the content item. */ - version: string; - }; - cookie?: never; - }; - /** @description Optional instructions such as a comment for the approval. */ - requestBody?: { - content: { - "application/json": components["schemas"]["ReadyContentOptions"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_Reject: { - parameters: { - query?: never; - header?: { - /** @description If provided, the POST request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the POST request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content item. */ - key: string; - /** @description The version of the content item. */ - version: string; - }; - cookie?: never; - }; - /** @description Options for the rejection decision. Use 'force' to bypass the normal approval flow (requires admin access). */ - requestBody?: { - content: { - "application/json": components["schemas"]["ApprovalDecisionOptions"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_GetVersion: { - parameters: { - query?: never; - header?: { - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - key: string; - version: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_DeleteVersion: { - parameters: { - query?: never; - header?: { - /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content item that should be deleted. */ - key: string; - /** @description The version of the content item that should be deleted. */ - version: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_PatchVersion: { - parameters: { - query?: never; - header?: { - /** - * @description Indicates which content validation rules should be bypassed. Use with caution as this may allow creation of invalid content that could cause issues in production. Accepts '*' to bypass all validation rules, or a comma-separated list of specific validations to skip: 'data' (skip data validation such as required fields), 'references' (skip reference validation such as checking if referenced content exists). Examples: '*', 'data', 'data,references' - * @example data,references - */ - "cms-skip-validation"?: components["parameters"]["SkipValidation"]; - /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content item that should be patched. */ - key: string; - /** @description The version of the content item that should be patched. */ - version: string; - }; - cookie?: never; - }; - /** @description The content information that should be patched. */ - requestBody: { - content: { - "application/merge-patch+json": components["schemas"]["ContentVersion"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersion"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_GetMedia: { - parameters: { - query?: never; - header?: never; - path: { - /** @description The key of the content item. */ - key: string; - /** @description The version of the content item. */ - version: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Content_ListAllVersions: { - parameters: { - query?: { - /** @description Optional list of locales that should be included. Locale must be a valid IETF BCP-47 language tag. Use 'NEUTRAL' to include locale-neutral content. */ - locales?: string[]; - /** @description Optional list of status values that versions must have one of to be included. */ - statuses?: ("draft" | "ready" | "published" | "previous" | "scheduled" | "rejected" | "inReview")[]; - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentVersionPage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentSources_List: { - parameters: { - query?: { - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentSourcePage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentSources_Create: { - parameters: { - query?: never; - header?: { - /** - * @description Indicates which content source validation rules should be bypassed. Provide a comma-separated list of rule identifiers (for example, 'references' to skip reference validation, such as checking whether a referenced content type exists or is a valid type). If this header is omitted or empty, all validation rules are applied. - * @example references - */ - "cms-skip-content-source-validation"?: components["parameters"]["SkipContentSourceValidation"]; - }; - path?: never; - cookie?: never; - }; - /** @description The contentsource that should be created. */ - requestBody: { - content: { - "application/json": components["schemas"]["ContentSource"]; - }; - }; - responses: { - /** @description Created */ - 201: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - /** @description Indicates the URL of the newly-created resource. */ - Location?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentSource"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentSources_Get: { - parameters: { - query?: never; - header?: { - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - /** @description The key of the contentsource to retrieve. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentSource"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentSources_Delete: { - parameters: { - query?: never; - header?: { - /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the contentsource to delete. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentSource"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentSources_Patch: { - parameters: { - query?: never; - header?: { - /** - * @description Indicates which content source validation rules should be bypassed. Provide a comma-separated list of rule identifiers (for example, 'references' to skip reference validation, such as checking whether a referenced content type exists or is a valid type). If this header is omitted or empty, all validation rules are applied. - * @example references - */ - "cms-skip-content-source-validation"?: components["parameters"]["SkipContentSourceValidation"]; - /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the contentsource to patch. */ - key: string; - }; - cookie?: never; - }; - /** @description The values of the contentsource that should be patched formatted according to RFC7396. */ - requestBody: { - content: { - "application/merge-patch+json": components["schemas"]["ContentSource"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentSource"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypeBindings_List: { - parameters: { - query?: { - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentTypeBindingPage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypeBindings_Create: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** @description The contenttypebinding that should be created. */ - requestBody: { - content: { - "application/json": components["schemas"]["ContentTypeBinding"]; - }; - }; - responses: { - /** @description Created */ - 201: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - /** @description Indicates the URL of the newly-created resource. */ - Location?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentTypeBinding"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypeBindings_Get: { - parameters: { - query?: never; - header?: { - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - /** @description The key of the contenttypebinding to retrieve. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentTypeBinding"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypeBindings_Delete: { - parameters: { - query?: never; - header?: { - /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the contenttypebinding to delete. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentTypeBinding"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypeBindings_Patch: { - parameters: { - query?: never; - header?: { - /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the contenttypebinding to patch. */ - key: string; - }; - cookie?: never; - }; - /** @description The values of the contenttypebinding that should be patched formatted according to RFC7396. */ - requestBody: { - content: { - "application/merge-patch+json": components["schemas"]["ContentTypeBinding"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentTypeBinding"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypes_List: { - parameters: { - query?: { - /** @description Only include types that are available for creation under the provided container type */ - forContainerType?: string; - /** @description Indicates which sources should be included when listing content types. Use 'DEFAULT' to include content types without a specific source. */ - sources?: string[]; - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentTypePage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypes_Create: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** @description The content type that should be created. */ - requestBody: { - content: { - "application/json": components["schemas"]["ContentType"]; - }; - }; - responses: { - /** @description Created */ - 201: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - /** @description Indicates the URL of the newly-created resource. */ - Location?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentType"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypes_Get: { - parameters: { - query?: never; - header?: { - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - /** @description The key of the content type to retrieve. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentType"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypes_Delete: { - parameters: { - query?: never; - header?: { - /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content type to delete. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentType"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - ContentTypes_Patch: { - parameters: { - query?: never; - header?: { - /** @description Patch the content type even though the changes might result in data loss. */ - "cms-ignore-data-loss-warnings"?: boolean; - /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the content type to patch. */ - key: string; - }; - cookie?: never; - }; - /** @description The values of the content type that should be patched formatted according to RFC7396. */ - requestBody: { - content: { - "application/merge-patch+json": components["schemas"]["ContentType"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ContentType"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - DisplayTemplates_List: { - parameters: { - query?: { - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["DisplayTemplatePage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - DisplayTemplates_Create: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** @description The display template that should be created. */ - requestBody: { - content: { - "application/json": components["schemas"]["DisplayTemplate"]; - }; - }; - responses: { - /** @description Created */ - 201: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - /** @description Indicates the URL of the newly-created resource. */ - Location?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["DisplayTemplate"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - DisplayTemplates_Get: { - parameters: { - query?: never; - header?: { - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - /** @description The key of the display template to retrieve. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["DisplayTemplate"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - DisplayTemplates_Delete: { - parameters: { - query?: never; - header?: { - /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the display template to delete. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["DisplayTemplate"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - DisplayTemplates_Patch: { - parameters: { - query?: never; - header?: { - /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the display template to patch. */ - key: string; - }; - cookie?: never; - }; - /** @description The values of the display template that should be patched formatted according to RFC7396. */ - requestBody: { - content: { - "application/merge-patch+json": components["schemas"]["DisplayTemplate"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["DisplayTemplate"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Locales_List: { - parameters: { - query?: { - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["LocalePage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Locales_Create: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** @description The locale that should be created. */ - requestBody: { - content: { - "application/json": components["schemas"]["Locale"]; - }; - }; - responses: { - /** @description Created */ - 201: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - /** @description Indicates the URL of the newly-created resource. */ - Location?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Locale"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Locales_Get: { - parameters: { - query?: never; - header?: { - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - /** @description The key of the locale to retrieve. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Locale"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Locales_Delete: { - parameters: { - query?: never; - header?: { - /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the locale to delete. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Locale"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Locales_Patch: { - parameters: { - query?: never; - header?: { - /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the locale to patch. */ - key: string; - }; - cookie?: never; - }; - /** @description The values of the locale that should be patched formatted according to RFC7396. */ - requestBody: { - content: { - "application/merge-patch+json": components["schemas"]["Locale"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Locale"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Manifest_Export: { - parameters: { - query?: { - /** @description The sections that should be included in the manifest export. If not provided, all sections will be included. */ - sections?: ("locales" | "contentTypes" | "propertyGroups" | "displayTemplates")[]; - /** @description Indicates if read-only resources should be included in the manifest export. */ - includeReadOnly?: boolean; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["Manifest"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - Manifest_Import: { - parameters: { - query?: never; - header?: { - /** @description Indicates if manifest resources should be updated even though the changes might result in data loss. */ - "cms-ignore-data-loss-warnings"?: boolean; - }; - path?: never; - cookie?: never; - }; - /** @description The manifest that should be imported. */ - requestBody: { - content: { - "application/json": components["schemas"]["Manifest"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ManifestImportResult"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - PropertyFormats_List: { - parameters: { - query?: { - /** @description Zero based index of the page that should be retrieved. */ - pageIndex?: number; - /** @description The maximum items per page that should be retrieved. */ - pageSize?: number; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["PropertyFormatPage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - PropertyFormats_Get: { - parameters: { - query?: { - /** @description Indicates that a deleted property format may be returned. */ - allowDeleted?: boolean; - }; - header?: { - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - /** @description The key of the property format to retrieve. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["PropertyFormat"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - PropertyGroups_List: { - parameters: { - query?: { - /** @description Indicates which property groups sources should be listed. Use 'DEFAULT' to include groups without a specific source. */ - sources?: string[]; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["PropertyGroupPage"]; - }; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - PropertyGroups_Create: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** @description The property group that should be created. */ - requestBody: { - content: { - "application/json": components["schemas"]["PropertyGroup"]; - }; - }; - responses: { - /** @description Created */ - 201: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - /** @description Indicates the URL of the newly-created resource. */ - Location?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["PropertyGroup"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 409: components["responses"]["Conflict"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - PropertyGroups_Get: { - parameters: { - query?: never; - header?: { - /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ - "If-None-Match"?: string; - /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ - "If-Modified-Since"?: string; - }; - path: { - /** @description The key of the property group to retrieve. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["PropertyGroup"]; - }; - }; - /** @description Not Modified */ - 304: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content?: never; - }; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - PropertyGroups_Delete: { - parameters: { - query?: never; - header?: { - /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the property group to delete. */ - key: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["PropertyGroup"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; - }; - PropertyGroups_Patch: { - parameters: { - query?: never; - header?: { - /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ - "If-Match"?: string; - /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ - "If-Unmodified-Since"?: string; - }; - path: { - /** @description The key of the property group to patch. */ - key: string; - }; - cookie?: never; - }; - /** @description The values of the property group that should be patched formatted according to RFC7396. */ - requestBody: { - content: { - "application/merge-patch+json": components["schemas"]["PropertyGroup"]; - }; - }; - responses: { - /** @description OK */ - 200: { - headers: { - /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ - ETag?: string; - /** @description The date and time at which the resource was last modified. */ - "Last-Modified"?: string; - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["PropertyGroup"]; - }; - }; - 400: components["responses"]["BadRequest"]; - 401: components["responses"]["Unauthorized"]; - 403: components["responses"]["Forbidden"]; - 404: components["responses"]["NotFound"]; - 412: components["responses"]["PreconditionFailed"]; - 429: components["responses"]["TooManyRequests"]; - 500: components["responses"]["InternalServerError"]; - }; + /** @description The values of the contentsource that should be patched formatted according to RFC7396. */ + requestBody: { + content: { + 'application/merge-patch+json': components['schemas']['ContentSource']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentSource']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypeBindings_List: { + parameters: { + query?: { + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentTypeBindingPage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypeBindings_Create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The contenttypebinding that should be created. */ + requestBody: { + content: { + 'application/json': components['schemas']['ContentTypeBinding']; + }; + }; + responses: { + /** @description Created */ + 201: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + /** @description Indicates the URL of the newly-created resource. */ + Location?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentTypeBinding']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypeBindings_Get: { + parameters: { + query?: never; + header?: { + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + /** @description The key of the contenttypebinding to retrieve. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentTypeBinding']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypeBindings_Delete: { + parameters: { + query?: never; + header?: { + /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the contenttypebinding to delete. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentTypeBinding']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypeBindings_Patch: { + parameters: { + query?: never; + header?: { + /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the contenttypebinding to patch. */ + key: string; + }; + cookie?: never; + }; + /** @description The values of the contenttypebinding that should be patched formatted according to RFC7396. */ + requestBody: { + content: { + 'application/merge-patch+json': components['schemas']['ContentTypeBinding']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentTypeBinding']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypes_List: { + parameters: { + query?: { + /** @description Only include types that are available for creation under the provided container type */ + forContainerType?: string; + /** @description Indicates which sources should be included when listing content types. Use 'DEFAULT' to include content types without a specific source. */ + sources?: string[]; + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentTypePage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypes_Create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The content type that should be created. */ + requestBody: { + content: { + 'application/json': components['schemas']['ContentType']; + }; + }; + responses: { + /** @description Created */ + 201: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + /** @description Indicates the URL of the newly-created resource. */ + Location?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentType']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypes_Get: { + parameters: { + query?: never; + header?: { + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + /** @description The key of the content type to retrieve. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentType']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypes_Delete: { + parameters: { + query?: never; + header?: { + /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content type to delete. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentType']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + ContentTypes_Patch: { + parameters: { + query?: never; + header?: { + /** @description Patch the content type even though the changes might result in data loss. */ + 'cms-ignore-data-loss-warnings'?: boolean; + /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the content type to patch. */ + key: string; + }; + cookie?: never; + }; + /** @description The values of the content type that should be patched formatted according to RFC7396. */ + requestBody: { + content: { + 'application/merge-patch+json': components['schemas']['ContentType']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ContentType']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + DisplayTemplates_List: { + parameters: { + query?: { + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['DisplayTemplatePage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + DisplayTemplates_Create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The display template that should be created. */ + requestBody: { + content: { + 'application/json': components['schemas']['DisplayTemplate']; + }; + }; + responses: { + /** @description Created */ + 201: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + /** @description Indicates the URL of the newly-created resource. */ + Location?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['DisplayTemplate']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + DisplayTemplates_Get: { + parameters: { + query?: never; + header?: { + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + /** @description The key of the display template to retrieve. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['DisplayTemplate']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + DisplayTemplates_Delete: { + parameters: { + query?: never; + header?: { + /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the display template to delete. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['DisplayTemplate']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + DisplayTemplates_Patch: { + parameters: { + query?: never; + header?: { + /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the display template to patch. */ + key: string; + }; + cookie?: never; + }; + /** @description The values of the display template that should be patched formatted according to RFC7396. */ + requestBody: { + content: { + 'application/merge-patch+json': components['schemas']['DisplayTemplate']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['DisplayTemplate']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Locales_List: { + parameters: { + query?: { + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['LocalePage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Locales_Create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The locale that should be created. */ + requestBody: { + content: { + 'application/json': components['schemas']['Locale']; + }; + }; + responses: { + /** @description Created */ + 201: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + /** @description Indicates the URL of the newly-created resource. */ + Location?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['Locale']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Locales_Get: { + parameters: { + query?: never; + header?: { + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + /** @description The key of the locale to retrieve. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['Locale']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Locales_Delete: { + parameters: { + query?: never; + header?: { + /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the locale to delete. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['Locale']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Locales_Patch: { + parameters: { + query?: never; + header?: { + /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the locale to patch. */ + key: string; + }; + cookie?: never; + }; + /** @description The values of the locale that should be patched formatted according to RFC7396. */ + requestBody: { + content: { + 'application/merge-patch+json': components['schemas']['Locale']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['Locale']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Manifest_Export: { + parameters: { + query?: { + /** @description The sections that should be included in the manifest export. If not provided, all sections will be included. */ + sections?: ('locales' | 'contentTypes' | 'propertyGroups' | 'displayTemplates')[]; + /** @description Indicates if read-only resources should be included in the manifest export. */ + includeReadOnly?: boolean; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['Manifest']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + Manifest_Import: { + parameters: { + query?: never; + header?: { + /** @description Indicates if manifest resources should be updated even though the changes might result in data loss. */ + 'cms-ignore-data-loss-warnings'?: boolean; + }; + path?: never; + cookie?: never; + }; + /** @description The manifest that should be imported. */ + requestBody: { + content: { + 'application/json': components['schemas']['Manifest']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['ManifestImportResult']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + PropertyFormats_List: { + parameters: { + query?: { + /** @description Zero based index of the page that should be retrieved. */ + pageIndex?: number; + /** @description The maximum items per page that should be retrieved. */ + pageSize?: number; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['PropertyFormatPage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + PropertyFormats_Get: { + parameters: { + query?: { + /** @description Indicates that a deleted property format may be returned. */ + allowDeleted?: boolean; + }; + header?: { + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + /** @description The key of the property format to retrieve. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['PropertyFormat']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + PropertyGroups_List: { + parameters: { + query?: { + /** @description Indicates which property groups sources should be listed. Use 'DEFAULT' to include groups without a specific source. */ + sources?: string[]; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['PropertyGroupPage']; + }; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + PropertyGroups_Create: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description The property group that should be created. */ + requestBody: { + content: { + 'application/json': components['schemas']['PropertyGroup']; + }; + }; + responses: { + /** @description Created */ + 201: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + /** @description Indicates the URL of the newly-created resource. */ + Location?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['PropertyGroup']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 409: components['responses']['Conflict']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + PropertyGroups_Get: { + parameters: { + query?: never; + header?: { + /** @description If provided and the value matches the RFC7232 ETag of the current resource a 304 NotModified response will be returned. Weak ETags will always be ignored. */ + 'If-None-Match'?: string; + /** @description If provided and the resource has not been modified since the date a 304 NotModified response will be returned. This parameter will be ignored if an 'If-None-Match' parameter is also provided. */ + 'If-Modified-Since'?: string; + }; + path: { + /** @description The key of the property group to retrieve. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['PropertyGroup']; + }; + }; + /** @description Not Modified */ + 304: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content?: never; + }; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + PropertyGroups_Delete: { + parameters: { + query?: never; + header?: { + /** @description If provided, the DELETE request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the DELETE request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the property group to delete. */ + key: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['PropertyGroup']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; + }; + }; + PropertyGroups_Patch: { + parameters: { + query?: never; + header?: { + /** @description If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored. */ + 'If-Match'?: string; + /** @description If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided. */ + 'If-Unmodified-Since'?: string; + }; + path: { + /** @description The key of the property group to patch. */ + key: string; + }; + cookie?: never; + }; + /** @description The values of the property group that should be patched formatted according to RFC7396. */ + requestBody: { + content: { + 'application/merge-patch+json': components['schemas']['PropertyGroup']; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + /** @description The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time. */ + ETag?: string; + /** @description The date and time at which the resource was last modified. */ + 'Last-Modified'?: string; + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['PropertyGroup']; + }; + }; + 400: components['responses']['BadRequest']; + 401: components['responses']['Unauthorized']; + 403: components['responses']['Forbidden']; + 404: components['responses']['NotFound']; + 412: components['responses']['PreconditionFailed']; + 429: components['responses']['TooManyRequests']; + 500: components['responses']['InternalServerError']; }; + }; } + diff --git a/packages/optimizely-cms-cli/src/service/cmsRestClient.ts b/packages/optimizely-cms-cli/src/service/cmsRestClient.ts index 3b304870..257640e9 100644 --- a/packages/optimizely-cms-cli/src/service/cmsRestClient.ts +++ b/packages/optimizely-cms-cli/src/service/cmsRestClient.ts @@ -28,11 +28,7 @@ function rootUrl(options?: { host?: string; omitVersion?: boolean }): string { const omitVersion = options?.omitVersion ?? false; // Remove trailing slash if present for consistency - const baseUrl = ( - host || - process.env.OPTIMIZELY_CMS_API_URL || - DEFAULT_GATEWAY_URL - ).replace(/\/$/, ''); + const baseUrl = (host || process.env.OPTIMIZELY_CMS_API_URL || DEFAULT_GATEWAY_URL).replace(/\/$/, ''); // PaaS instances always require /_cms prefix and version if (!isSaasApiGateway(baseUrl)) { @@ -45,11 +41,7 @@ function rootUrl(options?: { host?: string; omitVersion?: boolean }): string { return `${baseUrl}/${API_VERSION}`; } -export async function getToken( - clientId: string, - clientSecret: string, - host?: string, -) { +export async function getToken(clientId: string, clientSecret: string, host?: string) { const client = createClient({ baseUrl: rootUrl({ host, omitVersion: true }), }); @@ -76,15 +68,11 @@ export async function getToken( // Generic error message: - throw new Error( - 'Something went wrong when trying to fetch token. Please try again', - ); + throw new Error('Something went wrong when trying to fetch token. Please try again'); } if (!data) { - throw new Error( - 'The endpoint `/oauth/token` did not respond with data', - ); + throw new Error('The endpoint `/oauth/token` did not respond with data'); } return data.access_token; }); @@ -115,3 +103,4 @@ export async function createApiClient(host?: string) { const client = await createRestApiClient({ ...cred, host }); return client; } + diff --git a/packages/optimizely-cms-cli/src/service/config.ts b/packages/optimizely-cms-cli/src/service/config.ts index 9ea08cb4..7bc2196b 100644 --- a/packages/optimizely-cms-cli/src/service/config.ts +++ b/packages/optimizely-cms-cli/src/service/config.ts @@ -9,7 +9,7 @@ const CmsSettingsSchema = z.record( z.object({ clientId: z.string(), clientSecret: z.string(), - }) + }), ); const SettingsSchema = z.object({ @@ -32,8 +32,7 @@ export function getInstances(): string[] { } export function readEnvCredentials() { - const { OPTIMIZELY_CMS_CLIENT_ID, OPTIMIZELY_CMS_CLIENT_SECRET } = - process.env; + const { OPTIMIZELY_CMS_CLIENT_ID, OPTIMIZELY_CMS_CLIENT_SECRET } = process.env; if (OPTIMIZELY_CMS_CLIENT_ID && OPTIMIZELY_CMS_CLIENT_SECRET) { return { diff --git a/packages/optimizely-cms-cli/src/service/error.ts b/packages/optimizely-cms-cli/src/service/error.ts index f40e8864..2938911e 100644 --- a/packages/optimizely-cms-cli/src/service/error.ts +++ b/packages/optimizely-cms-cli/src/service/error.ts @@ -18,7 +18,7 @@ export const credentialErrors = { MissingCredentials: class MissingCredentials extends CLIError { constructor() { super( - 'Credentials not provided. Get the Client ID and Secret from the CMS and define the environment variables `OPTIMIZELY_CMS_CLIENT_ID` and `OPTIMIZELY_CMS_CLIENT_SECRET`' + 'Credentials not provided. Get the Client ID and Secret from the CMS and define the environment variables `OPTIMIZELY_CMS_CLIENT_ID` and `OPTIMIZELY_CMS_CLIENT_SECRET`', ); } }, diff --git a/packages/optimizely-cms-cli/src/service/utils.ts b/packages/optimizely-cms-cli/src/service/utils.ts index 49025144..2b286eef 100644 --- a/packages/optimizely-cms-cli/src/service/utils.ts +++ b/packages/optimizely-cms-cli/src/service/utils.ts @@ -45,10 +45,7 @@ export type FoundContentType = { }; export type ContentTypeMeta = Pick; -export type DisplayTemplateMeta = Pick< - FoundContentType, - 'displayTemplates' | 'path' ->; +export type DisplayTemplateMeta = Pick; function cleanType(obj: any) { if (obj !== null && '__type' in obj) delete obj.__type; @@ -92,11 +89,7 @@ export function extractMetaData(obj: unknown): { } /** Compiles the `fileName` into a JavaScript file in a temporal directory and imports it */ -async function compileAndImport( - inputName: string, - cwdUrl: string, - outDir: string, -) { +async function compileAndImport(inputName: string, cwdUrl: string, outDir: string) { // Note: we must pass paths as "Node.js paths" to `esbuild.build()` const cwdPath = fileURLToPath(cwdUrl); const outPath = path.join(outDir, `${inputName}.js`); @@ -116,11 +109,7 @@ async function compileAndImport( const f = await import(outUrl); return f; } catch (err) { - throw new Error( - `Error when importing the file at path "${outPath}": ${ - (err as any).message - }`, - ); + throw new Error(`Error when importing the file at path "${outPath}": ${(err as any).message}`); } } @@ -135,27 +124,21 @@ export async function findMetaData( const tmpDir = await mkdtemp(path.join(tmpdir(), 'optimizely-cli-')); // Normalize and clean component paths (trim and remove empty patterns) - const cleanedPaths = componentPaths - .map((p) => p.trim()) - .filter((p) => p.length > 0); + const cleanedPaths = componentPaths.map(p => p.trim()).filter(p => p.length > 0); // Separate inclusion and exclusion patterns - const includePatterns = cleanedPaths.filter((p) => !p.startsWith('!')); - const excludePatterns = cleanedPaths - .filter((p) => p.startsWith('!')) - .map((p) => p.substring(1)); // Remove '!' prefix + const includePatterns = cleanedPaths.filter(p => !p.startsWith('!')); + const excludePatterns = cleanedPaths.filter(p => p.startsWith('!')).map(p => p.substring(1)); // Remove '!' prefix // Validate patterns if (includePatterns.length === 0 && excludePatterns.length > 0) { - throw new Error( - `❌ [optimizely-cms-cli] Invalid component paths: cannot have only exclusion patterns`, - ); + throw new Error(`❌ [optimizely-cms-cli] Invalid component paths: cannot have only exclusion patterns`); } // Retrieve sets of files via glob for inclusion patterns, using ignore for exclusions const allFilesWithDuplicates = ( await Promise.all( - includePatterns.map((path) => + includePatterns.map(path => glob(path, { cwd, dotRelative: true, @@ -198,12 +181,7 @@ function printFilesContents( path: string, metaData: AnyContentType | DisplayTemplate | PropertyGroupType, ) { - console.log( - '%s %s found in %s', - type, - chalk.bold(metaData.key), - chalk.yellow.italic.underline(path), - ); + console.log('%s %s found in %s', type, chalk.bold(metaData.key), chalk.yellow.italic.underline(path)); } export async function readFromPath(configPath: string, section: string) { @@ -221,36 +199,25 @@ export async function readFromPath(configPath: string, section: string) { * @returns Validated and normalized property groups array * @throws Error if validation fails (empty or missing key) */ -export function normalizePropertyGroups( - propertyGroups: any[], -): PropertyGroupType[] { +export function normalizePropertyGroups(propertyGroups: any[]): PropertyGroupType[] { if (!Array.isArray(propertyGroups)) { throw new Error('propertyGroups must be an array'); } const normalizedGroups = propertyGroups.map((group, index) => { // Validate key is present and not empty - if ( - !group.key || - typeof group.key !== 'string' || - group.key.trim() === '' - ) { - throw new Error( - `Error in property groups: Property group at index ${index} has an empty or missing "key" field`, - ); + if (!group.key || typeof group.key !== 'string' || group.key.trim() === '') { + throw new Error(`Error in property groups: Property group at index ${index} has an empty or missing "key" field`); } // Auto-generate displayName from key if missing (capitalize first letter) const displayName = - group.displayName && - typeof group.displayName === 'string' && - group.displayName.trim() !== '' - ? group.displayName - : group.key.charAt(0).toUpperCase() + group.key.slice(1); + group.displayName && typeof group.displayName === 'string' && group.displayName.trim() !== '' ? + group.displayName + : group.key.charAt(0).toUpperCase() + group.key.slice(1); // Auto-assign sortOrder based on array position if missing - const sortOrder = - typeof group.sortOrder === 'number' ? group.sortOrder : index + 1; + const sortOrder = typeof group.sortOrder === 'number' ? group.sortOrder : index + 1; return { key: group.key, @@ -277,16 +244,16 @@ export function normalizePropertyGroups( if (duplicates.size > 0) { console.warn( chalk.yellow( - `Warning: Duplicate property group keys found: ${Array.from( - duplicates, - ).join(', ')}. Keeping the first occurrence of each.`, + `Warning: Duplicate property group keys found: ${Array.from(duplicates).join( + ', ', + )}. Keeping the first occurrence of each.`, ), ); } // Log found property groups if (deduplicatedGroups.length > 0) { - const groupKeys = deduplicatedGroups.map((g) => g.displayName).join(', '); + const groupKeys = deduplicatedGroups.map(g => g.displayName).join(', '); console.log('Property Groups found: %s', chalk.bold.cyan(`[${groupKeys}]`)); } @@ -301,13 +268,12 @@ export function normalizePropertyGroups( * @param parentKey - The parent key to use if input is '_self'. * @returns The resolved key name as a string. */ -export function extractKeyName( - input: PermittedTypes, - parentKey: string, -): string { - return typeof input === 'string' - ? input === '_self' - ? parentKey +export function extractKeyName(input: PermittedTypes, parentKey: string): string { + return ( + typeof input === 'string' ? + input === '_self' ? + parentKey : input.trim() - : input.key; + : input.key + ); } diff --git a/packages/optimizely-cms-cli/src/tests/contentTypeGenerator.test.ts b/packages/optimizely-cms-cli/src/tests/contentTypeGenerator.test.ts index 0cb16416..ce87e349 100644 --- a/packages/optimizely-cms-cli/src/tests/contentTypeGenerator.test.ts +++ b/packages/optimizely-cms-cli/src/tests/contentTypeGenerator.test.ts @@ -1,9 +1,5 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { - generateContentTypeFiles, - generateContentTypeCode, - cleanKey, -} from '../generators/contentTypeGenerator.js'; +import { generateContentTypeFiles, generateContentTypeCode, cleanKey } from '../generators/contentTypeGenerator.js'; import { ContentType } from '../generators/manifest.js'; import fs from 'fs/promises'; import path from 'path'; @@ -32,11 +28,7 @@ describe('generateContentTypeFiles', () => { }); it('should generate a file for each content type', async () => { - const files = await generateContentTypeFiles( - contentTypes, - displayTemplatesByContentType, - outputDir, - ); + const files = await generateContentTypeFiles(contentTypes, displayTemplatesByContentType, outputDir); expect(files).toHaveLength(1); const filePath = path.join(outputDir, files[0]); const content = await fs.readFile(filePath, 'utf-8'); @@ -55,14 +47,8 @@ describe('generateContentTypeFiles', () => { ]; await expect( - generateContentTypeFiles( - invalidContentTypes, - displayTemplatesByContentType, - outputDir, - ), - ).rejects.toThrow( - 'Invalid key "***": must contain at least one alphanumeric character', - ); + generateContentTypeFiles(invalidContentTypes, displayTemplatesByContentType, outputDir), + ).rejects.toThrow('Invalid key "***": must contain at least one alphanumeric character'); }); }); @@ -91,15 +77,11 @@ describe('cleanKey', () => { }); it('should throw error for keys with no alphanumeric characters', () => { - expect(() => cleanKey('***')).toThrow( - 'Invalid key "***": must contain at least one alphanumeric character' - ); + expect(() => cleanKey('***')).toThrow('Invalid key "***": must contain at least one alphanumeric character'); }); it('should throw error for keys with only special characters (no alphanumeric)', () => { - expect(() => cleanKey('---___')).toThrow( - 'Invalid key "---___": must contain at least one alphanumeric character' - ); + expect(() => cleanKey('---___')).toThrow('Invalid key "---___": must contain at least one alphanumeric character'); }); it('should preserve case sensitivity', () => { @@ -401,11 +383,7 @@ describe('generateContentTypeCode', () => { }, }; - const code = generateContentTypeCode( - productContentType, - contentTypeToGroupMap, - 'experience', - ); + const code = generateContentTypeCode(productContentType, contentTypeToGroupMap, 'experience'); // Should import from ../component/SEO.js, not ./SEO.js expect(code).toContain("import { SEOCT } from '../component/SEO.js';"); @@ -431,11 +409,7 @@ describe('generateContentTypeCode', () => { }, }; - const code = generateContentTypeCode( - heroContentType, - contentTypeToGroupMap, - 'component', - ); + const code = generateContentTypeCode(heroContentType, contentTypeToGroupMap, 'component'); // Should import from ./Button.js for same group expect(code).toContain("import { ButtonCT } from './Button.js';"); diff --git a/packages/optimizely-cms-cli/src/tests/displayTemplateGenerator.test.ts b/packages/optimizely-cms-cli/src/tests/displayTemplateGenerator.test.ts index 1a305972..8f822fc3 100644 --- a/packages/optimizely-cms-cli/src/tests/displayTemplateGenerator.test.ts +++ b/packages/optimizely-cms-cli/src/tests/displayTemplateGenerator.test.ts @@ -1,8 +1,5 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { - generateDisplayTemplateFiles, - generateDisplayTemplateCode, -} from '../generators/displayTemplateGenerator.js'; +import { generateDisplayTemplateFiles, generateDisplayTemplateCode } from '../generators/displayTemplateGenerator.js'; import { DisplayTemplate } from '../generators/manifest.js'; import fs from 'fs/promises'; import path from 'path'; @@ -29,10 +26,7 @@ describe('generateDisplayTemplateFiles', () => { }); it('should generate a file for each display template', async () => { - const files = await generateDisplayTemplateFiles( - displayTemplates, - outputDir, - ); + const files = await generateDisplayTemplateFiles(displayTemplates, outputDir); expect(files).toHaveLength(1); const filePath = path.join(outputDir, files[0]); const content = await fs.readFile(filePath, 'utf-8'); @@ -49,9 +43,7 @@ describe('generateDisplayTemplateFiles', () => { }, ]; - await expect( - generateDisplayTemplateFiles(invalidDisplayTemplates, outputDir), - ).rejects.toThrow( + await expect(generateDisplayTemplateFiles(invalidDisplayTemplates, outputDir)).rejects.toThrow( 'Invalid key "@@@": must contain at least one alphanumeric character', ); }); diff --git a/packages/optimizely-cms-cli/src/tests/mapContentToManifest.test.ts b/packages/optimizely-cms-cli/src/tests/mapContentToManifest.test.ts index 960256a6..e380c88f 100644 --- a/packages/optimizely-cms-cli/src/tests/mapContentToManifest.test.ts +++ b/packages/optimizely-cms-cli/src/tests/mapContentToManifest.test.ts @@ -20,11 +20,7 @@ describe('mapContentToManifest', () => { displayName: 'Hero Component Updated', }; - const contentTypes = [ - HeroComponentType, - duplicateHero, - BannerComponentType, - ]; + const contentTypes = [HeroComponentType, duplicateHero, BannerComponentType]; const result = mapContentToManifest(contentTypes); @@ -36,9 +32,7 @@ describe('mapContentToManifest', () => { // Should warn about duplicates expect(consoleWarnSpy).toHaveBeenCalledWith( - expect.stringContaining( - 'Duplicate content type keys found: HeroComponent', - ), + expect.stringContaining('Duplicate content type keys found: HeroComponent'), ); }); @@ -56,13 +50,7 @@ describe('mapContentToManifest', () => { displayName: 'Banner 2', }; - const contentTypes = [ - HeroComponentType, - BannerComponentType, - duplicate1, - duplicateBanner, - duplicate2, - ]; + const contentTypes = [HeroComponentType, BannerComponentType, duplicate1, duplicateBanner, duplicate2]; const result = mapContentToManifest(contentTypes); @@ -74,13 +62,9 @@ describe('mapContentToManifest', () => { expect(result[1].displayName).toBe('Banner Component'); // First occurrence // Should warn about both duplicate keys + expect(consoleWarnSpy).toHaveBeenCalledWith(expect.stringContaining('Duplicate content type keys found:')); expect(consoleWarnSpy).toHaveBeenCalledWith( - expect.stringContaining('Duplicate content type keys found:'), - ); - expect(consoleWarnSpy).toHaveBeenCalledWith( - expect.stringMatching( - /HeroComponent.*BannerComponent|BannerComponent.*HeroComponent/, - ), + expect.stringMatching(/HeroComponent.*BannerComponent|BannerComponent.*HeroComponent/), ); }); @@ -135,9 +119,7 @@ describe('mapContentToManifest', () => { expect(result[0].key).toBe('HeroComponent'); expect(result[0].displayName).toBe('Hero Component'); // First kept expect(consoleWarnSpy).toHaveBeenCalledWith( - expect.stringContaining( - 'Duplicate content type keys found: HeroComponent', - ), + expect.stringContaining('Duplicate content type keys found: HeroComponent'), ); }); @@ -183,9 +165,7 @@ describe('mapContentToManifest', () => { // Should warn about duplicate expect(consoleWarnSpy).toHaveBeenCalledWith( - expect.stringContaining( - 'Duplicate content type keys found: HeroComponent', - ), + expect.stringContaining('Duplicate content type keys found: HeroComponent'), ); }); }); diff --git a/packages/optimizely-cms-cli/src/tests/normalizePropertyGroups.test.ts b/packages/optimizely-cms-cli/src/tests/normalizePropertyGroups.test.ts index 774f8a1f..e3e3eb74 100644 --- a/packages/optimizely-cms-cli/src/tests/normalizePropertyGroups.test.ts +++ b/packages/optimizely-cms-cli/src/tests/normalizePropertyGroups.test.ts @@ -44,9 +44,7 @@ describe('normalizePropertyGroups', () => { displayName: 'Meta', sortOrder: 2, }); - expect(consoleWarnSpy).toHaveBeenCalledWith( - expect.stringContaining('Duplicate property group keys found: seo'), - ); + expect(consoleWarnSpy).toHaveBeenCalledWith(expect.stringContaining('Duplicate property group keys found: seo')); }); it('should handle multiple duplicates correctly', () => { @@ -81,14 +79,12 @@ describe('normalizePropertyGroups', () => { const result = normalizePropertyGroups(input); expect(result).toHaveLength(3); - expect(result.find((g) => g.key === 'seo')).toEqual({ + expect(result.find(g => g.key === 'seo')).toEqual({ key: 'seo', displayName: 'SEO 1', sortOrder: 1, }); - expect(consoleWarnSpy).toHaveBeenCalledWith( - expect.stringContaining('Duplicate property group keys found: seo'), - ); + expect(consoleWarnSpy).toHaveBeenCalledWith(expect.stringContaining('Duplicate property group keys found: seo')); }); it('should auto-generate displayName from key if missing', () => { @@ -159,9 +155,7 @@ describe('normalizePropertyGroups', () => { }); it('should throw error if propertyGroups is not an array', () => { - expect(() => normalizePropertyGroups({} as any)).toThrow( - 'propertyGroups must be an array', - ); + expect(() => normalizePropertyGroups({} as any)).toThrow('propertyGroups must be an array'); }); it('should handle empty array', () => { diff --git a/packages/optimizely-cms-cli/src/tests/parseChildContentType.test.ts b/packages/optimizely-cms-cli/src/tests/parseChildContentType.test.ts index 1515d4a3..05a0e487 100644 --- a/packages/optimizely-cms-cli/src/tests/parseChildContentType.test.ts +++ b/packages/optimizely-cms-cli/src/tests/parseChildContentType.test.ts @@ -75,7 +75,7 @@ describe('parseChildContentType errors', () => { const allowedKeys = new Set(['Article', 'Gallery']); expect(() => parseChildContentType(contentType, allowedKeys)).toThrow( - '❌ [optimizely-cms-cli] Duplicate entries in mayContainTypes for content type "Blog": Article' + '❌ [optimizely-cms-cli] Duplicate entries in mayContainTypes for content type "Blog": Article', ); }); @@ -87,7 +87,7 @@ describe('parseChildContentType errors', () => { const allowedKeys = new Set(['Valid']); expect(() => parseChildContentType(contentType, allowedKeys)).toThrow( - '❌ [optimizely-cms-cli] Invalid mayContainTypes for content type "Blog". Unknown content types: Unknown' + '❌ [optimizely-cms-cli] Invalid mayContainTypes for content type "Blog". Unknown content types: Unknown', ); }); }); diff --git a/packages/optimizely-cms-cli/src/tests/transformProperties.test.ts b/packages/optimizely-cms-cli/src/tests/transformProperties.test.ts index 0989ed05..a16d71fe 100644 --- a/packages/optimizely-cms-cli/src/tests/transformProperties.test.ts +++ b/packages/optimizely-cms-cli/src/tests/transformProperties.test.ts @@ -1,17 +1,10 @@ import { describe, it, expect } from 'vitest'; import { transformProperties } from '../utils/mapping.js'; -import { - HeroComponentType, - AboutExperienceType, - BannerComponentType, -} from './fixtures.js'; +import { HeroComponentType, AboutExperienceType, BannerComponentType } from './fixtures.js'; describe('Testing transformProperties', () => { it('should transform heading property correctly', () => { - const result = transformProperties( - HeroComponentType.properties, - HeroComponentType.key - ); + const result = transformProperties(HeroComponentType.properties, HeroComponentType.key); expect(result).toMatchInlineSnapshot(` { "background": { @@ -45,10 +38,7 @@ describe('Testing transformProperties', () => { }); it('should transform AboutExperienceType properties correctly', () => { - const result = transformProperties( - AboutExperienceType.properties, - AboutExperienceType.key - ); + const result = transformProperties(AboutExperienceType.properties, AboutExperienceType.key); expect(result).toMatchInlineSnapshot(` { "section": { @@ -71,10 +61,7 @@ describe('Testing transformProperties', () => { }); it('should transform BannerComponentType properties correctly', () => { - const result = transformProperties( - BannerComponentType.properties, - BannerComponentType.key - ); + const result = transformProperties(BannerComponentType.properties, BannerComponentType.key); expect(result).toMatchInlineSnapshot(` { "submit": { diff --git a/packages/optimizely-cms-cli/src/utils/mapping.ts b/packages/optimizely-cms-cli/src/utils/mapping.ts index f16a2e9b..4907b3ab 100644 --- a/packages/optimizely-cms-cli/src/utils/mapping.ts +++ b/packages/optimizely-cms-cli/src/utils/mapping.ts @@ -17,9 +17,7 @@ export function processDisplayTemplates(displayTemplates: any[]): any[] { } // Infer contentType from key by removing common suffixes - const inferredContentType = dt.key - .replace(/DisplayTemplate$/i, '') - .replace(/Template$/i, ''); + const inferredContentType = dt.key.replace(/DisplayTemplate$/i, '').replace(/Template$/i, ''); return { ...dt, @@ -38,10 +36,7 @@ export function processDisplayTemplates(displayTemplates: any[]): any[] { * @param allowedKeys - Optional set of valid content type keys for validation. * @returns The content type object with a normalized `mayContainTypes` array. */ -export function parseChildContentType( - contentType: Record, - allowedKeys?: Set -): any { +export function parseChildContentType(contentType: Record, allowedKeys?: Set): any { const { mayContainTypes, key: parentKey, ...rest } = contentType; if (!Array.isArray(mayContainTypes)) return { ...rest, key: parentKey }; @@ -73,7 +68,7 @@ export function parseChildContentType( throw new Error( `❌ [optimizely-cms-cli] Duplicate entries in mayContainTypes for content type "${ contentType.key - }": ${duplicates.join(', ')}` + }": ${duplicates.join(', ')}`, ); } @@ -81,7 +76,7 @@ export function parseChildContentType( throw new Error( `❌ [optimizely-cms-cli] Invalid mayContainTypes for content type "${ contentType.key - }". Unknown content types: ${invalid.join(', ')}` + }". Unknown content types: ${invalid.join(', ')}`, ); } @@ -98,14 +93,14 @@ export function parseChildContentType( * @param parentKey - The parent contentType key, used for context in certain transformations (when '_self' is used). * @returns A new object with the same keys as the input object, but with transformed values. */ -export function transformProperties( - properties: Record, - parentKey: string -): Record { - return Object.entries(properties).reduce((acc, [key, value]) => { - acc[key] = transformProperty(value, parentKey); - return acc; - }, {} as Record); +export function transformProperties(properties: Record, parentKey: string): Record { + return Object.entries(properties).reduce( + (acc, [key, value]) => { + acc[key] = transformProperty(value, parentKey); + return acc; + }, + {} as Record, + ); } /** @@ -144,7 +139,7 @@ function transformProperty(property: any, parentKey: string): any { export function validateContentTypeKey(key: string): void { if (isKeyInvalid(key)) { throw new Error( - `❌ [optimizely-cms-cli] Invalid content type key: "${key}". Keys must be alphanumeric and cannot start with a special character or number.` + `❌ [optimizely-cms-cli] Invalid content type key: "${key}". Keys must be alphanumeric and cannot start with a special character or number.`, ); } } @@ -197,10 +192,7 @@ function handleArrayType(property: any): any { if (property.items.type === 'link') { updatedProperty.format = 'LinkCollection'; - } else if ( - property.items.type === 'component' && - property.items.contentType?.key - ) { + } else if (property.items.type === 'component' && property.items.contentType?.key) { updatedProperty.items = { ...property.items, contentType: property.items.contentType.key, @@ -247,10 +239,7 @@ function transformContentReference(reference: any): any { */ function hasContentTypeWithKey(obj: any): boolean { return ( - 'contentType' in obj && - typeof obj.contentType === 'object' && - obj.contentType !== null && - 'key' in obj.contentType + 'contentType' in obj && typeof obj.contentType === 'object' && obj.contentType !== null && 'key' in obj.contentType ); } @@ -265,22 +254,19 @@ function hasContentTypeWithKey(obj: any): boolean { function mapAllowedRestrictedTypes(updatedValue: any, parentKey: string) { // Recursively handle nested 'items' if it's an array if (updatedValue.type === 'array' && updatedValue.items) { - updatedValue.items = mapAllowedRestrictedTypes( - updatedValue.items, - parentKey - ); + updatedValue.items = mapAllowedRestrictedTypes(updatedValue.items, parentKey); } if (['contentReference', 'content'].includes(updatedValue.type)) { if (Array.isArray(updatedValue.allowedTypes)) { updatedValue.allowedTypes = updatedValue.allowedTypes.map((input: any) => - extractKeyName(input, parentKey) + extractKeyName(input, parentKey), ) as any; } if (Array.isArray(updatedValue.restrictedTypes)) { - updatedValue.restrictedTypes = updatedValue.restrictedTypes.map( - (input: any) => extractKeyName(input, parentKey) + updatedValue.restrictedTypes = updatedValue.restrictedTypes.map((input: any) => + extractKeyName(input, parentKey), ) as any; } } diff --git a/packages/optimizely-cms-cli/vitest.config.ts b/packages/optimizely-cms-cli/vitest.config.ts index dd1479c8..65d935f7 100644 --- a/packages/optimizely-cms-cli/vitest.config.ts +++ b/packages/optimizely-cms-cli/vitest.config.ts @@ -4,11 +4,7 @@ export default defineConfig({ test: { globals: true, environment: 'node', - include: [ - 'src/**/*.test.ts', - 'src/**/*.spec.ts', - 'src/**/__tests__/**/*.ts', - ], + include: ['src/**/*.test.ts', 'src/**/*.spec.ts', 'src/**/__tests__/**/*.ts'], coverage: { reporter: ['text', 'html'], }, diff --git a/packages/optimizely-cms-sdk/src/components/richText/base.ts b/packages/optimizely-cms-sdk/src/components/richText/base.ts index 22481e0b..34fde294 100644 --- a/packages/optimizely-cms-sdk/src/components/richText/base.ts +++ b/packages/optimizely-cms-sdk/src/components/richText/base.ts @@ -1,10 +1,4 @@ -import { - buildRenderTree, - decodeHTML, - type Node, - type RenderNode, - type RendererConfig, -} from './renderer.js'; +import { buildRenderTree, decodeHTML, type Node, type RenderNode, type RendererConfig } from './renderer.js'; /** * Configuration for rich text renderers @@ -15,11 +9,7 @@ export interface BaseRendererConfig extends RendererConfig {} * Base class for rich text renderers that provides common functionality * while allowing framework-specific implementations */ -export abstract class BaseRichTextRenderer< - TElement = unknown, - TLeaf = unknown, - TNode = unknown -> { +export abstract class BaseRichTextRenderer { protected config: BaseRendererConfig; constructor(config: Partial = {}) { @@ -53,7 +43,7 @@ export abstract class BaseRichTextRenderer< */ protected getConfig( key: K, - fallback?: BaseRendererConfig[K] + fallback?: BaseRendererConfig[K], ): BaseRendererConfig[K] { return this.config[key] ?? fallback; } @@ -61,11 +51,7 @@ export abstract class BaseRichTextRenderer< /** * Framework-specific element creation (must be implemented by each framework) */ - protected abstract createElement( - node: RenderNode, - children: TNode[], - index: number - ): TNode; + protected abstract createElement(node: RenderNode, children: TNode[], index: number): TNode; /** * Framework-specific text node creation (must be implemented by each framework) diff --git a/packages/optimizely-cms-sdk/src/components/richText/renderer.ts b/packages/optimizely-cms-sdk/src/components/richText/renderer.ts index 75a6c8f8..e6fd360e 100644 --- a/packages/optimizely-cms-sdk/src/components/richText/renderer.ts +++ b/packages/optimizely-cms-sdk/src/components/richText/renderer.ts @@ -64,12 +64,7 @@ export interface TableCellElement extends BaseElement { * Element node (blocks and inline elements) - Discriminated Union * Based on Slate.js JSON structure with type-specific properties */ -export type Element = - | GenericElement - | LinkElement - | ImageElement - | TableElement - | TableCellElement; +export type Element = GenericElement | LinkElement | ImageElement | TableElement | TableCellElement; /** * Text node with formatting marks @@ -147,10 +142,7 @@ export type BaseLeafMap = { * Generic props for RichText component (framework-agnostic) * Can be specialized for each framework with specific renderer types */ -export interface RichTextPropsBase< - TElementRenderer = unknown, - TLeafRenderer = unknown -> { +export interface RichTextPropsBase { /** * Slate.js compatible JSON content to render */ @@ -184,12 +176,7 @@ export type ElementType = Element['type']; /** * Available text marks in the default implementation */ -export type MarkType = - | 'bold' - | 'italic' - | 'underline' - | 'strikethrough' - | 'code'; +export type MarkType = 'bold' | 'italic' | 'underline' | 'strikethrough' | 'code'; /** * Configuration for creating HTML components @@ -211,13 +198,7 @@ export type RendererConfig = { }; // Reserved props that should not be passed as HTML attributes -export const RESERVED_PROPS = new Set([ - 'url', - 'children', - 'type', - 'internal', - 'base', -]); +export const RESERVED_PROPS = new Set(['url', 'children', 'type', 'internal', 'base']); /** * Maps CMS attributes to standard HTML attributes @@ -226,7 +207,7 @@ export function mapAttributes(node: Element): Record { const nodeProps: Record = {}; // Copy non-reserved props verbatim - Object.keys(node).forEach((k) => { + Object.keys(node).forEach(k => { if (!RESERVED_PROPS.has(k)) { nodeProps[k] = node[k as keyof Element]; } @@ -281,9 +262,7 @@ export function mapAttributes(node: Element): Record { * Gets text marks from a text node */ export function getTextMarks(leaf: Text): string[] { - return Object.keys(leaf).filter( - (k) => k !== 'text' && leaf[k as keyof Text] === true - ); + return Object.keys(leaf).filter(k => k !== 'text' && leaf[k as keyof Text] === true); } /** @@ -292,7 +271,7 @@ export function getTextMarks(leaf: Text): string[] { */ export function extractTextContent(children: Node[]): string { return children - .map((child) => { + .map(child => { if (isText(child)) { return child.text; } else { @@ -307,10 +286,7 @@ export function extractTextContent(children: Node[]): string { * Creates type-safe element data based on element type and attributes * This is a utility function that can be used by framework-specific renderers */ -export function createElementData( - type: string, - attributes: Record = {} -): Element { +export function createElementData(type: string, attributes: Record = {}): Element { const baseProps = { children: [], ...attributes }; switch (type) { @@ -378,10 +354,7 @@ export function decodeHTML(input: string): string { '—': '—', }; - return input.replace( - /(&|<|>|"|'| |—)/g, - (m) => map[m] ?? m - ); + return input.replace(/(&|<|>|"|'| |—)/g, m => map[m] ?? m); } /** @@ -400,22 +373,16 @@ export interface RenderNode { /** * Converts Slate JSON to framework-agnostic render tree */ -export function buildRenderTree( - nodes: Node[], - config: RendererConfig = {} -): RenderNode[] { +export function buildRenderTree(nodes: Node[], config: RendererConfig = {}): RenderNode[] { if (!Array.isArray(nodes)) { return []; } - return nodes.map((node) => buildRenderNode(node, config)); + return nodes.map(node => buildRenderNode(node, config)); } function buildRenderNode(node: Node, config: RendererConfig): RenderNode { if (isText(node)) { - const content = - config.decodeHtmlEntities && typeof node.text === 'string' - ? decodeHTML(node.text) - : node.text; + const content = config.decodeHtmlEntities && typeof node.text === 'string' ? decodeHTML(node.text) : node.text; return { type: 'text', @@ -435,10 +402,7 @@ function buildRenderNode(node: Node, config: RendererConfig): RenderNode { /** * Default element type mapping */ -export const defaultElementTypeMap: Record< - string, - { tag: string; config?: HtmlComponentConfig } -> = { +export const defaultElementTypeMap: Record = { // Blocks paragraph: { tag: 'p' }, div: { tag: 'div' }, @@ -524,10 +488,7 @@ export const defaultElementTypeMap: Record< * Available types for generic elements that don't need special properties * Derived from defaultElementTypeMap, excluding elements with specialized interfaces */ -export type GenericElementType = Exclude< - keyof typeof defaultElementTypeMap, - 'link' | 'image' | 'td' | 'th' ->; +export type GenericElementType = Exclude; /** * Default text mark mapping diff --git a/packages/optimizely-cms-sdk/src/context/__test__/config.test.ts b/packages/optimizely-cms-sdk/src/context/__test__/config.test.ts index 443c7228..c0e071ff 100644 --- a/packages/optimizely-cms-sdk/src/context/__test__/config.test.ts +++ b/packages/optimizely-cms-sdk/src/context/__test__/config.test.ts @@ -1,11 +1,5 @@ import { describe, expect, test, beforeEach, afterEach, vi } from 'vitest'; -import { - configureAdapter, - getAdapter, - getContext, - setContext, - initializeRequestContext, -} from '../config.js'; +import { configureAdapter, getAdapter, getContext, setContext, initializeRequestContext } from '../config.js'; import type { ContextAdapter, ContextData } from '../baseContext.js'; describe('Context Configuration', () => { @@ -78,9 +72,7 @@ describe('Context Configuration', () => { // Reset adapter to simulate unconfigured state configureAdapter(null as unknown as MockAdapter); - expect(() => getAdapter()).toThrow( - 'Context adapter not configured', - ); + expect(() => getAdapter()).toThrow('Context adapter not configured'); }); test('error message should provide helpful guidance', () => { diff --git a/packages/optimizely-cms-sdk/src/context/config.ts b/packages/optimizely-cms-sdk/src/context/config.ts index 84d0e4e2..274a415e 100644 --- a/packages/optimizely-cms-sdk/src/context/config.ts +++ b/packages/optimizely-cms-sdk/src/context/config.ts @@ -98,10 +98,7 @@ export const setContext = (value: Partial): void => { * @param value - The value to set for the specified key * @internal */ -export const setContextData = ( - key: K, - value: ContextData[K], -): void => { +export const setContextData = (key: K, value: ContextData[K]): void => { return getAdapter().set(key, value); }; @@ -112,8 +109,6 @@ export const setContextData = ( * @returns The value for the specified key, or undefined if not found * @internal */ -export const getContextData = ( - key: K, -): ContextData[K] | undefined => { +export const getContextData = (key: K): ContextData[K] | undefined => { return getAdapter().get(key); }; diff --git a/packages/optimizely-cms-sdk/src/context/reactContextAdapter.ts b/packages/optimizely-cms-sdk/src/context/reactContextAdapter.ts index b8d6909a..486c5044 100644 --- a/packages/optimizely-cms-sdk/src/context/reactContextAdapter.ts +++ b/packages/optimizely-cms-sdk/src/context/reactContextAdapter.ts @@ -18,7 +18,7 @@ export class ReactContextAdapter implements ContextAdapter { */ initializeContext() { const data = getContextData(); - Object.keys(data).forEach((key) => delete data[key as keyof ContextData]); + Object.keys(data).forEach(key => delete data[key as keyof ContextData]); } /** @@ -54,7 +54,7 @@ export class ReactContextAdapter implements ContextAdapter { */ clear(): void { const data = getContextData(); - Object.keys(data).forEach((key) => delete data[key as keyof ContextData]); + Object.keys(data).forEach(key => delete data[key as keyof ContextData]); } } diff --git a/packages/optimizely-cms-sdk/src/graph/__test__/context.test.ts b/packages/optimizely-cms-sdk/src/graph/__test__/context.test.ts index ee2ac661..7e798c0d 100644 --- a/packages/optimizely-cms-sdk/src/graph/__test__/context.test.ts +++ b/packages/optimizely-cms-sdk/src/graph/__test__/context.test.ts @@ -1,10 +1,6 @@ import { describe, expect, test, beforeEach, vi, afterEach } from 'vitest'; import { removeTypePrefix, GraphClient } from '../index.js'; -import { - configureAdapter, - getContext, - initializeRequestContext, -} from '../../context/config.js'; +import { configureAdapter, getContext, initializeRequestContext } from '../../context/config.js'; import type { ContextAdapter, ContextData } from '../../context/baseContext.js'; import { contentType, initContentTypeRegistry } from '../../index.js'; @@ -266,9 +262,7 @@ describe('GraphClient - Context Integration', () => { }; // Should throw when trying to populate context with broken adapter - await expect(testClient.getPreviewContent(previewParams)).rejects.toThrow( - 'Adapter error', - ); + await expect(testClient.getPreviewContent(previewParams)).rejects.toThrow('Adapter error'); }); }); }); diff --git a/packages/optimizely-cms-sdk/src/graph/__test__/convertProperty.test.ts b/packages/optimizely-cms-sdk/src/graph/__test__/convertProperty.test.ts index 4f5ded4b..3cdfaf82 100644 --- a/packages/optimizely-cms-sdk/src/graph/__test__/convertProperty.test.ts +++ b/packages/optimizely-cms-sdk/src/graph/__test__/convertProperty.test.ts @@ -1,13 +1,4 @@ -import { - describe, - it, - expect, - beforeAll, - beforeEach, - afterEach, - vi, - afterAll, -} from 'vitest'; +import { describe, it, expect, beforeAll, beforeEach, afterEach, vi, afterAll } from 'vitest'; import { contentType, initContentTypeRegistry } from '../../model/index.js'; import { createFragment } from '../createQuery.js'; @@ -26,7 +17,7 @@ describe('createFragment > Fragment threshold warning', () => { type: 'string', }, }, - }) + }), ); // Root content type that includes all child types in its content area @@ -67,11 +58,9 @@ describe('createFragment > Fragment threshold warning', () => { const result = createFragment('ExplodingType'); expect(result).toBeInstanceOf(Array); expect(warnSpy).toHaveBeenCalledOnce(); + expect(warnSpy.mock.calls[0][0]).toMatch(String.raw`generated 107 inner fragments`); expect(warnSpy.mock.calls[0][0]).toMatch( - String.raw`generated 107 inner fragments` - ); - expect(warnSpy.mock.calls[0][0]).toMatch( - /Excessive fragment depth may breach GraphQL limits or degrade performance./ + /Excessive fragment depth may breach GraphQL limits or degrade performance./, ); }); diff --git a/packages/optimizely-cms-sdk/src/graph/__test__/createQueryDAM.test.ts b/packages/optimizely-cms-sdk/src/graph/__test__/createQueryDAM.test.ts index 5fb9a27c..56539412 100644 --- a/packages/optimizely-cms-sdk/src/graph/__test__/createQueryDAM.test.ts +++ b/packages/optimizely-cms-sdk/src/graph/__test__/createQueryDAM.test.ts @@ -1,9 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { - createFragment, - createSingleContentQuery, - createMultipleContentQuery, -} from '../createQuery.js'; +import { createFragment, createSingleContentQuery, createMultipleContentQuery } from '../createQuery.js'; import { contentType, initContentTypeRegistry } from '../../model/index.js'; describe('createFragment() with damEnabled for contentReference properties', () => { @@ -25,18 +21,10 @@ describe('createFragment() with damEnabled for contentReference properties', () }); // Should not include ContentReferenceItem fragments - expect(result.some((line) => line.includes('PublicImageAsset'))).toBe( - false, - ); - expect(result.some((line) => line.includes('PublicVideoAsset'))).toBe( - false, - ); - expect(result.some((line) => line.includes('PublicRawFileAsset'))).toBe( - false, - ); - expect(result.some((line) => line.includes('ContentReferenceItem'))).toBe( - false, - ); + expect(result.some(line => line.includes('PublicImageAsset'))).toBe(false); + expect(result.some(line => line.includes('PublicVideoAsset'))).toBe(false); + expect(result.some(line => line.includes('PublicRawFileAsset'))).toBe(false); + expect(result.some(line => line.includes('ContentReferenceItem'))).toBe(false); // Should only include key and url (no ...ContentReferenceItem) expect(result).toMatchInlineSnapshot(` @@ -70,14 +58,10 @@ describe('createFragment() with damEnabled for contentReference properties', () }); // Should include all ContentReferenceItem fragments - expect(result.some((line) => line.includes('PublicImageAsset'))).toBe(true); - expect(result.some((line) => line.includes('PublicVideoAsset'))).toBe(true); - expect(result.some((line) => line.includes('PublicRawFileAsset'))).toBe( - true, - ); - expect(result.some((line) => line.includes('ContentReferenceItem'))).toBe( - true, - ); + expect(result.some(line => line.includes('PublicImageAsset'))).toBe(true); + expect(result.some(line => line.includes('PublicVideoAsset'))).toBe(true); + expect(result.some(line => line.includes('PublicRawFileAsset'))).toBe(true); + expect(result.some(line => line.includes('ContentReferenceItem'))).toBe(true); expect(result).toMatchInlineSnapshot(` [ @@ -113,9 +97,7 @@ describe('createFragment() with damEnabled for contentReference properties', () includeBaseFragments: true, }); - expect(result.some((line) => line.includes('ContentReferenceItem'))).toBe( - false, - ); + expect(result.some(line => line.includes('ContentReferenceItem'))).toBe(false); expect(result).toMatchInlineSnapshot(` [ "fragment MediaMetadata on MediaMetadata { mimeType thumbnail content }", @@ -145,9 +127,7 @@ describe('createFragment() with damEnabled for contentReference properties', () includeBaseFragments: true, }); - expect(result.some((line) => line.includes('ContentReferenceItem'))).toBe( - true, - ); + expect(result.some(line => line.includes('ContentReferenceItem'))).toBe(true); expect(result).toMatchInlineSnapshot(` [ "fragment PublicImageAsset on cmp_PublicImageAsset { Url Title AltText Description MimeType Height Width Renditions { Id Name Url Width Height } FocalPoint { X Y } Tags { Guid Name } }", @@ -189,18 +169,14 @@ describe('createFragment() with damEnabled for contentReference properties', () damEnabled: false, includeBaseFragments: true, }); - expect( - resultDisabled.some((line) => line.includes('ContentReferenceItem')), - ).toBe(false); + expect(resultDisabled.some(line => line.includes('ContentReferenceItem'))).toBe(false); // Test with damEnabled = true const resultEnabled = await createFragment('ct1', new Set(), '', { damEnabled: true, includeBaseFragments: true, }); - expect( - resultEnabled.some((line) => line.includes('ContentReferenceItem')), - ).toBe(true); + expect(resultEnabled.some(line => line.includes('ContentReferenceItem'))).toBe(true); expect(resultEnabled).toMatchInlineSnapshot(` [ "fragment MediaMetadata on MediaMetadata { mimeType thumbnail content }", @@ -243,9 +219,7 @@ describe('createFragment() with damEnabled for contentReference properties', () damEnabled: true, includeBaseFragments: true, }); - expect(result.some((line) => line.includes('ContentReferenceItem'))).toBe( - true, - ); + expect(result.some(line => line.includes('ContentReferenceItem'))).toBe(true); expect(result).toMatchInlineSnapshot(` [ "fragment MediaMetadata on MediaMetadata { mimeType thumbnail content }", @@ -284,18 +258,10 @@ describe('createFragment() with damEnabled for contentReference properties', () }); // Should NOT include DAM fragments - expect(result.some((line) => line.includes('PublicImageAsset'))).toBe( - false, - ); - expect(result.some((line) => line.includes('PublicVideoAsset'))).toBe( - false, - ); - expect(result.some((line) => line.includes('PublicRawFileAsset'))).toBe( - false, - ); - expect(result.some((line) => line.includes('ContentReferenceItem'))).toBe( - false, - ); + expect(result.some(line => line.includes('PublicImageAsset'))).toBe(false); + expect(result.some(line => line.includes('PublicVideoAsset'))).toBe(false); + expect(result.some(line => line.includes('PublicRawFileAsset'))).toBe(false); + expect(result.some(line => line.includes('ContentReferenceItem'))).toBe(false); expect(result).toMatchInlineSnapshot(` [ @@ -335,12 +301,8 @@ describe('createFragment() with damEnabled for contentReference properties', () }); // Should NOT include DAM fragments since no contentReference anywhere - expect(result.some((line) => line.includes('ContentReferenceItem'))).toBe( - false, - ); - expect(result.some((line) => line.includes('PublicImageAsset'))).toBe( - false, - ); + expect(result.some(line => line.includes('ContentReferenceItem'))).toBe(false); + expect(result.some(line => line.includes('PublicImageAsset'))).toBe(false); }); }); @@ -380,9 +342,7 @@ describe('createSingleContentQuery() with damEnabled', () => { expect(query.includes('PublicVideoAsset')).toBe(true); expect(query.includes('PublicRawFileAsset')).toBe(true); expect(query.includes('ContentReferenceItem')).toBe(true); - expect(query).toContain( - 'image { key url { ...ContentUrl } ...ContentReferenceItem }', - ); + expect(query).toContain('image { key url { ...ContentUrl } ...ContentReferenceItem }'); }); }); diff --git a/packages/optimizely-cms-sdk/src/graph/__test__/createQueryExperiences.fixtures.ts b/packages/optimizely-cms-sdk/src/graph/__test__/createQueryExperiences.fixtures.ts index 7621fdd0..bcc3b8e2 100644 --- a/packages/optimizely-cms-sdk/src/graph/__test__/createQueryExperiences.fixtures.ts +++ b/packages/optimizely-cms-sdk/src/graph/__test__/createQueryExperiences.fixtures.ts @@ -37,9 +37,4 @@ const ExpSection = contentType({ }, }); -export const allContentTypes = [ - MyExperience, - CallToAction, - CallToAction2, - ExpSection, -]; +export const allContentTypes = [MyExperience, CallToAction, CallToAction2, ExpSection]; diff --git a/packages/optimizely-cms-sdk/src/graph/__test__/createQueryExperiences.test.ts b/packages/optimizely-cms-sdk/src/graph/__test__/createQueryExperiences.test.ts index d3ebec46..b7a71e53 100644 --- a/packages/optimizely-cms-sdk/src/graph/__test__/createQueryExperiences.test.ts +++ b/packages/optimizely-cms-sdk/src/graph/__test__/createQueryExperiences.test.ts @@ -1,8 +1,5 @@ import { beforeAll, describe, expect, test } from 'vitest'; -import { - allContentTypes, - MyExperience, -} from './createQueryExperiences.fixtures.js'; +import { allContentTypes, MyExperience } from './createQueryExperiences.fixtures.js'; import { initContentTypeRegistry } from '../../model/index.js'; import { createFragment } from '../createQuery.js'; diff --git a/packages/optimizely-cms-sdk/src/graph/__test__/getClient.test.ts b/packages/optimizely-cms-sdk/src/graph/__test__/getClient.test.ts index f75e93b7..43482497 100644 --- a/packages/optimizely-cms-sdk/src/graph/__test__/getClient.test.ts +++ b/packages/optimizely-cms-sdk/src/graph/__test__/getClient.test.ts @@ -40,9 +40,7 @@ describe('getClient - Critical Edge Cases', () => { expect(() => { freshGetClient(); - }).toThrow( - 'Graph configuration is not set. Call config() in your root layout first.', - ); + }).toThrow('Graph configuration is not set. Call config() in your root layout first.'); }); }); @@ -73,7 +71,6 @@ describe('getClient - Critical Edge Cases', () => { }).toThrow('Invalid Optimizely Graph API key'); }); - test('should throw error with helpful message mentioning environment variables', () => { expect(() => { // @ts-expect-error - Testing runtime behavior diff --git a/packages/optimizely-cms-sdk/src/graph/__test__/graphReference.test.ts b/packages/optimizely-cms-sdk/src/graph/__test__/graphReference.test.ts index 32e2b91b..7d3901aa 100644 --- a/packages/optimizely-cms-sdk/src/graph/__test__/graphReference.test.ts +++ b/packages/optimizely-cms-sdk/src/graph/__test__/graphReference.test.ts @@ -89,9 +89,7 @@ describe('GraphClient.parseGraphReference()', () => { }); test('parses source/type/key format', () => { - const result = (client as any).parseGraphReference( - 'graph://cms/Page/abc123', - ); + const result = (client as any).parseGraphReference('graph://cms/Page/abc123'); expect(result).toEqual({ source: 'cms', type: 'Page', @@ -100,9 +98,7 @@ describe('GraphClient.parseGraphReference()', () => { }); test('parses with locale query parameter', () => { - const result = (client as any).parseGraphReference( - 'graph://abc123?loc=en', - ); + const result = (client as any).parseGraphReference('graph://abc123?loc=en'); expect(result).toEqual({ key: 'abc123', locale: 'en', @@ -110,9 +106,7 @@ describe('GraphClient.parseGraphReference()', () => { }); test('parses with version query parameter', () => { - const result = (client as any).parseGraphReference( - 'graph://abc123?ver=1.0', - ); + const result = (client as any).parseGraphReference('graph://abc123?ver=1.0'); expect(result).toEqual({ key: 'abc123', version: '1.0', @@ -120,9 +114,7 @@ describe('GraphClient.parseGraphReference()', () => { }); test('parses with both locale and version', () => { - const result = (client as any).parseGraphReference( - 'graph://abc123?loc=en&ver=1.0', - ); + const result = (client as any).parseGraphReference('graph://abc123?loc=en&ver=1.0'); expect(result).toEqual({ key: 'abc123', locale: 'en', @@ -131,9 +123,7 @@ describe('GraphClient.parseGraphReference()', () => { }); test('parses full format with all parameters', () => { - const result = (client as any).parseGraphReference( - 'graph://cms/Page/abc123?loc=en&ver=1.0', - ); + const result = (client as any).parseGraphReference('graph://cms/Page/abc123?loc=en&ver=1.0'); expect(result).toEqual({ source: 'cms', type: 'Page', @@ -156,9 +146,7 @@ describe('GraphClient.parseGraphReference()', () => { }); test('handles trailing slashes', () => { - const result = (client as any).parseGraphReference( - 'graph://cms/Page/abc123/', - ); + const result = (client as any).parseGraphReference('graph://cms/Page/abc123/'); expect(result).toEqual({ source: 'cms', type: 'Page', @@ -696,10 +684,13 @@ describe('GraphClient.getContent() with GraphReference', () => { }, }); - await customClient.getContent({ key: 'abc123' }, { - cache: false, - slot: 'New', - }); + await customClient.getContent( + { key: 'abc123' }, + { + cache: false, + slot: 'New', + }, + ); expect(customMockRequest).toHaveBeenNthCalledWith( 2, @@ -863,14 +854,20 @@ describe('GraphClient.getPath() with GraphReference', () => { await client.getPath({ key: 'abc123' }, { locales: ['en', 'sv'] }); - expect(mockRequest).toHaveBeenCalledWith(expect.any(String), { - where: { - _metadata: { - key: { eq: 'abc123' }, + expect(mockRequest).toHaveBeenCalledWith( + expect.any(String), + { + where: { + _metadata: { + key: { eq: 'abc123' }, + }, }, + locale: ['en', 'sv'], }, - locale: ['en', 'sv'], - }, undefined, true, undefined); + undefined, + true, + undefined, + ); }); }); @@ -1012,14 +1009,20 @@ describe('GraphClient.getItems() with GraphReference', () => { await client.getItems({ key: 'abc123' }, { locales: ['en', 'sv'] }); - expect(mockRequest).toHaveBeenCalledWith(expect.any(String), { - where: { - _metadata: { - key: { eq: 'abc123' }, + expect(mockRequest).toHaveBeenCalledWith( + expect.any(String), + { + where: { + _metadata: { + key: { eq: 'abc123' }, + }, }, + locale: ['en', 'sv'], }, - locale: ['en', 'sv'], - }, undefined, true, undefined); + undefined, + true, + undefined, + ); }); test('returns items with metadata', async () => { diff --git a/packages/optimizely-cms-sdk/src/graph/createQuery.ts b/packages/optimizely-cms-sdk/src/graph/createQuery.ts index 1a03ea4c..77f0e215 100644 --- a/packages/optimizely-cms-sdk/src/graph/createQuery.ts +++ b/packages/optimizely-cms-sdk/src/graph/createQuery.ts @@ -1,14 +1,6 @@ import { AnyProperty } from '../model/properties.js'; -import { - AnyContentType, - MAIN_BASE_TYPES, - PermittedTypes, -} from '../model/contentTypes.js'; -import { - getContentType, - getAllContentTypes, - getContentTypeByBaseType, -} from '../model/contentTypeRegistry.js'; +import { AnyContentType, MAIN_BASE_TYPES, PermittedTypes } from '../model/contentTypes.js'; +import { getContentType, getAllContentTypes, getContentTypeByBaseType } from '../model/contentTypeRegistry.js'; import { getKeyName, buildBaseTypeFragments, @@ -104,22 +96,10 @@ function convertProperty( } { const { maxFragmentThreshold = 100 } = options; - const result = convertPropertyField( - name, - property, - rootName, - suffix, - visited, - options, - ); + const result = convertPropertyField(name, property, rootName, suffix, visited, options); // logs warnings if the fragment generation causes potential issues - const warningMessage = checkTypeConstraintIssues( - rootName, - property, - result, - maxFragmentThreshold, - ); + const warningMessage = checkTypeConstraintIssues(rootName, property, result, maxFragmentThreshold); if (warningMessage) { console.warn(warningMessage); @@ -169,10 +149,7 @@ function convertPropertyField( ); fields.push(`${nameInFragment} { ...${fragmentName} }`); } else if (property.type === 'content') { - const allowed = resolveAllowedTypes( - property.allowedTypes, - property.restrictedTypes, - ); + const allowed = resolveAllowedTypes(property.allowedTypes, property.restrictedTypes); for (const t of allowed) { let key = getKeyName(t); @@ -231,10 +208,7 @@ function convertPropertyField( * @param options - Fragment generation options. * @returns A list of GraphQL fragment strings. */ -function createExperienceFragments( - visited: Set, - options: FragmentOptions = {}, -): string[] { +function createExperienceFragments(visited: Set, options: FragmentOptions = {}): string[] { // Fixed fragments for all experiences const fixedFragments = [ 'fragment _IExperience on _IExperience { composition {...ICompositionNode }}', @@ -242,23 +216,20 @@ function createExperienceFragments( ]; const experienceNodes = getCachedContentTypes() - .filter((c) => { + .filter(c => { if (c.baseType === '_component') { - return ( - 'compositionBehaviors' in c && - (c.compositionBehaviors?.length ?? 0) > 0 - ); + return 'compositionBehaviors' in c && (c.compositionBehaviors?.length ?? 0) > 0; } return false; }) - .map((c) => c.key); + .map(c => c.key); // Get the required fragments const extraFragments = experienceNodes - .filter((n) => !visited.has(n)) - .flatMap((n) => createFragment(n, visited, '', { ...options, includeBaseFragments: true })); + .filter(n => !visited.has(n)) + .flatMap(n => createFragment(n, visited, '', { ...options, includeBaseFragments: true })); - const nodeNames = experienceNodes.map((n) => `...${n}`).join(' '); + const nodeNames = experienceNodes.map(n => `...${n}`).join(' '); const componentFragment = `fragment _IComponent on _IComponent { __typename ${nodeNames} }`; return [...fixedFragments, ...extraFragments, componentFragment]; @@ -278,11 +249,7 @@ export function createFragment( suffix: string = '', options: FragmentOptions = {}, ): string[] { - const { - damEnabled = false, - maxFragmentThreshold = 100, - includeBaseFragments = true, - } = options; + const { damEnabled = false, maxFragmentThreshold = 100, includeBaseFragments = true } = options; const fragmentName = `${contentTypeName}${suffix}`; if (visited.has(fragmentName)) return []; // cyclic ref guard // Refresh registry cache only on the *root* call (avoids redundant reads) @@ -458,23 +425,21 @@ function resolveAllowedTypes( // If a CMS base media type ("_image", "_media" …) is restricted, // we must also ban every user defined media type that shares the same media type - restricted?.forEach((r) => { + restricted?.forEach(r => { const key = getKeyName(r); skip.add(key); if (isBaseType(key)) { - getContentTypeByBaseType(key).forEach((ct) => skip.add(ct.key)); + getContentTypeByBaseType(key).forEach(ct => skip.add(ct.key)); } }); const add = (ct: PermittedTypes | AnyContentType) => { const key = getKeyName(ct); // Skip content types where all properties are disabled - const ctObj = - typeof ct === 'object' && 'key' in ct ? ct : getContentType(key); + const ctObj = typeof ct === 'object' && 'key' in ct ? ct : getContentType(key); if (ctObj && allPropertiesAreDisabled(ctObj)) return; // Skip if in skip list, already seen, or is a main base type - if (skip.has(key) || seen.has(key) || MAIN_BASE_TYPES.includes(key as any)) - return; + if (skip.has(key) || seen.has(key) || MAIN_BASE_TYPES.includes(key as any)) return; seen.add(key); result.push(ct); }; diff --git a/packages/optimizely-cms-sdk/src/graph/error.ts b/packages/optimizely-cms-sdk/src/graph/error.ts index ded50ed6..ccf01f73 100644 --- a/packages/optimizely-cms-sdk/src/graph/error.ts +++ b/packages/optimizely-cms-sdk/src/graph/error.ts @@ -28,7 +28,7 @@ export class GraphMissingContentTypeError extends OptimizelyGraphError { constructor(contentType: string) { super( - `Content type "${contentType}" not included in the registry. Ensure that you called "initContentTypeRegistry()" with it before fetching content.` + `Content type "${contentType}" not included in the registry. Ensure that you called "initContentTypeRegistry()" with it before fetching content.`, ); this.name = 'GraphMissingContentTypeError'; this.contentType = contentType; @@ -49,10 +49,7 @@ export class GraphResponseError extends OptimizelyGraphError { export class GraphHttpResponseError extends GraphResponseError { status: number; - constructor( - message: string, - options: { status: number; request: GraphRequest } - ) { + constructor(message: string, options: { status: number; request: GraphRequest }) { const msg = `HTTP ${options.status}: ${message}`; super(msg, options); this.status = options.status; @@ -64,23 +61,14 @@ export class GraphHttpResponseError extends GraphResponseError { export class GraphContentResponseError extends GraphHttpResponseError { errors: { message: string }[]; - constructor( - errors: { message: string }[], - options: { status: number; request: GraphRequest } - ) { + constructor(errors: { message: string }[], options: { status: number; request: GraphRequest }) { let message = - errors.length === 1 - ? errors[0].message - : `${errors.length} errors in the GraphQL query. Check "errors" object`; + errors.length === 1 ? errors[0].message : `${errors.length} errors in the GraphQL query. Check "errors" object`; - if ( - message.startsWith('Unknown type') || - message.startsWith('Cannot query field') - ) { + if (message.startsWith('Unknown type') || message.startsWith('Cannot query field')) { message += ` Ensure that the content types in the CMS are synced with the definitions in your app. You can use the "@optimizely/cms-cli" CLI app to sync them`; } else if (message.startsWith('Syntax Error')) { - message += - ' Try again later. If the error persists, contact Optimizely support'; + message += ' Try again later. If the error persists, contact Optimizely support'; } else { } diff --git a/packages/optimizely-cms-sdk/src/graph/filters.ts b/packages/optimizely-cms-sdk/src/graph/filters.ts index df25aa60..7ac560da 100644 --- a/packages/optimizely-cms-sdk/src/graph/filters.ts +++ b/packages/optimizely-cms-sdk/src/graph/filters.ts @@ -30,8 +30,7 @@ function normalizePath(path: string) { * @returns A `GraphQueryArguments` object with a `where` clause that matches the given path. */ export function pathFilter(path: string, host?: string): ContentInput { - const { pathWithTrailingSlash, pathWithoutTrailingSlash } = - normalizePath(path); + const { pathWithTrailingSlash, pathWithoutTrailingSlash } = normalizePath(path); return { where: { @@ -67,11 +66,7 @@ export function pathFilter(path: string, host?: string): ContentInput { * * @returns A `GraphQueryArguments` object with a `where` clause filtering by key, version, and locale. */ -export function previewFilter(params: { - key: string; - ver: string; - loc: string; -}): ContentInput { +export function previewFilter(params: { key: string; ver: string; loc: string }): ContentInput { return { where: { _metadata: { @@ -107,20 +102,14 @@ export function localeFilter(locale?: string[]): ContentInput { * @param reference - GraphReference object containing key and optional parameters * @returns A `ContentInput` object with a `where` clause filtering by the reference */ -export function referenceFilter(reference: { - key: string; - locale?: string; - version?: string; -}): ContentInput { +export function referenceFilter(reference: { key: string; locale?: string; version?: string }): ContentInput { return { where: { _metadata: { key: { eq: reference.key }, - ...(reference.version - ? { version: { eq: reference.version } } - : reference.locale - ? { locale: { eq: reference.locale } } - : {}), + ...(reference.version ? { version: { eq: reference.version } } + : reference.locale ? { locale: { eq: reference.locale } } + : {}), }, }, }; diff --git a/packages/optimizely-cms-sdk/src/graph/index.ts b/packages/optimizely-cms-sdk/src/graph/index.ts index f0dc0f1d..e83833c6 100644 --- a/packages/optimizely-cms-sdk/src/graph/index.ts +++ b/packages/optimizely-cms-sdk/src/graph/index.ts @@ -1,8 +1,4 @@ -import { - createSingleContentQuery, - ItemsResponse, - createMultipleContentQuery, -} from './createQuery.js'; +import { createSingleContentQuery, ItemsResponse, createMultipleContentQuery } from './createQuery.js'; import { GraphContentResponseError, GraphHttpResponseError, @@ -46,7 +42,6 @@ export type GraphOptions = { slot?: GraphSlot; }; - // Global configuration for client factory let globalGraphConfig: GraphOptions | null = null; @@ -235,7 +230,7 @@ type GetLinksResponse = { */ export function removeTypePrefix(obj: any): any { if (Array.isArray(obj)) { - return obj.map((e) => removeTypePrefix(e)); + return obj.map(e => removeTypePrefix(e)); } if (typeof obj === 'object' && obj !== null) { @@ -268,7 +263,7 @@ export function removeTypePrefix(obj: any): any { /** Adds an extra `__context` property next to each `__typename` property */ function decorateWithContext(obj: any, params: PreviewParams): any { if (Array.isArray(obj)) { - return obj.map((e) => decorateWithContext(e, params)); + return obj.map(e => decorateWithContext(e, params)); } if (typeof obj === 'object' && obj !== null) { for (const k in obj) { @@ -317,9 +312,7 @@ export class GraphClient { const headers: Record = { 'Content-Type': 'application/json', - Authorization: previewToken - ? `Bearer ${previewToken}` - : `epi-single ${this.apiKey}`, + Authorization: previewToken ? `Bearer ${previewToken}` : `epi-single ${this.apiKey}`, }; if (slot === 'New') { @@ -333,7 +326,7 @@ export class GraphClient { query, variables, }), - }).catch((err) => { + }).catch(err => { if (err instanceof TypeError) { const optiErr = new OptimizelyGraphError( 'Error when calling `fetch`. Ensure the Graph URL is correct or try again later.', @@ -345,7 +338,7 @@ export class GraphClient { }); if (!response.ok) { - const text = await response.text().catch((err) => { + const text = await response.text().catch(err => { console.error('Error reading response text:', err); return response.statusText; }); @@ -385,12 +378,7 @@ export class GraphClient { * @param previewToken - Optional preview token for fetching preview content. * @returns A promise that resolves to the first content type metadata object */ - private async getContentMetaData( - input: GraphVariables, - previewToken?: string, - cache?: boolean, - slot?: GraphSlot, - ) { + private async getContentMetaData(input: GraphVariables, previewToken?: string, cache?: boolean, slot?: GraphSlot) { const data = await this.request( GET_CONTENT_METADATA_QUERY, input, @@ -436,10 +424,7 @@ export class GraphClient { * * @returns An array of all items matching the path and options. Returns an empty array if no content is found. */ - async getContentByPath( - path: string, - options?: GraphGetContentOptions, - ) { + async getContentByPath(path: string, options?: GraphGetContentOptions) { const input: GraphVariables = { ...pathFilter(path, options?.host ?? this.host), // Backwards compatibility: if host is not provided in options, use the client's default host variation: options?.variation, @@ -448,30 +433,15 @@ export class GraphClient { const cacheEnabled = options?.cache ?? this.cache; const activeSlot = options?.slot ?? this.slot; - const { contentTypeName, damEnabled } = await this.getContentMetaData( - input, - undefined, - cacheEnabled, - activeSlot, - ); + const { contentTypeName, damEnabled } = await this.getContentMetaData(input, undefined, cacheEnabled, activeSlot); if (!contentTypeName) { return []; } try { - const query = createMultipleContentQuery( - contentTypeName, - damEnabled, - this.maxFragmentThreshold, - ); - const response = (await this.request( - query, - input, - undefined, - cacheEnabled, - activeSlot, - )) as ItemsResponse; + const query = createMultipleContentQuery(contentTypeName, damEnabled, this.maxFragmentThreshold); + const response = (await this.request(query, input, undefined, cacheEnabled, activeSlot)) as ItemsResponse; return response?._Content?.items.map(removeTypePrefix); } catch (error) { @@ -507,18 +477,13 @@ export class GraphClient { * const path = await client.getPath('graph://Page/abc123?loc=en'); * ``` */ - async getPath( - reference: string | GraphReference, - options?: GraphGetLinksOptions, - ) { + async getPath(reference: string | GraphReference, options?: GraphGetLinksOptions) { let filter: GraphVariables; if (typeof reference === 'string' && reference.startsWith('graph://')) { const ref = this.parseGraphReference(reference); filter = { ...referenceFilter(ref), - ...localeFilter( - options?.locales ?? (ref.locale ? [ref.locale] : undefined), - ), + ...localeFilter(options?.locales ?? (ref.locale ? [ref.locale] : undefined)), }; } else if (typeof reference === 'string') { filter = { @@ -528,23 +493,14 @@ export class GraphClient { } else { filter = { ...referenceFilter(reference), - ...localeFilter( - options?.locales ?? - (reference.locale ? [reference.locale] : undefined), - ), + ...localeFilter(options?.locales ?? (reference.locale ? [reference.locale] : undefined)), }; } const cacheEnabled = options?.cache ?? this.cache; const activeSlot = options?.slot ?? this.slot; - const data = (await this.request( - GET_PATH_QUERY, - filter, - undefined, - cacheEnabled, - activeSlot, - )) as GetLinksResponse; + const data = (await this.request(GET_PATH_QUERY, filter, undefined, cacheEnabled, activeSlot)) as GetLinksResponse; // Check if the page itself exist. if (!data._Content.item._id) { @@ -568,10 +524,8 @@ export class GraphClient { } // Return sorted by the "sortedKeys" - const linkMap = new Map(links.map((link) => [link._metadata?.key, link])); - return sortedKeys - .map((key) => linkMap.get(key)) - .filter((item) => item !== undefined); + const linkMap = new Map(links.map(link => [link._metadata?.key, link])); + return sortedKeys.map(key => linkMap.get(key)).filter(item => item !== undefined); } /** @@ -598,18 +552,13 @@ export class GraphClient { * const items = await client.getItems('graph://Page/abc123?loc=en'); * ``` */ - async getItems( - reference: string | GraphReference, - options?: GraphGetLinksOptions, - ) { + async getItems(reference: string | GraphReference, options?: GraphGetLinksOptions) { let filter: GraphVariables; if (typeof reference === 'string' && reference.startsWith('graph://')) { const ref = this.parseGraphReference(reference); filter = { ...referenceFilter(ref), - ...localeFilter( - options?.locales ?? (ref.locale ? [ref.locale] : undefined), - ), + ...localeFilter(options?.locales ?? (ref.locale ? [ref.locale] : undefined)), }; } else if (typeof reference === 'string') { filter = { @@ -619,23 +568,14 @@ export class GraphClient { } else { filter = { ...referenceFilter(reference), - ...localeFilter( - options?.locales ?? - (reference.locale ? [reference.locale] : undefined), - ), + ...localeFilter(options?.locales ?? (reference.locale ? [reference.locale] : undefined)), }; } const cacheEnabled = options?.cache ?? this.cache; const activeSlot = options?.slot ?? this.slot; - const data = (await this.request( - GET_ITEMS_QUERY, - filter, - undefined, - cacheEnabled, - activeSlot, - )) as GetLinksResponse; + const data = (await this.request(GET_ITEMS_QUERY, filter, undefined, cacheEnabled, activeSlot)) as GetLinksResponse; // Check if the page itself exist. if (!data._Content.item._id) { @@ -676,24 +616,11 @@ export class GraphClient { mode: params.ctx, }); - const query = createSingleContentQuery( - contentTypeName, - damEnabled, - this.maxFragmentThreshold, - ); + const query = createSingleContentQuery(contentTypeName, damEnabled, this.maxFragmentThreshold); - const response = await this.request( - query, - input, - params.preview_token, - false, - activeSlot, - ); + const response = await this.request(query, input, params.preview_token, false, activeSlot); - return decorateWithContext( - removeTypePrefix(response?._Content?.item), - params, - ); + return decorateWithContext(removeTypePrefix(response?._Content?.item), params); } /** @@ -720,12 +647,10 @@ export class GraphClient { const withoutProtocol = referenceString.slice(graphProtocol.length); const [pathPart, queryPart] = withoutProtocol.split('?'); - const pathSegments = pathPart.split('/').filter((s) => s.length > 0); + const pathSegments = pathPart.split('/').filter(s => s.length > 0); if (pathSegments.length < 1) { - throw new Error( - `Invalid graph reference format. Expected at least key to be present, got: "${referenceString}"`, - ); + throw new Error(`Invalid graph reference format. Expected at least key to be present, got: "${referenceString}"`); } let source: string | undefined; @@ -797,14 +722,8 @@ export class GraphClient { * const content = await client.getContent({ key: 'abc123', version: '1.0' }, { previewToken: 'token' }); * ``` */ - async getContent( - reference: string | GraphReference, - options?: GraphGetItemOptions, - ) { - const ref = - typeof reference === 'string' - ? this.parseGraphReference(reference) - : reference; + async getContent(reference: string | GraphReference, options?: GraphGetItemOptions) { + const ref = typeof reference === 'string' ? this.parseGraphReference(reference) : reference; const previewToken = options?.previewToken; @@ -815,11 +734,9 @@ export class GraphClient { where: { _metadata: { key: { eq: ref.key }, - ...(ref.version - ? { version: { eq: ref.version } } - : ref.locale - ? { locale: { eq: ref.locale } } - : {}), + ...(ref.version ? { version: { eq: ref.version } } + : ref.locale ? { locale: { eq: ref.locale } } + : {}), }, }, }; @@ -836,19 +753,9 @@ export class GraphClient { } try { - const query = createSingleContentQuery( - contentTypeName, - damEnabled, - this.maxFragmentThreshold, - ); + const query = createSingleContentQuery(contentTypeName, damEnabled, this.maxFragmentThreshold); - const response = await this.request( - query, - input, - previewToken, - cacheEnabled, - activeSlot, - ); + const response = await this.request(query, input, previewToken, cacheEnabled, activeSlot); return removeTypePrefix(response?._Content?.item); } catch (error) { @@ -903,11 +810,7 @@ export function getGraphConfig(): GraphOptions | null { * ``` */ export function config(options: GraphOptions) { - if ( - !options.apiKey || - typeof options.apiKey !== 'string' || - options.apiKey.trim().length === 0 - ) { + if (!options.apiKey || typeof options.apiKey !== 'string' || options.apiKey.trim().length === 0) { throw new OptimizelyGraphError( 'Invalid Optimizely Graph API key: key must be a non-empty string. ' + 'Check that your environment variable is set correctly (e.g., process.env.OPTIMIZELY_GRAPH_SINGLE_KEY).', @@ -948,9 +851,7 @@ export function config(options: GraphOptions) { */ export function getClient(overrideOptions?: Partial): GraphClient { if (!globalGraphConfig) { - throw new OptimizelyGraphError( - 'Graph configuration is not set. Call config() in your root layout first.', - ); + throw new OptimizelyGraphError('Graph configuration is not set. Call config() in your root layout first.'); } const options: GraphOptions = { @@ -960,3 +861,4 @@ export function getClient(overrideOptions?: Partial): GraphClient return new GraphClient(options.apiKey, options); } + diff --git a/packages/optimizely-cms-sdk/src/index.ts b/packages/optimizely-cms-sdk/src/index.ts index fd4fffdf..8bc3dc4c 100644 --- a/packages/optimizely-cms-sdk/src/index.ts +++ b/packages/optimizely-cms-sdk/src/index.ts @@ -25,10 +25,7 @@ export type { GraphQueryOptions, GraphSlot, } from './graph/index.js'; -export { - BlankSectionContentType, - BlankExperienceContentType, -} from './model/internalContentTypes.js'; +export { BlankSectionContentType, BlankExperienceContentType } from './model/internalContentTypes.js'; export * as GraphErrors from './graph/error.js'; export * as ContentTypes from './model/contentTypes.js'; diff --git a/packages/optimizely-cms-sdk/src/infer.ts b/packages/optimizely-cms-sdk/src/infer.ts index 23acf58d..012e5a2d 100644 --- a/packages/optimizely-cms-sdk/src/infer.ts +++ b/packages/optimizely-cms-sdk/src/infer.ts @@ -22,17 +22,9 @@ import { StringProperty, UrlProperty, } from './model/properties.js'; -import { - AnyContentType, - ExperienceContentType, - SectionContentType, -} from './model/contentTypes.js'; +import { AnyContentType, ExperienceContentType, SectionContentType } from './model/contentTypes.js'; import { Node } from './components/richText/renderer.js'; -import { - PublicImageAsset, - PublicRawFileAsset, - PublicVideoAsset, -} from './model/assets.js'; +import { PublicImageAsset, PublicRawFileAsset, PublicVideoAsset } from './model/assets.js'; import { DisplayTemplate } from './model/displayTemplates.js'; /** Forces Intellisense to resolve types */ @@ -89,10 +81,7 @@ type InferredRichText = { }; /** Asset types that can be returned in ContentReference */ -export type ContentReferenceItem = - | PublicImageAsset - | PublicVideoAsset - | PublicRawFileAsset; +export type ContentReferenceItem = PublicImageAsset | PublicVideoAsset | PublicRawFileAsset; export type InferredContentReference = { url: InferredUrl; @@ -136,13 +125,14 @@ type EnabledKeys> = { }[keyof T]; /** Infers an `object` with the TS type inferred for each type */ -type InferProps = T extends { - properties: Record; -} - ? { - [Key in EnabledKeys]: InferFromProperty< - T['properties'][Key] - > | null; +type InferProps = + T extends ( + { + properties: Record; + } + ) ? + { + [Key in EnabledKeys]: InferFromProperty | null; } : {}; @@ -182,13 +172,13 @@ export type ExperienceComponentNode = ExperienceCompositionNode & { }; /** Adds TS fields specific to `Experience` */ -type InferExperience = T extends ExperienceContentType - ? { composition: ExperienceStructureNode } - : {}; +type InferExperience = + T extends ExperienceContentType ? { composition: ExperienceStructureNode } : {}; /** Adds TS fields specific to `Section` */ -type InferSection = T extends SectionContentType - ? { +type InferSection = + T extends SectionContentType ? + { key: string; nodes: ExperienceNode[]; @@ -203,20 +193,23 @@ type InferFromContentType = Prettify< >; /** Infers the TypeScript type for a display setting */ -type InferFromDisplayTemplate = T extends { - settings: infer S; -} - ? { - [K in keyof S]: S[K] extends { - choices: Record; - editor: infer E; - } - ? E extends 'select' - ? keyof S[K]['choices'] - : E extends 'checkbox' - ? boolean - : never - : never; +type InferFromDisplayTemplate = + T extends ( + { + settings: infer S; + } + ) ? + { + [K in keyof S]: S[K] extends ( + { + choices: Record; + editor: infer E; + } + ) ? + E extends 'select' ? keyof S[K]['choices'] + : E extends 'checkbox' ? boolean + : never + : never; } : {}; diff --git a/packages/optimizely-cms-sdk/src/model/__test__/parseDisplaySettings.test.ts b/packages/optimizely-cms-sdk/src/model/__test__/parseDisplaySettings.test.ts index 8cbf2782..129c548d 100644 --- a/packages/optimizely-cms-sdk/src/model/__test__/parseDisplaySettings.test.ts +++ b/packages/optimizely-cms-sdk/src/model/__test__/parseDisplaySettings.test.ts @@ -33,4 +33,4 @@ describe('parseDisplaySettings', () => { const result = parseDisplaySettings(input); expect(result).toEqual(undefined); }); -}); \ No newline at end of file +}); diff --git a/packages/optimizely-cms-sdk/src/model/buildConfig.ts b/packages/optimizely-cms-sdk/src/model/buildConfig.ts index 00995d4d..4e80c8e5 100644 --- a/packages/optimizely-cms-sdk/src/model/buildConfig.ts +++ b/packages/optimizely-cms-sdk/src/model/buildConfig.ts @@ -24,7 +24,4 @@ export interface PropertyGroupRegistry { } // Type that combines built-in groups, registered custom groups -export type PropertyGroupKey = - | BuiltInPropertyGroups - | keyof PropertyGroupRegistry - | (string & {}); +export type PropertyGroupKey = BuiltInPropertyGroups | keyof PropertyGroupRegistry | (string & {}); diff --git a/packages/optimizely-cms-sdk/src/model/contentTypeRegistry.ts b/packages/optimizely-cms-sdk/src/model/contentTypeRegistry.ts index fd733908..076f2549 100644 --- a/packages/optimizely-cms-sdk/src/model/contentTypeRegistry.ts +++ b/packages/optimizely-cms-sdk/src/model/contentTypeRegistry.ts @@ -9,7 +9,7 @@ export function init(registry: AnyContentType[]) { /** Get the Component from a content type name */ export function getContentType(name: string) { - return _registry.find((c) => c.key === name); + return _registry.find(c => c.key === name); } /** Get all the content types */ @@ -19,7 +19,7 @@ export function getAllContentTypes(): AnyContentType[] { /** Get the Component from a base type */ export function getContentTypeByBaseType(name: string): AnyContentType[] { - return _registry.filter((c) => c.baseType === name) as AnyContentType[]; + return _registry.filter(c => c.baseType === name) as AnyContentType[]; } /** diff --git a/packages/optimizely-cms-sdk/src/model/contentTypes.ts b/packages/optimizely-cms-sdk/src/model/contentTypes.ts index 7a1df75c..bcb9da7b 100644 --- a/packages/optimizely-cms-sdk/src/model/contentTypes.ts +++ b/packages/optimizely-cms-sdk/src/model/contentTypes.ts @@ -1,12 +1,7 @@ import { AnyProperty } from './properties.js'; // Main base types -export const MAIN_BASE_TYPES = [ - '_component', - '_experience', - '_section', - '_page', -] as const; +export const MAIN_BASE_TYPES = ['_component', '_experience', '_section', '_page'] as const; // Media-related base types export const MEDIA_BASE_TYPES = ['_image', '_media', '_video'] as const; @@ -15,11 +10,7 @@ export const MEDIA_BASE_TYPES = ['_image', '_media', '_video'] as const; export const OTHER_BASE_TYPES = ['_folder'] as const; // All base types including media and other types -export const ALL_BASE_TYPES = [ - ...MAIN_BASE_TYPES, - ...MEDIA_BASE_TYPES, - ...OTHER_BASE_TYPES, -] as const; +export const ALL_BASE_TYPES = [...MAIN_BASE_TYPES, ...MEDIA_BASE_TYPES, ...OTHER_BASE_TYPES] as const; export type BaseTypes = (typeof ALL_BASE_TYPES)[number]; export type MediaStringTypes = (typeof MEDIA_BASE_TYPES)[number]; @@ -34,21 +25,13 @@ type BaseContentType = { /** Represents the Page type in CMS */ export type PageContentType = BaseContentType & { baseType: '_page'; - mayContainTypes?: Array< - | ContentType - | '_self' - | string - >; + mayContainTypes?: Array | '_self' | string>; }; /** Represents the Experience type in CMS */ export type ExperienceContentType = BaseContentType & { baseType: '_experience'; - mayContainTypes?: Array< - | ContentType - | '_self' - | string - >; + mayContainTypes?: Array | '_self' | string>; }; /** Represents the Folder (Used in the asset panel to organizing content and not in Graph) type in CMS */ diff --git a/packages/optimizely-cms-sdk/src/model/displayTemplateRegistry.ts b/packages/optimizely-cms-sdk/src/model/displayTemplateRegistry.ts index b367802b..f3d47818 100644 --- a/packages/optimizely-cms-sdk/src/model/displayTemplateRegistry.ts +++ b/packages/optimizely-cms-sdk/src/model/displayTemplateRegistry.ts @@ -9,7 +9,7 @@ export function init(registry: DisplayTemplate[]) { /** Get the DisplayTemplate from a template name */ export function getDisplayTemplate(name: string) { - return _registry.find((c) => c.key === name); + return _registry.find(c => c.key === name); } /** @@ -31,5 +31,5 @@ export function getAllDisplayTemplates(): DisplayTemplate[] { /** Get the DisplayTemplate from a tag */ export function getDisplayTemplateByTag(tag: string): DisplayTemplate[] { - return _registry.filter((c) => c.tag === tag) as DisplayTemplate[]; + return _registry.filter(c => c.tag === tag) as DisplayTemplate[]; } diff --git a/packages/optimizely-cms-sdk/src/model/displayTemplates.ts b/packages/optimizely-cms-sdk/src/model/displayTemplates.ts index 5827fd15..62641700 100644 --- a/packages/optimizely-cms-sdk/src/model/displayTemplates.ts +++ b/packages/optimizely-cms-sdk/src/model/displayTemplates.ts @@ -55,15 +55,14 @@ type BaseDisplayTemplate = { tag?: string; // Optional tag property to store the name of the React component }; -export type DisplayTemplateVariant = BaseDisplayTemplate & - (NodeTemplate | BaseTemplate | WithContentType); +export type DisplayTemplateVariant = BaseDisplayTemplate & (NodeTemplate | BaseTemplate | WithContentType); export type DisplayTemplate = T & { __type: 'displayTemplate'; }; export function parseDisplaySettings( - displaySettings?: DisplaySettingsType[] | null + displaySettings?: DisplaySettingsType[] | null, ): Record | undefined { if (!displaySettings) { return undefined; // Return undefined if displaySettings is not provided @@ -74,7 +73,10 @@ export function parseDisplaySettings( // Iterate over the input array for (const { key, value } of displaySettings) { // Assign the value to the key in the result object - result[key] = value === 'true' ? true : value === 'false' ? false : value; + result[key] = + value === 'true' ? true + : value === 'false' ? false + : value; } return result; diff --git a/packages/optimizely-cms-sdk/src/model/index.ts b/packages/optimizely-cms-sdk/src/model/index.ts index 6e86f902..8a4f25b1 100644 --- a/packages/optimizely-cms-sdk/src/model/index.ts +++ b/packages/optimizely-cms-sdk/src/model/index.ts @@ -3,23 +3,17 @@ import { AnyContentType } from './contentTypes.js'; import { DisplayTemplate, DisplayTemplateVariant } from './displayTemplates.js'; /** Defines a Optimizely CMS content type */ -export function contentType( - options: T -): T & { __type: 'contentType' } { +export function contentType(options: T): T & { __type: 'contentType' } { return { ...options, __type: 'contentType' }; } /** Defines a Optimizely CMS display template */ -export function displayTemplate( - options: T -): DisplayTemplate { +export function displayTemplate(options: T): DisplayTemplate { return { ...options, __type: 'displayTemplate' }; } /** Defines a Optimizely CMS build configuration */ -export function buildConfig( - options: T -): T & { __type: 'buildConfig' } { +export function buildConfig(options: T): T & { __type: 'buildConfig' } { return { ...options, __type: 'buildConfig' }; } @@ -28,11 +22,7 @@ export function buildConfig( */ export function isContentType(obj: unknown): obj is AnyContentType { return ( - typeof obj === 'object' && - obj !== null && - '__type' in obj && - (obj as any).__type === 'contentType' && - 'key' in obj + typeof obj === 'object' && obj !== null && '__type' in obj && (obj as any).__type === 'contentType' && 'key' in obj ); } diff --git a/packages/optimizely-cms-sdk/src/react/__test__/RichText.test.tsx b/packages/optimizely-cms-sdk/src/react/__test__/RichText.test.tsx index d2af07d2..cdd49a38 100644 --- a/packages/optimizely-cms-sdk/src/react/__test__/RichText.test.tsx +++ b/packages/optimizely-cms-sdk/src/react/__test__/RichText.test.tsx @@ -22,9 +22,7 @@ describe('RichText Component', () => { render(); // Check for different elements - expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent( - 'Main Heading' - ); + expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Main Heading'); expect(screen.getByRole('list')).toBeInTheDocument(); expect(screen.getByRole('link')).toHaveTextContent('This is a link'); expect(screen.getByText('bold text').tagName.toLowerCase()).toBe('strong'); @@ -39,9 +37,7 @@ describe('RichText Component', () => { it('should decode HTML entities by default', () => { render(); // Should decode HTML entities - expect( - screen.getByText('Text with entities & symbols') - ).toBeInTheDocument(); + expect(screen.getByText('Text with entities & symbols')).toBeInTheDocument(); }); it('should handle unknown elements with fallback', () => { @@ -58,8 +54,6 @@ describe('RichText Component', () => { expect(screen.getByText('italic text').tagName.toLowerCase()).toBe('em'); expect(screen.getByText('underlined text').tagName.toLowerCase()).toBe('u'); expect(screen.getByText('code text').tagName.toLowerCase()).toBe('code'); // Fixed: now correctly renders as - expect(screen.getByText('strikethrough text').tagName.toLowerCase()).toBe( - 's' - ); + expect(screen.getByText('strikethrough text').tagName.toLowerCase()).toBe('s'); }); }); diff --git a/packages/optimizely-cms-sdk/src/react/__test__/assetsUtils.test.tsx b/packages/optimizely-cms-sdk/src/react/__test__/assetsUtils.test.tsx index d0c9f396..4a8189f0 100644 --- a/packages/optimizely-cms-sdk/src/react/__test__/assetsUtils.test.tsx +++ b/packages/optimizely-cms-sdk/src/react/__test__/assetsUtils.test.tsx @@ -155,9 +155,7 @@ describe('getPreviewUtils', () => { }); const result = utils.src(assetWithDefaultUrl); - expect(result).toBe( - 'https://example.com/default-image.jpg?preview_token=test-token-456', - ); + expect(result).toBe('https://example.com/default-image.jpg?preview_token=test-token-456'); }); it('should handle string URL input', () => { @@ -174,9 +172,7 @@ describe('getPreviewUtils', () => { }); const result = utils.src('https://example.com/image.jpg'); - expect(result).toBe( - 'https://example.com/image.jpg?preview_token=test-token-123', - ); + expect(result).toBe('https://example.com/image.jpg?preview_token=test-token-123'); }); it('should return empty string for null input', () => { @@ -232,9 +228,7 @@ describe('getPreviewUtils', () => { }); const result = utils.src('https://example.com/image.jpg?width=500'); - expect(result).toBe( - 'https://example.com/image.jpg?width=500&preview_token=test-token-123', - ); + expect(result).toBe('https://example.com/image.jpg?width=500&preview_token=test-token-123'); }); it('should prefer url.default over item.Url when both exist', () => { @@ -310,11 +304,7 @@ describe('getPreviewUtils', () => { expect(result).toBeDefined(); const entries = result!.split(', '); - expect( - entries.every((entry: string) => - entry.includes('preview_token=test-token-456'), - ), - ).toBe(true); + expect(entries.every((entry: string) => entry.includes('preview_token=test-token-456'))).toBe(true); }); it('should deduplicate renditions with same width', () => { @@ -337,11 +327,7 @@ describe('getPreviewUtils', () => { expect(result).toBeDefined(); const entries = result!.split(', '); - expect( - entries.every((entry: string) => - entry.includes('preview_token=test-token-123'), - ), - ).toBe(true); + expect(entries.every((entry: string) => entry.includes('preview_token=test-token-123'))).toBe(true); }); it('should return undefined for null ContentReference', () => { @@ -473,11 +459,7 @@ describe('getPreviewUtils', () => { expect(result).toBeDefined(); const entries = result!.split(', '); - expect( - entries.every((entry: string) => - entry.includes('preview_token=test-token-123'), - ), - ).toBe(true); + expect(entries.every((entry: string) => entry.includes('preview_token=test-token-123'))).toBe(true); }); it('should extract alt text using getAlt from damAssets', () => { diff --git a/packages/optimizely-cms-sdk/src/react/__test__/attribute-conversion.test.tsx b/packages/optimizely-cms-sdk/src/react/__test__/attribute-conversion.test.tsx index 10c05e0a..173246ea 100644 --- a/packages/optimizely-cms-sdk/src/react/__test__/attribute-conversion.test.tsx +++ b/packages/optimizely-cms-sdk/src/react/__test__/attribute-conversion.test.tsx @@ -9,12 +9,9 @@ describe('Attribute Conversion to React Props', () => { it('should convert class to className', () => { const TestComponent = createHtmlComponent('div'); const { container } = render( - + Test - + , ); const divElement = container.querySelector('div'); @@ -31,7 +28,7 @@ describe('Attribute Conversion to React Props', () => { border: '1', }} element={{ type: 'table', children: [] }} - /> + />, ); const tableElement = container.querySelector('table'); @@ -52,7 +49,7 @@ describe('Attribute Conversion to React Props', () => { 'custom-attr': 'value', // Should stay as-is (not a known HTML attribute) }} element={{ type: 'div', children: [] }} - /> + />, ); const divElement = container.querySelector('div'); @@ -80,7 +77,7 @@ describe('Attribute Conversion to React Props', () => { spellcheck: 'false', }} element={{ type: 'div', children: [] }} - /> + />, ); const divElement = container.querySelector('div'); @@ -99,7 +96,7 @@ describe('Attribute Conversion to React Props', () => { 'data-multi-word': 'test', }} element={{ type: 'div', children: [] }} - /> + />, ); const divElement = container.querySelector('div'); diff --git a/packages/optimizely-cms-sdk/src/react/client.tsx b/packages/optimizely-cms-sdk/src/react/client.tsx index 39af0b2f..96f25c64 100644 --- a/packages/optimizely-cms-sdk/src/react/client.tsx +++ b/packages/optimizely-cms-sdk/src/react/client.tsx @@ -31,8 +31,7 @@ export function PreviewComponent() { }; window.addEventListener('optimizely:cms:contentSaved', handler); - return () => - window.removeEventListener('optimizely:cms:contentSaved', handler); + return () => window.removeEventListener('optimizely:cms:contentSaved', handler); }, []); return null; diff --git a/packages/optimizely-cms-sdk/src/react/context/__test__/contextWrapper.test.tsx b/packages/optimizely-cms-sdk/src/react/context/__test__/contextWrapper.test.tsx index bfe8d3cb..12557c78 100644 --- a/packages/optimizely-cms-sdk/src/react/context/__test__/contextWrapper.test.tsx +++ b/packages/optimizely-cms-sdk/src/react/context/__test__/contextWrapper.test.tsx @@ -13,14 +13,10 @@ beforeEach(() => { describe('withAppContext', () => { describe('Basic HOC functionality', () => { test('should wrap component and render it', async () => { - const TestComponent = ({ testProp }: { testProp: string }) => ( -
    {testProp}
    - ); + const TestComponent = ({ testProp }: { testProp: string }) =>
    {testProp}
    ; const WrappedComponent = withAppContext(TestComponent); - const { findByTestId } = render( - await WrappedComponent({ testProp: 'test-value' }), - ); + const { findByTestId } = render(await WrappedComponent({ testProp: 'test-value' })); const element = await findByTestId('test-component'); expect(element).toBeDefined(); @@ -36,9 +32,7 @@ describe('withAppContext', () => { ); const WrappedComponent = withAppContext(TestComponent); - const { container } = render( - await WrappedComponent({ name: 'John', age: 30, active: true }), - ); + const { container } = render(await WrappedComponent({ name: 'John', age: 30, active: true })); expect(container.textContent).toBe('John-30-true'); }); @@ -48,7 +42,7 @@ describe('withAppContext', () => { test('should initialize empty context', async () => { const TestComponent = () => { const data = getContext(); - return
    {JSON.stringify(data)}
    ; + return
    {JSON.stringify(data)}
    ; }; const WrappedComponent = withAppContext(TestComponent); @@ -61,15 +55,13 @@ describe('withAppContext', () => { test('should provide fresh context for each wrapped component', async () => { const TestComponent = () => { const data = getContext(); - return
    {data?.previewToken || 'empty'}
    ; + return
    {data?.previewToken || 'empty'}
    ; }; const WrappedComponent = withAppContext(TestComponent); // First render - const { findByTestId: findByTestId1 } = render( - await WrappedComponent({}), - ); + const { findByTestId: findByTestId1 } = render(await WrappedComponent({})); const element1 = await findByTestId1('result'); expect(element1.textContent).toBe('empty'); }); @@ -81,9 +73,7 @@ describe('withAppContext', () => { const data = getContext(); return (
    - - {Object.keys(data || {}).length === 0 ? 'empty' : 'has-data'} - + {Object.keys(data || {}).length === 0 ? 'empty' : 'has-data'}
    ); }; @@ -99,11 +89,7 @@ describe('withAppContext', () => { const TestComponent = () => { // Components can call getContext() const data = getContext(); - return ( -
    - {typeof data === 'object' ? 'object' : 'undefined'} -
    - ); + return
    {typeof data === 'object' ? 'object' : 'undefined'}
    ; }; const WrappedComponent = withAppContext(TestComponent); @@ -127,22 +113,14 @@ describe('withAppContext', () => { const InfoComponent = () => { const data = getContext(); - return ( -
    - {data?.previewToken - ? 'preview mode' - : 'getPreviewContent not called'} -
    - ); + return
    {data?.previewToken ? 'preview mode' : 'getPreviewContent not called'}
    ; }; const WrappedComponent = withAppContext(InfoComponent); const { findByTestId } = render(await WrappedComponent({})); // Without getPreviewContent being called, no preview data exists - expect((await findByTestId('info')).textContent).toBe( - 'getPreviewContent not called', - ); + expect((await findByTestId('info')).textContent).toBe('getPreviewContent not called'); }); }); }); diff --git a/packages/optimizely-cms-sdk/src/react/context/contextWrapper.tsx b/packages/optimizely-cms-sdk/src/react/context/contextWrapper.tsx index 6e4a13be..b55f4090 100644 --- a/packages/optimizely-cms-sdk/src/react/context/contextWrapper.tsx +++ b/packages/optimizely-cms-sdk/src/react/context/contextWrapper.tsx @@ -1,9 +1,5 @@ import React from 'react'; -import { - configureAdapter, - hasAdapter, - initializeRequestContext, -} from '../../context/config.js'; +import { configureAdapter, hasAdapter, initializeRequestContext } from '../../context/config.js'; import ReactContextAdapter from '../../context/reactContextAdapter.js'; // Configure the React adapter only if no custom adapter has been set @@ -46,9 +42,7 @@ if (!hasAdapter()) { * export default withAppContext(MyPage); * ``` */ -export function withAppContext

    ( - Component: React.ComponentType

    , -) { +export function withAppContext

    (Component: React.ComponentType

    ) { return async function WrappedWithContext(props: P) { // Initialize context for this request initializeRequestContext(); diff --git a/packages/optimizely-cms-sdk/src/react/richText/component.tsx b/packages/optimizely-cms-sdk/src/react/richText/component.tsx index a73c31ae..7c25faab 100644 --- a/packages/optimizely-cms-sdk/src/react/richText/component.tsx +++ b/packages/optimizely-cms-sdk/src/react/richText/component.tsx @@ -1,9 +1,5 @@ import React from 'react'; -import { - generateDefaultElements, - generateDefaultLeafs, - type RichTextProps, -} from './lib.js'; +import { generateDefaultElements, generateDefaultLeafs, type RichTextProps } from './lib.js'; import { createReactRenderer } from './renderer.js'; /** diff --git a/packages/optimizely-cms-sdk/src/react/richText/lib.ts b/packages/optimizely-cms-sdk/src/react/richText/lib.ts index 41bc19da..59b4399a 100644 --- a/packages/optimizely-cms-sdk/src/react/richText/lib.ts +++ b/packages/optimizely-cms-sdk/src/react/richText/lib.ts @@ -20,38 +20,33 @@ import { getContextData } from '../../context/config.js'; /** * React-specific element renderer props (extends shared props with React children) */ -export interface ElementRendererProps - extends BaseElementRendererProps, PropsWithChildren {} +export interface ElementRendererProps extends BaseElementRendererProps, PropsWithChildren {} /** * React-specific props for link elements with type safety */ -export interface LinkElementProps - extends Omit, PropsWithChildren { +export interface LinkElementProps extends Omit, PropsWithChildren { element: LinkElement; } /** * React-specific props for image elements with type safety */ -export interface ImageElementProps - extends Omit, PropsWithChildren { +export interface ImageElementProps extends Omit, PropsWithChildren { element: ImageElement; } /** * React-specific props for table elements with type safety */ -export interface TableElementProps - extends Omit, PropsWithChildren { +export interface TableElementProps extends Omit, PropsWithChildren { element: TableElement; } /** * React-specific props for table cell elements with type safety */ -export interface TableCellElementRendererProps - extends Omit, PropsWithChildren { +export interface TableCellElementRendererProps extends Omit, PropsWithChildren { element: TableCellElement; } @@ -63,8 +58,7 @@ export type ElementProps = ElementRendererProps; /** * React-specific leaf renderer props (extends shared props with React children) */ -export interface LeafRendererProps - extends BaseLeafRendererProps, PropsWithChildren {} +export interface LeafRendererProps extends BaseLeafRendererProps, PropsWithChildren {} /** * Prop type used for custom Leaf components @@ -94,8 +88,7 @@ export type TableElementRenderer = React.ComponentType; /** * React component for rendering table cell elements with type safety */ -export type TableCellElementRenderer = - React.ComponentType; +export type TableCellElementRenderer = React.ComponentType; /** * React component for rendering Slate text leaves @@ -116,9 +109,7 @@ export type LeafMap = BaseLeafMap; * React-specific RichText props */ export interface RichTextProps - extends - RichTextPropsBase, - Omit, 'content'> {} + extends RichTextPropsBase, Omit, 'content'> {} /** * Maps HTML attribute names to React JSX attribute names @@ -410,10 +401,7 @@ const HTML_ATTRIBUTE_ELEMENTS = new Set(['table', 'img', 'input', 'canvas']); * Converts framework-agnostic attributes to React props * Handles HTML attribute to React JSX attribute conversion and CSS properties */ -export function toReactProps( - attributes: Record, - elementType?: string, -): Record { +export function toReactProps(attributes: Record, elementType?: string): Record { const reactProps: Record = {}; const styleProps: Record = {}; @@ -477,7 +465,7 @@ function parseStyleString(styleString: string): Record { return styleObj; } - styleString.split(';').forEach((declaration) => { + styleString.split(';').forEach(declaration => { const colonIndex = declaration.indexOf(':'); if (colonIndex === -1) return; @@ -509,9 +497,7 @@ export function createHtmlComponent( const mergedProps = { ...reactProps, ...config.attributes, - className: - [reactProps.className, config.className].filter(Boolean).join(' ') || - undefined, + className: [reactProps.className, config.className].filter(Boolean).join(' ') || undefined, }; // We don't pass children to self-closing elements @@ -533,11 +519,7 @@ export function createLinkComponent( tag: T = 'a' as T, config: HtmlComponentConfig = {}, ): LinkElementRenderer { - const Component: LinkElementRenderer = ({ - children, - attributes, - element, - }) => { + const Component: LinkElementRenderer = ({ children, attributes, element }) => { // Convert to React props and merge with config const reactProps = toReactProps(attributes || {}, tag as string); @@ -553,9 +535,7 @@ export function createLinkComponent( ...reactProps, ...linkProps, ...config.attributes, - className: - [reactProps.className, config.className].filter(Boolean).join(' ') || - undefined, + className: [reactProps.className, config.className].filter(Boolean).join(' ') || undefined, }; return React.createElement(tag, mergedProps, children); @@ -572,11 +552,7 @@ export function createImageComponent( tag: T = 'img' as T, config: HtmlComponentConfig = {}, ): ImageElementRenderer { - const Component: ImageElementRenderer = ({ - children, - attributes, - element, - }) => { + const Component: ImageElementRenderer = ({ children, attributes, element }) => { // Convert to React props and merge with config const reactProps = toReactProps(attributes || {}, tag as string); @@ -606,9 +582,7 @@ export function createImageComponent( ...reactProps, ...imageProps, ...config.attributes, - className: - [reactProps.className, config.className].filter(Boolean).join(' ') || - undefined, + className: [reactProps.className, config.className].filter(Boolean).join(' ') || undefined, }; // Image elements are self-closing and cannot have children @@ -626,20 +600,14 @@ export function createTableComponent( tag: T = 'table' as T, config: HtmlComponentConfig = {}, ): TableElementRenderer { - const Component: TableElementRenderer = ({ - children, - attributes, - element, - }) => { + const Component: TableElementRenderer = ({ children, attributes, element }) => { // Convert to React props and merge with config const reactProps = toReactProps(attributes || {}, tag as string); const mergedProps = { ...reactProps, ...config.attributes, - className: - [reactProps.className, config.className].filter(Boolean).join(' ') || - undefined, + className: [reactProps.className, config.className].filter(Boolean).join(' ') || undefined, }; return React.createElement(tag, mergedProps, children); @@ -656,20 +624,14 @@ export function createTableCellComponent( tag: T, config: HtmlComponentConfig = {}, ): TableCellElementRenderer { - const Component: TableCellElementRenderer = ({ - children, - attributes, - element, - }) => { + const Component: TableCellElementRenderer = ({ children, attributes, element }) => { // Convert to React props and merge with config const reactProps = toReactProps(attributes || {}); const mergedProps = { ...reactProps, ...config.attributes, - className: - [reactProps.className, config.className].filter(Boolean).join(' ') || - undefined, + className: [reactProps.className, config.className].filter(Boolean).join(' ') || undefined, }; return React.createElement(tag, mergedProps, children); @@ -692,9 +654,7 @@ export function createLeafComponent( const mergedProps = { ...reactProps, ...config.attributes, - className: - [reactProps.className, config.className].filter(Boolean).join(' ') || - undefined, + className: [reactProps.className, config.className].filter(Boolean).join(' ') || undefined, }; return React.createElement(tag, mergedProps, children); @@ -714,40 +674,22 @@ export function generateDefaultElements(): ElementMap { // Use specialized components for specific element types switch (type) { case 'link': - elementMap[type] = createLinkComponent( - 'a', - config.config, - ) as ElementRenderer; + elementMap[type] = createLinkComponent('a', config.config) as ElementRenderer; break; case 'image': - elementMap[type] = createImageComponent( - 'img', - config.config, - ) as ElementRenderer; + elementMap[type] = createImageComponent('img', config.config) as ElementRenderer; break; case 'table': - elementMap[type] = createTableComponent( - 'table', - config.config, - ) as ElementRenderer; + elementMap[type] = createTableComponent('table', config.config) as ElementRenderer; break; case 'td': - elementMap[type] = createTableCellComponent( - 'td', - config.config, - ) as ElementRenderer; + elementMap[type] = createTableCellComponent('td', config.config) as ElementRenderer; break; case 'th': - elementMap[type] = createTableCellComponent( - 'th', - config.config, - ) as ElementRenderer; + elementMap[type] = createTableCellComponent('th', config.config) as ElementRenderer; break; default: - elementMap[type] = createHtmlComponent( - config.tag as keyof JSX.IntrinsicElements, - config.config, - ); + elementMap[type] = createHtmlComponent(config.tag as keyof JSX.IntrinsicElements, config.config); break; } }); diff --git a/packages/optimizely-cms-sdk/src/react/richText/renderer.ts b/packages/optimizely-cms-sdk/src/react/richText/renderer.ts index 3c64ab39..e677c329 100644 --- a/packages/optimizely-cms-sdk/src/react/richText/renderer.ts +++ b/packages/optimizely-cms-sdk/src/react/richText/renderer.ts @@ -1,13 +1,6 @@ import React, { type ReactNode } from 'react'; -import { - BaseRichTextRenderer, - type BaseRendererConfig, -} from '../../components/richText/base.js'; -import { - type RenderNode, - type Node, - createElementData, -} from '../../components/richText/renderer.js'; +import { BaseRichTextRenderer, type BaseRendererConfig } from '../../components/richText/base.js'; +import { type RenderNode, type Node, createElementData } from '../../components/richText/renderer.js'; import { generateDefaultElements, generateDefaultLeafs, @@ -28,11 +21,7 @@ export interface ReactRendererConfig extends BaseRendererConfig { /** * React implementation of the rich text renderer using the base class */ -export class ReactRichTextRenderer extends BaseRichTextRenderer< - ElementRenderer, - LeafRenderer, - ReactNode -> { +export class ReactRichTextRenderer extends BaseRichTextRenderer { private elements: ElementMap; private leafs: LeafMap; @@ -40,13 +29,9 @@ export class ReactRichTextRenderer extends BaseRichTextRenderer< super(config); // Convert custom element keys to lowercase for consistent lookup - const lowercaseElements = config.elements - ? Object.fromEntries( - Object.entries(config.elements).map(([key, value]) => [ - key.toLowerCase(), - value, - ]), - ) + const lowercaseElements = + config.elements ? + Object.fromEntries(Object.entries(config.elements).map(([key, value]) => [key.toLowerCase(), value])) : {}; this.elements = { @@ -55,13 +40,9 @@ export class ReactRichTextRenderer extends BaseRichTextRenderer< }; // Convert custom leaf keys to lowercase for consistent lookup - const lowercaseLeafs = config.leafs - ? Object.fromEntries( - Object.entries(config.leafs).map(([key, value]) => [ - key.toLowerCase(), - value, - ]), - ) + const lowercaseLeafs = + config.leafs ? + Object.fromEntries(Object.entries(config.leafs).map(([key, value]) => [key.toLowerCase(), value])) : {}; this.leafs = { @@ -81,27 +62,16 @@ export class ReactRichTextRenderer extends BaseRichTextRenderer< /** * Create a React element from a render node */ - protected createElement( - node: RenderNode, - children: ReactNode[], - index: number, - ): ReactNode { + protected createElement(node: RenderNode, children: ReactNode[], index: number): ReactNode { // Normalize element type to lowercase for consistent lookup const normalizedElementType = node.elementType!.toLowerCase(); - const ElementComponent = - this.elements[normalizedElementType] || - this.getDefaultElement(normalizedElementType); + const ElementComponent = this.elements[normalizedElementType] || this.getDefaultElement(normalizedElementType); - const elementData = createElementData( - normalizedElementType, - node.attributes, - ); + const elementData = createElementData(normalizedElementType, node.attributes); // Extract text content from render nodes - const textContent = node.children - ? this.extractTextFromRenderNodes(node.children) - : ''; + const textContent = node.children ? this.extractTextFromRenderNodes(node.children) : ''; // Create the React element with enhanced props return React.createElement( @@ -135,8 +105,7 @@ export class ReactRichTextRenderer extends BaseRichTextRenderer< const mark = node.marks[markIndex]; // Normalize mark to lowercase for consistent lookup const normalizedMark = mark.toLowerCase(); - const LeafComponent = - this.leafs[normalizedMark] || this.getDefaultLeaf(normalizedMark); + const LeafComponent = this.leafs[normalizedMark] || this.getDefaultLeaf(normalizedMark); // Create leaf data const leafData = { @@ -164,7 +133,7 @@ export class ReactRichTextRenderer extends BaseRichTextRenderer< */ private extractTextFromRenderNodes(nodes: RenderNode[]): string { return nodes - .map((node) => { + .map(node => { if (node.type === 'text') { return this.decodeEntities(node.content || ''); } else if (node.children) { @@ -200,8 +169,6 @@ export class ReactRichTextRenderer extends BaseRichTextRenderer< /** * Factory function to create a React renderer */ -export function createReactRenderer( - config?: Partial, -): ReactRichTextRenderer { +export function createReactRenderer(config?: Partial): ReactRichTextRenderer { return new ReactRichTextRenderer(config); } diff --git a/packages/optimizely-cms-sdk/src/react/server.tsx b/packages/optimizely-cms-sdk/src/react/server.tsx index e4e12151..fce8e36d 100644 --- a/packages/optimizely-cms-sdk/src/react/server.tsx +++ b/packages/optimizely-cms-sdk/src/react/server.tsx @@ -1,8 +1,5 @@ import React, { ReactNode } from 'react'; -import { - ComponentRegistry, - ComponentResolverOrObject, -} from '../render/componentRegistry.js'; +import { ComponentRegistry, ComponentResolverOrObject } from '../render/componentRegistry.js'; import { JSX } from 'react'; import { ExperienceStructureNode, @@ -104,24 +101,15 @@ type OptimizelyComponentProps = { displaySettings?: Record; }; -export async function OptimizelyComponent({ - content, - displaySettings, - ...props -}: OptimizelyComponentProps) { +export async function OptimizelyComponent({ content, displaySettings, ...props }: OptimizelyComponentProps) { if (!content) { - throw new OptimizelyReactError( - 'OptimizelyComponent requires a valid content prop. Received null or undefined.', - ); + throw new OptimizelyReactError('OptimizelyComponent requires a valid content prop. Received null or undefined.'); } if (!componentRegistry) { - throw new OptimizelyReactError( - 'You should call `initReactComponentRegistry` first', - ); + throw new OptimizelyReactError('You should call `initReactComponentRegistry` first'); } - const dtKey = - content.__composition?.displayTemplateKey ?? content.displayTemplateKey; + const dtKey = content.__composition?.displayTemplateKey ?? content.displayTemplateKey; const Component = await componentRegistry.getComponent(content.__typename, { tag: content.__tag ?? getDisplayTemplateTag(dtKey), }); @@ -138,13 +126,7 @@ export async function OptimizelyComponent({ ...content, }; - return ( - - ); + return ; } export type StructureContainerProps = { @@ -158,12 +140,8 @@ export type ComponentContainerProps = { children: React.ReactNode; displaySettings?: Record; }; -export type StructureContainer = ( - props: StructureContainerProps, -) => JSX.Element; -export type ComponentContainer = ( - props: ComponentContainerProps, -) => JSX.Element; +export type StructureContainer = (props: StructureContainerProps) => JSX.Element; +export type ComponentContainer = (props: ComponentContainerProps) => JSX.Element; export function OptimizelyComposition({ nodes, @@ -172,7 +150,7 @@ export function OptimizelyComposition({ nodes: ExperienceNode[]; ComponentWrapper?: ComponentContainer; }) { - return nodes.map((node) => { + return nodes.map(node => { const tag = getDisplayTemplateTag(node.displayTemplateKey); const parsedDisplaySettings = parseDisplaySettings(node.displaySettings); @@ -180,11 +158,7 @@ export function OptimizelyComposition({ const Wrapper = ComponentWrapper ?? React.Fragment; return ( - + - {children} - - ) : null; + return isDev() ? +

    + {children} +
    + : null; } type OptimizelyGridSectionProps = { @@ -263,11 +237,7 @@ const fallbacks: Record = { column: FallbackColumn, }; -export function OptimizelyGridSection({ - nodes, - row, - column, -}: OptimizelyGridSectionProps) { +export function OptimizelyGridSection({ nodes, row, column }: OptimizelyGridSectionProps) { const locallyDefined: Record = { row, column, @@ -310,17 +280,8 @@ export function OptimizelyGridSection({ React.Fragment; return ( - - + + ); }); @@ -364,9 +325,7 @@ export function getPreviewUtils(content: OptimizelyComponentProps['content']) { * /> * ``` */ - src( - input: InferredContentReference | string | null | undefined, - ): string | undefined { + src(input: InferredContentReference | string | null | undefined): string | undefined { const previewToken = content.__context?.preview_token; // if input is an object with a URL diff --git a/packages/optimizely-cms-sdk/src/render/assets.ts b/packages/optimizely-cms-sdk/src/render/assets.ts index 19c6ae09..5c8a5fff 100644 --- a/packages/optimizely-cms-sdk/src/render/assets.ts +++ b/packages/optimizely-cms-sdk/src/render/assets.ts @@ -1,9 +1,5 @@ import type { InferredContentReference } from '../infer.js'; -import type { - PublicImageAsset, - PublicVideoAsset, - PublicRawFileAsset, -} from '../model/assets.js'; +import type { PublicImageAsset, PublicVideoAsset, PublicRawFileAsset } from '../model/assets.js'; import { appendToken } from '../util/preview.js'; /** @@ -27,7 +23,7 @@ function appendPreviewTokenToRenditions( if (result.item && 'Renditions' in result.item && result.item.Renditions) { result.item = { ...result.item, - Renditions: result.item.Renditions.map((r) => ({ + Renditions: result.item.Renditions.map(r => ({ ...r, Url: r.Url ? appendToken(r.Url, previewToken) : r.Url, })), @@ -81,12 +77,9 @@ export function getSrcset>( const previewToken = content?.__context?.preview_token; // Apply preview token to renditions if provided - const processedInput = previewToken - ? appendPreviewTokenToRenditions(input, previewToken) - : input; + const processedInput = previewToken ? appendPreviewTokenToRenditions(input, previewToken) : input; - if (!processedInput?.item || !('Renditions' in processedInput.item)) - return undefined; + if (!processedInput?.item || !('Renditions' in processedInput.item)) return undefined; const renditions = processedInput.item.Renditions; if (!renditions || renditions.length === 0) return undefined; @@ -95,14 +88,14 @@ export function getSrcset>( const seenWidths = new Set(); const srcsetEntries = renditions - .filter((r) => { + .filter(r => { if (!r.Url || !r.Width) return false; // Skip if we've already seen this width if (seenWidths.has(r.Width)) return false; seenWidths.add(r.Width); return true; }) - .map((r) => `${r.Url!} ${r.Width}w`); + .map(r => `${r.Url!} ${r.Width}w`); return srcsetEntries.length > 0 ? srcsetEntries.join(', ') : undefined; } @@ -144,10 +137,7 @@ export function getSrcset>( * {getAlt(content.icon)} // Will be alt="" if no AltText exists * ``` */ -export function getAlt( - input: InferredContentReference | null | undefined, - fallback: string = '', -): string { +export function getAlt(input: InferredContentReference | null | undefined, fallback: string = ''): string { if (!input) return fallback; if (input.item && 'AltText' in input.item) { @@ -296,14 +286,8 @@ export function isDamRawFileAsset( * } * ``` */ -export function isDamAsset( - property: InferredContentReference | null | undefined, -): boolean { - return ( - isDamImageAsset(property) || - isDamVideoAsset(property) || - isDamRawFileAsset(property) - ); +export function isDamAsset(property: InferredContentReference | null | undefined): boolean { + return isDamImageAsset(property) || isDamVideoAsset(property) || isDamRawFileAsset(property); } /** @@ -397,12 +381,9 @@ export function getDamAssetType( * } * ``` */ -export function damAssets>( - content: T & { __context?: { preview_token?: string } }, -) { +export function damAssets>(content: T & { __context?: { preview_token?: string } }) { return { - getSrcset: (property: InferredContentReference | null | undefined) => - getSrcset(content, property), + getSrcset: (property: InferredContentReference | null | undefined) => getSrcset(content, property), getAlt, getDamAssetType, isDamImageAsset, diff --git a/packages/optimizely-cms-sdk/src/render/componentRegistry.ts b/packages/optimizely-cms-sdk/src/render/componentRegistry.ts index 61b0cca8..8adf0bf2 100644 --- a/packages/optimizely-cms-sdk/src/render/componentRegistry.ts +++ b/packages/optimizely-cms-sdk/src/render/componentRegistry.ts @@ -37,10 +37,7 @@ type ResolverOptions = { * implement custom logic for component resolution, such as lazy loading, conditional * rendering, or dynamic imports. */ -type ComponentResolver = ( - contentType: string, - options?: ResolverOptions -) => C | undefined; +type ComponentResolver = (contentType: string, options?: ResolverOptions) => C | undefined; /** Object mapping a content type name to a {@linkcode ComponentEntry} */ type ComponentMap = Record>; @@ -60,10 +57,7 @@ function getDefaultComponent(entry: ComponentEntry): C | undefined { } /** Returns a component matching a tag in a {@linkcode ComponentEntry} */ -function getTagComponent( - entry: ComponentEntry, - tag: string -): C | undefined { +function getTagComponent(entry: ComponentEntry, tag: string): C | undefined { if (!hasVariants(entry)) { return undefined; } @@ -75,9 +69,7 @@ function getTagComponent( * Defines the component resolver as a function {@linkcode ComponentResolver} * or as an object {@linkcode ComponentMap} */ -export type ComponentResolverOrObject = - | ComponentResolver - | ComponentMap; +export type ComponentResolverOrObject = ComponentResolver | ComponentMap; /** A registry mapping content type names and components */ export class ComponentRegistry { @@ -88,10 +80,7 @@ export class ComponentRegistry { } /** Returns the component given its content type name. Returns `undefined` if not found */ - getComponent( - contentType: string, - options: ResolverOptions = {} - ): T | undefined { + getComponent(contentType: string, options: ResolverOptions = {}): T | undefined { if (typeof this.resolver === 'function') { return this.resolver(contentType, options); } diff --git a/packages/optimizely-cms-sdk/src/util/baseTypeUtil.ts b/packages/optimizely-cms-sdk/src/util/baseTypeUtil.ts index 1e8f9d30..e82eb5ab 100644 --- a/packages/optimizely-cms-sdk/src/util/baseTypeUtil.ts +++ b/packages/optimizely-cms-sdk/src/util/baseTypeUtil.ts @@ -1,10 +1,5 @@ import { ExperienceComponentNode, ExperienceNode } from '../infer.js'; -import { - AnyContentType, - MEDIA_BASE_TYPES, - PermittedTypes, - MediaStringTypes, -} from '../model/contentTypes.js'; +import { AnyContentType, MEDIA_BASE_TYPES, PermittedTypes, MediaStringTypes } from '../model/contentTypes.js'; /** * Get the key or name of ContentType or Media type @@ -78,8 +73,6 @@ export function buildBaseTypeFragments() { }; } -export function isComponentNode( - node: ExperienceNode, -): node is ExperienceComponentNode { +export function isComponentNode(node: ExperienceNode): node is ExperienceComponentNode { return node.__typename === 'CompositionComponentNode'; } diff --git a/packages/optimizely-cms-sdk/src/util/environment.ts b/packages/optimizely-cms-sdk/src/util/environment.ts index 78b0d7dc..1dd64c77 100644 --- a/packages/optimizely-cms-sdk/src/util/environment.ts +++ b/packages/optimizely-cms-sdk/src/util/environment.ts @@ -1,6 +1,4 @@ // A simple function to check for the development environment. export function isDev(): boolean { - return ( - typeof process !== 'undefined' && process.env?.NODE_ENV === 'development' - ); + return typeof process !== 'undefined' && process.env?.NODE_ENV === 'development'; } diff --git a/packages/optimizely-cms-sdk/src/util/fragmentConstraintChecks.ts b/packages/optimizely-cms-sdk/src/util/fragmentConstraintChecks.ts index daf43cc0..6fa9652e 100644 --- a/packages/optimizely-cms-sdk/src/util/fragmentConstraintChecks.ts +++ b/packages/optimizely-cms-sdk/src/util/fragmentConstraintChecks.ts @@ -24,10 +24,8 @@ function areItemConstraintsMissing(property: AnyProperty): boolean { return ( property.type === 'array' && !( - ('allowedTypes' in property.items && - property.items.allowedTypes?.length) || - ('restrictedTypes' in property.items && - property.items.restrictedTypes?.length) + ('allowedTypes' in property.items && property.items.allowedTypes?.length) || + ('restrictedTypes' in property.items && property.items.restrictedTypes?.length) ) ); } @@ -51,8 +49,7 @@ export function checkTypeConstraintIssues( maxFragmentThreshold: number = 100, ): string | null { if ( - (arePropertyConstraintsMissing(property) || - areItemConstraintsMissing(property)) && + (arePropertyConstraintsMissing(property) || areItemConstraintsMissing(property)) && result.extraFragments.length > maxFragmentThreshold ) { return ( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c41ae20b..f5e2962e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,15 @@ importers: lerna: specifier: ^8.2.2 version: 8.2.2(encoding@0.1.13) + prettier: + specifier: 3.8.3 + version: 3.8.3 + pretty-quick: + specifier: ^4.2.2 + version: 4.2.2(prettier@3.8.3) + simple-git-hooks: + specifier: ^2.13.1 + version: 2.13.1 __test__/cli-runtime-test: dependencies: @@ -1580,6 +1589,10 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} + '@pkgr/core@0.2.9': + resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + '@redocly/config@0.22.0': resolution: {integrity: sha512-gAy93Ddo01Z3bHuVdPWfCwzgfaYgMdaZPcfL7JZ7hWJoK9V0lXDbigTWkhiPFAaLWzbOJ+kbUQG1+XwIm0KRGQ==} @@ -3911,6 +3924,10 @@ packages: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} + ignore@7.0.5: + resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} + engines: {node: '>= 4'} + import-fresh@3.3.1: resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} engines: {node: '>=6'} @@ -4716,6 +4733,10 @@ packages: resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==} engines: {node: '>=0.10.0'} + mri@1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -5180,6 +5201,13 @@ packages: resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + pretty-quick@4.2.2: + resolution: {integrity: sha512-uAh96tBW1SsD34VhhDmWuEmqbpfYc/B3j++5MC/6b3Cb8Ow7NJsvKFhg0eoGu2xXX+o9RkahkTK6sUdd8E7g5w==} + engines: {node: '>=14'} + hasBin: true + peerDependencies: + prettier: ^3.0.0 + proc-log@4.2.0: resolution: {integrity: sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -5515,6 +5543,10 @@ packages: resolution: {integrity: sha512-8G+/XDU8wNsJOQS5ysDVO0Etg9/2uA5gR9l4ZwijjlwxBcrU6RPfwi2+jJmbP+Ap1Hlp/nVAaEO4Fj22/SL2gQ==} engines: {node: ^16.14.0 || >=18.0.0} + simple-git-hooks@2.13.1: + resolution: {integrity: sha512-WszCLXwT4h2k1ufIXAgsbiTOazqqevFCIncOuUBZJ91DdvWcC5+OFkluWRQPrcuSYd8fjq+o2y1QfWqYMoAToQ==} + hasBin: true + sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} @@ -7496,6 +7528,8 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true + '@pkgr/core@0.2.9': {} + '@redocly/config@0.22.0': {} '@redocly/openapi-core@1.34.11(supports-color@10.2.2)': @@ -10201,6 +10235,8 @@ snapshots: ignore@5.3.2: {} + ignore@7.0.5: {} + import-fresh@3.3.1: dependencies: parent-module: 1.0.1 @@ -11075,6 +11111,8 @@ snapshots: modify-values@1.0.1: {} + mri@1.2.0: {} + ms@2.1.3: {} multimatch@5.0.0: @@ -11637,6 +11675,17 @@ snapshots: ansi-styles: 5.2.0 react-is: 18.3.1 + pretty-quick@4.2.2(prettier@3.8.3): + dependencies: + '@pkgr/core': 0.2.9 + ignore: 7.0.5 + mri: 1.2.0 + picocolors: 1.1.1 + picomatch: 4.0.4 + prettier: 3.8.3 + tinyexec: 0.3.2 + tslib: 2.8.1 + proc-log@4.2.0: {} process-nextick-args@2.0.1: {} @@ -12040,6 +12089,8 @@ snapshots: transitivePeerDependencies: - supports-color + simple-git-hooks@2.13.1: {} + sisteransi@1.0.5: {} slash@3.0.0: {} diff --git a/samples/fx-integration/eslint.config.mjs b/samples/fx-integration/eslint.config.mjs index 719cea2b..60f7af38 100644 --- a/samples/fx-integration/eslint.config.mjs +++ b/samples/fx-integration/eslint.config.mjs @@ -1,6 +1,6 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; +import { FlatCompat } from '@eslint/eslintrc'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -10,15 +10,9 @@ const compat = new FlatCompat({ }); const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), + ...compat.extends('next/core-web-vitals', 'next/typescript'), { - ignores: [ - "node_modules/**", - ".next/**", - "out/**", - "build/**", - "next-env.d.ts", - ], + ignores: ['node_modules/**', '.next/**', 'out/**', 'build/**', 'next-env.d.ts'], }, ]; diff --git a/samples/fx-integration/next.config.ts b/samples/fx-integration/next.config.ts index e9ffa308..5e891cf0 100644 --- a/samples/fx-integration/next.config.ts +++ b/samples/fx-integration/next.config.ts @@ -1,4 +1,4 @@ -import type { NextConfig } from "next"; +import type { NextConfig } from 'next'; const nextConfig: NextConfig = { /* config options here */ diff --git a/samples/fx-integration/src/app/en/[...slug]/page.tsx b/samples/fx-integration/src/app/en/[...slug]/page.tsx index 802a8b80..d1bb861a 100644 --- a/samples/fx-integration/src/app/en/[...slug]/page.tsx +++ b/samples/fx-integration/src/app/en/[...slug]/page.tsx @@ -38,7 +38,7 @@ export default async function Page({ params }: Props) { .getContentByPath(path, { variation: { include: 'SOME', value: [variation] }, }) - .then((content) => { + .then(content => { // If no variations are found, try to fetch the original if (content.length === 0) { console.log('Variation not found. Fetching original'); diff --git a/samples/fx-integration/src/app/layout.tsx b/samples/fx-integration/src/app/layout.tsx index d524cee0..56639320 100644 --- a/samples/fx-integration/src/app/layout.tsx +++ b/samples/fx-integration/src/app/layout.tsx @@ -1,11 +1,7 @@ import type { Metadata } from 'next'; import { Geist, Geist_Mono } from 'next/font/google'; import './globals.css'; -import { - BlankExperienceContentType, - BlankSectionContentType, - initContentTypeRegistry, -} from '@optimizely/cms-sdk'; +import { BlankExperienceContentType, BlankSectionContentType, initContentTypeRegistry } from '@optimizely/cms-sdk'; import { initReactComponentRegistry } from '@optimizely/cms-sdk/react/server'; import FxCallToAction, { FxCallToActionCT } from '@/components/FxCallToAction'; import FxCallout, { FxCalloutCT } from '@/components/FxCallout'; @@ -13,9 +9,7 @@ import FxFeature, { FxFeatureCT } from '@/components/FxFeature'; import FxFigure, { FxFigureCT } from '@/components/FxFigure'; import FxHero, { FxHeroContentType } from '@/components/FxHero'; import FxQuote, { FxQuoteCT } from '@/components/FxQuote'; -import FxSectionHeading, { - FxSectionHeadingCT, -} from '@/components/FxSectionHeading'; +import FxSectionHeading, { FxSectionHeadingCT } from '@/components/FxSectionHeading'; import BlankExperience from '@/components/BlankExperience'; import BlankSection from '@/components/BlankSection'; @@ -65,10 +59,8 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - - - {children} - + + {children} ); } diff --git a/samples/fx-integration/src/app/preview/page.tsx b/samples/fx-integration/src/app/preview/page.tsx index de8b2317..d8f9a8fa 100644 --- a/samples/fx-integration/src/app/preview/page.tsx +++ b/samples/fx-integration/src/app/preview/page.tsx @@ -16,9 +16,9 @@ async function Page({ searchParams }: Props) { const content = await client .getPreviewContent( // TODO: check types in runtime properly - (await searchParams) as PreviewParams + (await searchParams) as PreviewParams, ) - .catch((err) => { + .catch(err => { console.log(err.errors); console.log(err.request.query); throw err; @@ -26,9 +26,7 @@ async function Page({ searchParams }: Props) { return ( <> - + diff --git a/samples/fx-integration/src/components/BlankExperience.tsx b/samples/fx-integration/src/components/BlankExperience.tsx index 6b9adb08..d79b68c7 100644 --- a/samples/fx-integration/src/components/BlankExperience.tsx +++ b/samples/fx-integration/src/components/BlankExperience.tsx @@ -1,9 +1,5 @@ import { BlankExperienceContentType, ContentProps } from '@optimizely/cms-sdk'; -import { - ComponentContainerProps, - OptimizelyComposition, - getPreviewUtils, -} from '@optimizely/cms-sdk/react/server'; +import { ComponentContainerProps, OptimizelyComposition, getPreviewUtils } from '@optimizely/cms-sdk/react/server'; import css from './components.module.css'; type Props = { @@ -22,10 +18,7 @@ function ComponentWrapper({ children, node }: ComponentContainerProps) { export default function BlankExperience({ content }: Props) { return (
    - +
    ); } diff --git a/samples/fx-integration/src/components/BlankSection.tsx b/samples/fx-integration/src/components/BlankSection.tsx index 9c7626d1..f5436ae7 100644 --- a/samples/fx-integration/src/components/BlankSection.tsx +++ b/samples/fx-integration/src/components/BlankSection.tsx @@ -1,9 +1,5 @@ import { BlankSectionContentType, ContentProps } from '@optimizely/cms-sdk'; -import { - OptimizelyGridSection, - StructureContainerProps, - getPreviewUtils, -} from '@optimizely/cms-sdk/react/server'; +import { OptimizelyGridSection, StructureContainerProps, getPreviewUtils } from '@optimizely/cms-sdk/react/server'; import css from './components.module.css'; type BlankSectionProps = { diff --git a/samples/fx-integration/src/components/FxCallToAction.tsx b/samples/fx-integration/src/components/FxCallToAction.tsx index c7037664..d6611c73 100644 --- a/samples/fx-integration/src/components/FxCallToAction.tsx +++ b/samples/fx-integration/src/components/FxCallToAction.tsx @@ -23,10 +23,7 @@ type Props = { }; export default function FxCallToAction({ content }: Props) { - const cls = [ - css.FxCallToAction, - content.appearance && css[content.appearance], - ].join(' '); + const cls = [css.FxCallToAction, content.appearance && css[content.appearance]].join(' '); return ( {content.text} diff --git a/samples/fx-integration/tsconfig.json b/samples/fx-integration/tsconfig.json index b575f7da..61b9d358 100644 --- a/samples/fx-integration/tsconfig.json +++ b/samples/fx-integration/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "ES2017", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -23,19 +19,9 @@ } ], "paths": { - "@/*": [ - "./src/*" - ] + "@/*": ["./src/*"] } }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - ".next/dev/types/**/*.ts" - ], - "exclude": [ - "node_modules" - ] + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"], + "exclude": ["node_modules"] } diff --git a/samples/graph-webhooks-cache-invalidation/eslint.config.mjs b/samples/graph-webhooks-cache-invalidation/eslint.config.mjs index 719cea2b..60f7af38 100644 --- a/samples/graph-webhooks-cache-invalidation/eslint.config.mjs +++ b/samples/graph-webhooks-cache-invalidation/eslint.config.mjs @@ -1,6 +1,6 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; +import { FlatCompat } from '@eslint/eslintrc'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -10,15 +10,9 @@ const compat = new FlatCompat({ }); const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), + ...compat.extends('next/core-web-vitals', 'next/typescript'), { - ignores: [ - "node_modules/**", - ".next/**", - "out/**", - "build/**", - "next-env.d.ts", - ], + ignores: ['node_modules/**', '.next/**', 'out/**', 'build/**', 'next-env.d.ts'], }, ]; diff --git a/samples/graph-webhooks-cache-invalidation/next.config.ts b/samples/graph-webhooks-cache-invalidation/next.config.ts index e9ffa308..5e891cf0 100644 --- a/samples/graph-webhooks-cache-invalidation/next.config.ts +++ b/samples/graph-webhooks-cache-invalidation/next.config.ts @@ -1,4 +1,4 @@ -import type { NextConfig } from "next"; +import type { NextConfig } from 'next'; const nextConfig: NextConfig = { /* config options here */ diff --git a/samples/graph-webhooks-cache-invalidation/scripts/create-webhook.mjs b/samples/graph-webhooks-cache-invalidation/scripts/create-webhook.mjs index f77f570b..c2e4897e 100644 --- a/samples/graph-webhooks-cache-invalidation/scripts/create-webhook.mjs +++ b/samples/graph-webhooks-cache-invalidation/scripts/create-webhook.mjs @@ -1,16 +1,6 @@ // Use this script to create a webhook in Optimizely Graph // Read more: https://docs.developers.optimizely.com/platform-optimizely/reference/create-webhookhandler -import { - cancel, - confirm, - intro, - isCancel, - log, - outro, - password, - spinner, - text, -} from '@clack/prompts'; +import { cancel, confirm, intro, isCancel, log, outro, password, spinner, text } from '@clack/prompts'; import 'dotenv/config'; function validate(str) { @@ -41,9 +31,7 @@ const url = await text({ validate, }).then(exitIfCancelled); -log.step( - 'Go to your CMS > Settings > API Keys. You will need the keys under `Manage Graph`' -); +log.step('Go to your CMS > Settings > API Keys. You will need the keys under `Manage Graph`'); const appKey = await password({ message: "Input the 'AppKey'", @@ -56,12 +44,12 @@ const secret = await password({ }).then(exitIfCancelled); const prod = await confirm({ - message: - 'Do you use Optimizely Graph API prod (https://prod.cg.optimizely.com/api)?', + message: 'Do you use Optimizely Graph API prod (https://prod.cg.optimizely.com/api)?', }).then(exitIfCancelled); -const graphApiUrl = prod - ? 'https://prod.cg.optimizely.com/api' +const graphApiUrl = + prod ? + 'https://prod.cg.optimizely.com/api' : await text({ message: 'Input the Graph API URL', placeholder: 'https://prod.cg.optimizely.com/api', @@ -84,12 +72,10 @@ const requestBody = { log.step( `You are going to make a POST request to the endpoint "${endpoint}"\n` + `with the following body\n\n` + - JSON.stringify(requestBody, null, 2) + JSON.stringify(requestBody, null, 2), ); -const confirmCreation = await confirm({ message: 'Confirm?' }).then( - exitIfCancelled -); +const confirmCreation = await confirm({ message: 'Confirm?' }).then(exitIfCancelled); if (!confirmCreation) { cancel('Operation cancelled'); diff --git a/samples/graph-webhooks-cache-invalidation/scripts/edit-webhook.mjs b/samples/graph-webhooks-cache-invalidation/scripts/edit-webhook.mjs index 3d90bcb7..dfbb0700 100644 --- a/samples/graph-webhooks-cache-invalidation/scripts/edit-webhook.mjs +++ b/samples/graph-webhooks-cache-invalidation/scripts/edit-webhook.mjs @@ -1,17 +1,7 @@ // Use this script to view and delete webhooks in Optimizely Graph // Read more: https://docs.developers.optimizely.com/platform-optimizely/reference/create-webhookhandler import { select } from '@clack/prompts'; -import { - cancel, - confirm, - intro, - isCancel, - log, - outro, - password, - spinner, - text, -} from '@clack/prompts'; +import { cancel, confirm, intro, isCancel, log, outro, password, spinner, text } from '@clack/prompts'; import 'dotenv/config'; function validate(str) { @@ -38,9 +28,7 @@ async function handleResponse(response) { intro('View and delete webhooks in Optimizely Graph'); -log.step( - 'Go to your CMS > Settings > API Keys. You will need the keys under `Manage Graph`' -); +log.step('Go to your CMS > Settings > API Keys. You will need the keys under `Manage Graph`'); const appKey = await password({ message: "Input the 'AppKey'", @@ -53,12 +41,12 @@ const secret = await password({ }).then(exitIfCancelled); const prod = await confirm({ - message: - 'Do you use Optimizely Graph API prod (https://prod.cg.optimizely.com/api)?', + message: 'Do you use Optimizely Graph API prod (https://prod.cg.optimizely.com/api)?', }).then(exitIfCancelled); -const graphApiUrl = prod - ? 'https://prod.cg.optimizely.com/api' +const graphApiUrl = + prod ? + 'https://prod.cg.optimizely.com/api' : await text({ message: 'Input the Graph API URL', placeholder: 'https://prod.cg.optimizely.com/api', @@ -84,7 +72,7 @@ while (true) { message: 'Select a webhook to delete it', options: [ { value: null, label: 'Do not delete any webhook' }, - ...webhooksList.map((w) => ({ + ...webhooksList.map(w => ({ value: w.id, label: w.request.url, })), @@ -99,7 +87,7 @@ while (true) { await fetch(`${endpoint}/${selected}`, { method: 'DELETE', headers: { Authorization: auth }, - }).then(async (r) => { + }).then(async r => { if (!r.ok) { log.error(await r.text()); cancel('Something wrong happened when deleting the webhook'); diff --git a/samples/graph-webhooks-cache-invalidation/src/app/layout.tsx b/samples/graph-webhooks-cache-invalidation/src/app/layout.tsx index 93a32778..d63b58ed 100644 --- a/samples/graph-webhooks-cache-invalidation/src/app/layout.tsx +++ b/samples/graph-webhooks-cache-invalidation/src/app/layout.tsx @@ -11,7 +11,7 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - + {children} ); diff --git a/samples/graph-webhooks-cache-invalidation/src/app/preview/page.tsx b/samples/graph-webhooks-cache-invalidation/src/app/preview/page.tsx index 3d6291c6..134d99e0 100644 --- a/samples/graph-webhooks-cache-invalidation/src/app/preview/page.tsx +++ b/samples/graph-webhooks-cache-invalidation/src/app/preview/page.tsx @@ -3,8 +3,7 @@ import React from 'react'; export default function Page() { return (
    - Preview mode doesn't cache content, to test the webhook cache - invalidation, navigate to view mode by clicking{' '} + Preview mode doesn't cache content, to test the webhook cache invalidation, navigate to view mode by clicking{' '} Options → View on website.
    ); diff --git a/samples/graph-webhooks-cache-invalidation/src/app/webhooks/[id]/route.ts b/samples/graph-webhooks-cache-invalidation/src/app/webhooks/[id]/route.ts index 55fdf0b7..7186dc62 100644 --- a/samples/graph-webhooks-cache-invalidation/src/app/webhooks/[id]/route.ts +++ b/samples/graph-webhooks-cache-invalidation/src/app/webhooks/[id]/route.ts @@ -21,7 +21,7 @@ async function revalidateDocId(docId: string) { const parts = docId.split('_'); const id = parts[0].replaceAll('-', ''); const locale = parts[1]; // e.g., "en" - + const client = new GraphClient(process.env.OPTIMIZELY_GRAPH_SINGLE_KEY!, { graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY, }); @@ -43,10 +43,7 @@ query GetPath($id:String, $locale: Locales) { console.log('Path "%s" successfully revalidated', path); } -export async function POST( - request: Request, - { params }: { params: Promise<{ id: string }> } -) { +export async function POST(request: Request, { params }: { params: Promise<{ id: string }> }) { const webhookId = (await params).id; if (webhookId !== WEBHOOK_ID) { @@ -58,9 +55,7 @@ export async function POST( // Learn more about the format of webhook responses: // https://docs.developers.optimizely.com/platform-optimizely/docs/webhook-response if (body.type.subject === 'bulk' && body.type.action === 'completed') { - const deleted = Object.values(body.data.items ?? {}).find( - (status) => status === 'deleted' - ); + const deleted = Object.values(body.data.items ?? {}).find(status => status === 'deleted'); // At this moment, there is no way to retrieve which page has been deleted // so for this example, we are going to revalidate all data diff --git a/samples/graph-webhooks-cache-invalidation/src/components/render-date.tsx b/samples/graph-webhooks-cache-invalidation/src/components/render-date.tsx index 5b702cc6..f02ef084 100644 --- a/samples/graph-webhooks-cache-invalidation/src/components/render-date.tsx +++ b/samples/graph-webhooks-cache-invalidation/src/components/render-date.tsx @@ -7,9 +7,7 @@ import { useEffect, useState } from 'react'; /** Render the elapsed time from a given `date` */ export function ShowElapsed({ date }: { date: string }) { - const [elapsedTime, setElapsed] = useState( - Date.now() - new Date(date).getTime() - ); + const [elapsedTime, setElapsed] = useState(Date.now() - new Date(date).getTime()); useEffect(() => { const i = setInterval(() => { setElapsed(Date.now() - new Date(date).getTime()); diff --git a/samples/hello-world/eslint.config.mjs b/samples/hello-world/eslint.config.mjs index c85fb67c..5b67bd0a 100644 --- a/samples/hello-world/eslint.config.mjs +++ b/samples/hello-world/eslint.config.mjs @@ -1,6 +1,6 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; +import { FlatCompat } from '@eslint/eslintrc'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -9,8 +9,6 @@ const compat = new FlatCompat({ baseDirectory: __dirname, }); -const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; +const eslintConfig = [...compat.extends('next/core-web-vitals', 'next/typescript')]; export default eslintConfig; diff --git a/samples/hello-world/next.config.ts b/samples/hello-world/next.config.ts index e9ffa308..5e891cf0 100644 --- a/samples/hello-world/next.config.ts +++ b/samples/hello-world/next.config.ts @@ -1,4 +1,4 @@ -import type { NextConfig } from "next"; +import type { NextConfig } from 'next'; const nextConfig: NextConfig = { /* config options here */ diff --git a/samples/hello-world/src/app/error.tsx b/samples/hello-world/src/app/error.tsx index fff2e36e..8993a154 100644 --- a/samples/hello-world/src/app/error.tsx +++ b/samples/hello-world/src/app/error.tsx @@ -3,21 +3,11 @@ import { useEffect } from 'react'; import { GraphErrors } from '@optimizely/cms-sdk'; -export default function Error({ - error, - reset, -}: { - error: Error & { digest?: string }; - reset: () => void; -}) { +export default function Error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) { useEffect(() => { // Use `instanceof` to get specific types of errors and handle differently if (error instanceof GraphErrors.GraphResponseError) { - console.error( - 'Optimizely Graph Error: ', - error.message, - 'see the query and variables in the logs' - ); + console.error('Optimizely Graph Error: ', error.message, 'see the query and variables in the logs'); console.log('Showing the query:'); console.log(error.request.query); console.log('Showing variables:'); diff --git a/samples/hello-world/src/app/layout.tsx b/samples/hello-world/src/app/layout.tsx index 3c5471c0..67445728 100644 --- a/samples/hello-world/src/app/layout.tsx +++ b/samples/hello-world/src/app/layout.tsx @@ -15,7 +15,7 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - + {children} ); diff --git a/samples/hello-world/src/app/preview/page.tsx b/samples/hello-world/src/app/preview/page.tsx index 6a6df95a..c77986ec 100644 --- a/samples/hello-world/src/app/preview/page.tsx +++ b/samples/hello-world/src/app/preview/page.tsx @@ -13,15 +13,11 @@ async function Page({ searchParams }: Props) { graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY, }); - const content = await client.getPreviewContent( - (await searchParams) as PreviewParams - ); + const content = await client.getPreviewContent((await searchParams) as PreviewParams); return ( <> - + diff --git a/samples/hello-world/tsconfig.json b/samples/hello-world/tsconfig.json index b575f7da..61b9d358 100644 --- a/samples/hello-world/tsconfig.json +++ b/samples/hello-world/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "ES2017", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -23,19 +19,9 @@ } ], "paths": { - "@/*": [ - "./src/*" - ] + "@/*": ["./src/*"] } }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - ".next/dev/types/**/*.ts" - ], - "exclude": [ - "node_modules" - ] + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"], + "exclude": ["node_modules"] } diff --git a/samples/nextjs-template/eslint.config.mjs b/samples/nextjs-template/eslint.config.mjs index c85fb67c..5b67bd0a 100644 --- a/samples/nextjs-template/eslint.config.mjs +++ b/samples/nextjs-template/eslint.config.mjs @@ -1,6 +1,6 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; +import { FlatCompat } from '@eslint/eslintrc'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -9,8 +9,6 @@ const compat = new FlatCompat({ baseDirectory: __dirname, }); -const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), -]; +const eslintConfig = [...compat.extends('next/core-web-vitals', 'next/typescript')]; export default eslintConfig; diff --git a/samples/nextjs-template/src/app/[...slug]/page.tsx b/samples/nextjs-template/src/app/[...slug]/page.tsx index 5f7a3421..3c45f6a1 100644 --- a/samples/nextjs-template/src/app/[...slug]/page.tsx +++ b/samples/nextjs-template/src/app/[...slug]/page.tsx @@ -47,7 +47,7 @@ export async function generateStaticParams() { graphUrl: process.env.OPTIMIZELY_GRAPH_GATEWAY, }); const data = await client.request(query, {}); - + return data._Page.items .filter((item: any) => { if (item?._metadata?.url?.base !== process.env.APPLICATION_HOST) { @@ -70,7 +70,7 @@ export async function generateStaticParams() { // Format as required in Next.js (path: string) => ({ slug: path.split('/'), - }) + }), ); } diff --git a/samples/nextjs-template/src/app/globals.css b/samples/nextjs-template/src/app/globals.css index e2eb7456..3e69b31e 100644 --- a/samples/nextjs-template/src/app/globals.css +++ b/samples/nextjs-template/src/app/globals.css @@ -238,11 +238,7 @@ section > header { width: 4rem; height: 4rem; font-size: 1.25rem; - background: radial-gradient( - var(--color-accent) 0%, - var(--color-accent) 50%, - #f000 51% - ); + background: radial-gradient(var(--color-accent) 0%, var(--color-accent) 50%, #f000 51%); border: var(--color-accent) 1px solid; grid-area: button; margin: 1rem 1.5rem; @@ -431,7 +427,9 @@ a:hover span.animate { flex-direction: column; justify-content: space-between; height: 100%; - transition: transform 0.2s ease, background-color 0.2s ease; + transition: + transform 0.2s ease, + background-color 0.2s ease; .subtitle { font-size: 0.9rem; color: #777; @@ -735,7 +733,9 @@ a:hover span.animate { padding: 1rem; width: 180px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); - transition: transform 0.2s ease, box-shadow 0.2s ease; + transition: + transform 0.2s ease, + box-shadow 0.2s ease; } .monthly-special__blog .card:hover { diff --git a/samples/nextjs-template/src/app/layout.tsx b/samples/nextjs-template/src/app/layout.tsx index 2de51599..c451e4e1 100644 --- a/samples/nextjs-template/src/app/layout.tsx +++ b/samples/nextjs-template/src/app/layout.tsx @@ -2,39 +2,20 @@ import React from 'react'; import { Bodoni_Moda, Inter } from 'next/font/google'; import './globals.css'; -import { - BlankExperienceContentType, - initContentTypeRegistry, - initDisplayTemplateRegistry, -} from '@optimizely/cms-sdk'; +import { BlankExperienceContentType, initContentTypeRegistry, initDisplayTemplateRegistry } from '@optimizely/cms-sdk'; import { initReactComponentRegistry } from '@optimizely/cms-sdk/react/server'; import Landing, { LandingPageContentType } from '@/components/Landing'; -import LandingSection, { - LandingSectionContentType, - LandingSectionDisplayTemplate, -} from '@/components/LandingSection'; -import SmallFeatureGrid, { - SmallFeatureGridContentType, -} from '@/components/SmallFeatureGrid'; -import SmallFeature, { - SmallFeatureContentType, -} from '@/components/SmallFeature'; -import VideoFeature, { - VideoFeatureContentType, -} from '@/components/VideoFeature'; +import LandingSection, { LandingSectionContentType, LandingSectionDisplayTemplate } from '@/components/LandingSection'; +import SmallFeatureGrid, { SmallFeatureGridContentType } from '@/components/SmallFeatureGrid'; +import SmallFeature, { SmallFeatureContentType } from '@/components/SmallFeature'; +import VideoFeature, { VideoFeatureContentType } from '@/components/VideoFeature'; import { HeroContentType } from '@/components/Hero'; import Article, { ArticleContentType } from '@/components/Article'; -import LandingExperience, { - LandingExperienceContentType, -} from '@/components/LandingExperience'; -import CallToAction, { - CallToActionContentType, -} from '@/components/CallToAction'; +import LandingExperience, { LandingExperienceContentType } from '@/components/LandingExperience'; +import CallToAction, { CallToActionContentType } from '@/components/CallToAction'; import BlankSection from '@/components/BlankSection'; -import BlogExperience, { - BlogExperienceContentType, -} from '@/components/BlogExperience'; +import BlogExperience, { BlogExperienceContentType } from '@/components/BlogExperience'; import BlogCard, { BlogCardContentType } from '@/components/BlogCard'; import Banner, { BannerContentType } from '@/components/Banner'; import Tile, { @@ -44,16 +25,10 @@ import Tile, { TileContentType, TileRowDisplayTemplate, } from '@/components/Tile'; -import AboutExperience, { - AboutExperienceContentType, -} from '@/components/AboutExperience'; +import AboutExperience, { AboutExperienceContentType } from '@/components/AboutExperience'; import AboutUs, { AboutUsContentType } from '@/components/AboutUs'; -import MonthlySpecial, { - MonthlySpecialContentType, -} from '@/components/MonthlySpecial'; -import OfficeLocations, { - OfficeContentType, -} from '@/components/OfficeLocations'; +import MonthlySpecial, { MonthlySpecialContentType } from '@/components/MonthlySpecial'; +import OfficeLocations, { OfficeContentType } from '@/components/OfficeLocations'; import Location, { LocationContentType } from '@/components/Location'; import BlankExperience from '@/components/BlankExperience'; import FAQ, { FAQContentType } from '@/components/FAQ'; @@ -135,10 +110,7 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - + {children} ); diff --git a/samples/nextjs-template/src/app/page.tsx b/samples/nextjs-template/src/app/page.tsx index b5e94bfb..b7493f49 100644 --- a/samples/nextjs-template/src/app/page.tsx +++ b/samples/nextjs-template/src/app/page.tsx @@ -1,12 +1,12 @@ export default function Home() { return ( <> -
    +

    JS SDK demo page

    To see some content in this site, create content in the CMS and go to - /[locale]/[slug], where locale is the localization (for - example "en") and slug is the path of the content + /[locale]/[slug], where locale is the localization (for example "en") and slug is the + path of the content

    diff --git a/samples/nextjs-template/src/app/preview/page.tsx b/samples/nextjs-template/src/app/preview/page.tsx index 612f131e..02854dc2 100644 --- a/samples/nextjs-template/src/app/preview/page.tsx +++ b/samples/nextjs-template/src/app/preview/page.tsx @@ -15,14 +15,12 @@ async function Page({ searchParams }: Props) { const content = await client.getPreviewContent( // TODO: check types in runtime properly - (await searchParams) as PreviewParams + (await searchParams) as PreviewParams, ); return ( <> - + diff --git a/samples/nextjs-template/src/components/AboutExperience.tsx b/samples/nextjs-template/src/components/AboutExperience.tsx index e4b5ea0e..819740d3 100644 --- a/samples/nextjs-template/src/components/AboutExperience.tsx +++ b/samples/nextjs-template/src/components/AboutExperience.tsx @@ -40,20 +40,17 @@ function ComponentWrapper({ children, node }: ComponentContainerProps) { export default function AboutExperience({ content }: Props) { const { pa } = getPreviewUtils(content); return ( -
    -
    +
    +

    {content.title}

    {content.subtitle}

    {content.section && ( -
    +
    )} - +
    ); } diff --git a/samples/nextjs-template/src/components/AboutUs.tsx b/samples/nextjs-template/src/components/AboutUs.tsx index 66d74426..4e2c84f2 100644 --- a/samples/nextjs-template/src/components/AboutUs.tsx +++ b/samples/nextjs-template/src/components/AboutUs.tsx @@ -36,16 +36,23 @@ export default function AboutUs({ content }: AboutUsProps) { const { getSrcset, getAlt } = damAssets(content); const image = src(content.image); return ( -
    +
    {content.image && ( -
    +
    {/* eslint-disable-next-line @next/next/no-img-element */} - {image ? ({getAlt(content.image,) : null} + {image ? + {getAlt(content.image, + : null}
    )}

    {content.heading}

    -
    -
    +
    +

    {content.heading}

    {content.subtitle}

    -
    +
    ); } diff --git a/samples/nextjs-template/src/components/Banner.tsx b/samples/nextjs-template/src/components/Banner.tsx index 677a7bf3..cf7e45ac 100644 --- a/samples/nextjs-template/src/components/Banner.tsx +++ b/samples/nextjs-template/src/components/Banner.tsx @@ -26,20 +26,16 @@ type Props = { export default function Banner({ content }: Props) { const { pa } = getPreviewUtils(content); return ( -
    -
    -

    +
    +
    +

    {content.title}

    -

    +

    {content.subtitle}

    {content.submit && ( -
    + Submit )} diff --git a/samples/nextjs-template/src/components/BlankExperience.tsx b/samples/nextjs-template/src/components/BlankExperience.tsx index 19c65280..08c72a41 100644 --- a/samples/nextjs-template/src/components/BlankExperience.tsx +++ b/samples/nextjs-template/src/components/BlankExperience.tsx @@ -1,9 +1,5 @@ import { BlankExperienceContentType, ContentProps } from '@optimizely/cms-sdk'; -import { - ComponentContainerProps, - OptimizelyComposition, - getPreviewUtils, -} from '@optimizely/cms-sdk/react/server'; +import { ComponentContainerProps, OptimizelyComposition, getPreviewUtils } from '@optimizely/cms-sdk/react/server'; type Props = { content: ContentProps; @@ -16,11 +12,8 @@ function ComponentWrapper({ children, node }: ComponentContainerProps) { export default function BlankExperience({ content }: Props) { return ( -
    - +
    +
    ); } diff --git a/samples/nextjs-template/src/components/BlankSection.tsx b/samples/nextjs-template/src/components/BlankSection.tsx index e09fa03f..c01ec006 100644 --- a/samples/nextjs-template/src/components/BlankSection.tsx +++ b/samples/nextjs-template/src/components/BlankSection.tsx @@ -1,8 +1,5 @@ import { BlankSectionContentType, ContentProps } from '@optimizely/cms-sdk'; -import { - OptimizelyGridSection, - getPreviewUtils, -} from '@optimizely/cms-sdk/react/server'; +import { OptimizelyGridSection, getPreviewUtils } from '@optimizely/cms-sdk/react/server'; type BlankSectionProps = { content: ContentProps; diff --git a/samples/nextjs-template/src/components/BlogCard.tsx b/samples/nextjs-template/src/components/BlogCard.tsx index 48da4ef8..6bba4eba 100644 --- a/samples/nextjs-template/src/components/BlogCard.tsx +++ b/samples/nextjs-template/src/components/BlogCard.tsx @@ -32,16 +32,16 @@ type Props = { export default function BlogCard({ content }: Props) { const { pa } = getPreviewUtils(content); return ( -
    +

    {content.title}

    -

    +

    {content.subtitle}

    -
    - +
    + {content.author} - + {content.date ? new Date(content.date).toLocaleDateString() : 'N/A'}
    diff --git a/samples/nextjs-template/src/components/BlogExperience.tsx b/samples/nextjs-template/src/components/BlogExperience.tsx index e7cdb5d0..31c6de97 100644 --- a/samples/nextjs-template/src/components/BlogExperience.tsx +++ b/samples/nextjs-template/src/components/BlogExperience.tsx @@ -43,20 +43,17 @@ function ComponentWrapper({ children, node }: ComponentContainerProps) { export default function BlogExperience({ content }: Props) { const { pa } = getPreviewUtils(content); return ( -
    -
    +
    +

    {content.title}

    {content.subtitle}

    -
    +
    {content?.articles?.map((article, index) => ( ))}
    - +
    ); } diff --git a/samples/nextjs-template/src/components/FAQ.tsx b/samples/nextjs-template/src/components/FAQ.tsx index 507024d6..4d9e7414 100644 --- a/samples/nextjs-template/src/components/FAQ.tsx +++ b/samples/nextjs-template/src/components/FAQ.tsx @@ -24,14 +24,11 @@ export type FAQProps = { export default function FAQ({ content }: FAQProps) { const { pa } = getPreviewUtils(content); return ( -
    +

    {content.heading}

    -
    -
    -
    +
    +
    +
    diff --git a/samples/nextjs-template/src/components/Landing.tsx b/samples/nextjs-template/src/components/Landing.tsx index 9ab3d30c..fca2103d 100644 --- a/samples/nextjs-template/src/components/Landing.tsx +++ b/samples/nextjs-template/src/components/Landing.tsx @@ -1,8 +1,5 @@ import { contentType, ContentProps } from '@optimizely/cms-sdk'; -import { - getPreviewUtils, - OptimizelyComponent, -} from '@optimizely/cms-sdk/react/server'; +import { getPreviewUtils, OptimizelyComponent } from '@optimizely/cms-sdk/react/server'; import { LandingSectionContentType } from './LandingSection'; import { HeroContentType } from './Hero'; import Image from 'next/image'; @@ -38,10 +35,8 @@ export default function LandingComponent({ content }: Props) {
    {content.hero && (
    - {heroBackgroundUrl && ( - - )} -
    + {heroBackgroundUrl && } +

    {content.hero.heading}

    {content.hero.summary}

    diff --git a/samples/nextjs-template/src/components/LandingExperience.tsx b/samples/nextjs-template/src/components/LandingExperience.tsx index 6e5b28f5..7ecf4caa 100644 --- a/samples/nextjs-template/src/components/LandingExperience.tsx +++ b/samples/nextjs-template/src/components/LandingExperience.tsx @@ -1,10 +1,6 @@ import Image from 'next/image'; import { contentType, ContentProps } from '@optimizely/cms-sdk'; -import { - ComponentContainerProps, - OptimizelyComposition, - getPreviewUtils, -} from '@optimizely/cms-sdk/react/server'; +import { ComponentContainerProps, OptimizelyComposition, getPreviewUtils } from '@optimizely/cms-sdk/react/server'; import { HeroContentType } from './Hero'; export const LandingExperienceContentType = contentType({ @@ -35,24 +31,14 @@ export default function LandingExperienceComponent({ content }: Props) {
    {content.hero && (
    - {heroBackgroundUrl && ( - - )} -
    + {heroBackgroundUrl && } +

    {content.hero.heading}

    {content.hero.summary}

    )} - +
    ); } diff --git a/samples/nextjs-template/src/components/LandingSection.tsx b/samples/nextjs-template/src/components/LandingSection.tsx index f2607800..a658b536 100644 --- a/samples/nextjs-template/src/components/LandingSection.tsx +++ b/samples/nextjs-template/src/components/LandingSection.tsx @@ -1,14 +1,7 @@ -import { - contentType, - displayTemplate, - ContentProps, -} from '@optimizely/cms-sdk'; +import { contentType, displayTemplate, ContentProps } from '@optimizely/cms-sdk'; import { SmallFeatureGridContentType } from './SmallFeatureGrid'; import { VideoFeatureContentType } from './VideoFeature'; -import { - getPreviewUtils, - OptimizelyComponent, -} from '@optimizely/cms-sdk/react/server'; +import { getPreviewUtils, OptimizelyComponent } from '@optimizely/cms-sdk/react/server'; export const LandingSectionContentType = contentType({ key: 'LandingSection', @@ -64,7 +57,7 @@ export default function LandingSection({ content }: Props) { const { pa } = getPreviewUtils(content); return (
    -
    +

    {content.heading}

    {content.subtitle}

    diff --git a/samples/nextjs-template/src/components/Location.tsx b/samples/nextjs-template/src/components/Location.tsx index e05511f7..f40f58a3 100644 --- a/samples/nextjs-template/src/components/Location.tsx +++ b/samples/nextjs-template/src/components/Location.tsx @@ -30,24 +30,18 @@ export default function Location({ content }: Props) { const { pa } = getPreviewUtils(content); return ( -
    - Location Image -

    +
    + Location Image +

    {content.name}

    -

    +

    {content.city}

    -

    +

    {content.address}

    -

    +

    {content.phone}

    diff --git a/samples/nextjs-template/src/components/MonthlySpecial.tsx b/samples/nextjs-template/src/components/MonthlySpecial.tsx index f8b3246a..e8271dcd 100644 --- a/samples/nextjs-template/src/components/MonthlySpecial.tsx +++ b/samples/nextjs-template/src/components/MonthlySpecial.tsx @@ -1,9 +1,6 @@ import { contentType, ContentProps } from '@optimizely/cms-sdk'; import { BlogCardContentType } from './BlogCard'; -import { - getPreviewUtils, - OptimizelyComponent, -} from '@optimizely/cms-sdk/react/server'; +import { getPreviewUtils, OptimizelyComponent } from '@optimizely/cms-sdk/react/server'; export const MonthlySpecialContentType = contentType({ key: 'MonthlySpecial', @@ -31,16 +28,16 @@ type Props = { export default function MonthlySpecial({ content }: Props) { const { pa } = getPreviewUtils(content); return ( -
    -
    -

    +
    +
    +

    {content.title}

    -

    +

    {content.subtitle}

    -
    +
    {content.blog && }
    diff --git a/samples/nextjs-template/src/components/OfficeLocations.tsx b/samples/nextjs-template/src/components/OfficeLocations.tsx index 8d823b45..5b015683 100644 --- a/samples/nextjs-template/src/components/OfficeLocations.tsx +++ b/samples/nextjs-template/src/components/OfficeLocations.tsx @@ -1,8 +1,5 @@ import { contentType, ContentProps } from '@optimizely/cms-sdk'; -import { - getPreviewUtils, - OptimizelyComponent, -} from '@optimizely/cms-sdk/react/server'; +import { getPreviewUtils, OptimizelyComponent } from '@optimizely/cms-sdk/react/server'; import { LocationContentType } from './Location'; export const OfficeContentType = contentType({ @@ -35,14 +32,14 @@ export default function OfficeLocations({ content }: Props) { const { pa } = getPreviewUtils(content); return ( -
    -

    +
    +

    {content.title}

    -

    +

    {content.subtitle}

    -
    +
    {(content.offices ?? []).map((office, i) => ( ))} diff --git a/samples/nextjs-template/src/components/SmallFeature.tsx b/samples/nextjs-template/src/components/SmallFeature.tsx index 9f332bf5..bc41b561 100644 --- a/samples/nextjs-template/src/components/SmallFeature.tsx +++ b/samples/nextjs-template/src/components/SmallFeature.tsx @@ -30,17 +30,13 @@ export default function SmallFeature({ content }: Props) { const imageUrl = src(content.image); return ( -
    +

    {content.heading}

    - {imageUrl ? ( + {imageUrl ? // eslint-disable-next-line @next/next/no-img-element - {getAlt(content.image, - ) : null} + {getAlt(content.image, + : null}
    diff --git a/samples/nextjs-template/src/components/SmallFeatureGrid.tsx b/samples/nextjs-template/src/components/SmallFeatureGrid.tsx index cd9ec87c..55d58a05 100644 --- a/samples/nextjs-template/src/components/SmallFeatureGrid.tsx +++ b/samples/nextjs-template/src/components/SmallFeatureGrid.tsx @@ -1,9 +1,6 @@ import { contentType, ContentProps } from '@optimizely/cms-sdk'; import { SmallFeatureContentType } from './SmallFeature'; -import { - getPreviewUtils, - OptimizelyComponent, -} from '@optimizely/cms-sdk/react/server'; +import { getPreviewUtils, OptimizelyComponent } from '@optimizely/cms-sdk/react/server'; export const SmallFeatureGridContentType = contentType({ key: 'SmallFeatureGrid', @@ -28,7 +25,7 @@ export default function SmallFeatureGrid({ content }: Props) { const { pa } = getPreviewUtils(content); return ( -
    +
    {content.smallFeatures?.map((feature, i) => ( ))} diff --git a/samples/nextjs-template/src/components/Tile.tsx b/samples/nextjs-template/src/components/Tile.tsx index e8d86e6f..d3267fca 100644 --- a/samples/nextjs-template/src/components/Tile.tsx +++ b/samples/nextjs-template/src/components/Tile.tsx @@ -1,8 +1,4 @@ -import { - contentType, - displayTemplate, - ContentProps, -} from '@optimizely/cms-sdk'; +import { contentType, displayTemplate, ContentProps } from '@optimizely/cms-sdk'; import { getPreviewUtils } from '@optimizely/cms-sdk/react/server'; export const TileContentType = contentType({ @@ -122,7 +118,7 @@ type Props = { export default function Tile({ content }: Props) { const { pa } = getPreviewUtils(content); return ( -
    +

    {content.title}

    {content.description}

    @@ -134,13 +130,12 @@ export function SquareTile({ content, displaySettings }: Props) { const { pa } = getPreviewUtils(content); return ( -
    +

    {content.title}

    diff --git a/samples/nextjs-template/src/components/VideoFeature.tsx b/samples/nextjs-template/src/components/VideoFeature.tsx index 2a5c3d9c..b5a0472e 100644 --- a/samples/nextjs-template/src/components/VideoFeature.tsx +++ b/samples/nextjs-template/src/components/VideoFeature.tsx @@ -36,17 +36,13 @@ export default function VideoFeature({ content }: Props) { const imageUrl = src(content.thumbnail_image); return ( -

    -
    +
    +
    - {imageUrl ? ( + {imageUrl ? // eslint-disable-next-line @next/next/no-img-element - {getAlt(content.thumbnail_image, - ) : null} + {getAlt(content.thumbnail_image, + : null} ▶︎

    {content.thumbnail_caption}

    diff --git a/samples/nextjs-template/tsconfig.json b/samples/nextjs-template/tsconfig.json index b575f7da..61b9d358 100644 --- a/samples/nextjs-template/tsconfig.json +++ b/samples/nextjs-template/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "ES2017", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -23,19 +19,9 @@ } ], "paths": { - "@/*": [ - "./src/*" - ] + "@/*": ["./src/*"] } }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - ".next/dev/types/**/*.ts" - ], - "exclude": [ - "node_modules" - ] + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"], + "exclude": ["node_modules"] } diff --git a/templates/alloy-template/next.config.ts b/templates/alloy-template/next.config.ts index 291d5eb8..a33274d5 100644 --- a/templates/alloy-template/next.config.ts +++ b/templates/alloy-template/next.config.ts @@ -1,6 +1,5 @@ import type { NextConfig } from 'next'; - const nextConfig: NextConfig = { images: { remotePatterns: [ diff --git a/templates/alloy-template/postcss.config.mjs b/templates/alloy-template/postcss.config.mjs index c7bcb4b1..ba720fe5 100644 --- a/templates/alloy-template/postcss.config.mjs +++ b/templates/alloy-template/postcss.config.mjs @@ -1,5 +1,5 @@ const config = { - plugins: ["@tailwindcss/postcss"], + plugins: ['@tailwindcss/postcss'], }; export default config; diff --git a/templates/alloy-template/src/app/layout.tsx b/templates/alloy-template/src/app/layout.tsx index ec6a4d9b..03dc6725 100644 --- a/templates/alloy-template/src/app/layout.tsx +++ b/templates/alloy-template/src/app/layout.tsx @@ -1,10 +1,6 @@ import type { Metadata } from 'next'; import { Geist, Geist_Mono } from 'next/font/google'; -import { - BlankExperienceContentType, - initContentTypeRegistry, - config, -} from '@optimizely/cms-sdk'; +import { BlankExperienceContentType, initContentTypeRegistry, config } from '@optimizely/cms-sdk'; import { initReactComponentRegistry } from '@optimizely/cms-sdk/react/server'; import './globals.css'; @@ -79,12 +75,8 @@ export default async function RootLayout({ children: React.ReactNode; }>) { return ( - - - {children} - + + {children} ); } diff --git a/templates/alloy-template/src/app/preview/page.tsx b/templates/alloy-template/src/app/preview/page.tsx index ab504931..f660ac3e 100644 --- a/templates/alloy-template/src/app/preview/page.tsx +++ b/templates/alloy-template/src/app/preview/page.tsx @@ -18,7 +18,7 @@ async function Page({ searchParams }: Props) { // TODO: check types in runtime properly (await searchParams) as PreviewParams, ) - .catch((err) => { + .catch(err => { console.log(err.errors); console.log(err.request?.query); throw err; @@ -29,9 +29,7 @@ async function Page({ searchParams }: Props) { return ( <> - +
    diff --git a/templates/alloy-template/src/components/News.tsx b/templates/alloy-template/src/components/News.tsx index de4d4694..fb79db08 100644 --- a/templates/alloy-template/src/components/News.tsx +++ b/templates/alloy-template/src/components/News.tsx @@ -1,10 +1,6 @@ import { contentType, ContentProps, damAssets } from '@optimizely/cms-sdk'; import { RichText } from '@optimizely/cms-sdk/react/richText'; -import { - ComponentContainerProps, - getPreviewUtils, - OptimizelyComposition, -} from '@optimizely/cms-sdk/react/server'; +import { ComponentContainerProps, getPreviewUtils, OptimizelyComposition } from '@optimizely/cms-sdk/react/server'; import { StandardContentType } from './Standard'; import { SEOContentType } from './base/SEO'; @@ -44,7 +40,11 @@ type NewsPageProps = { function ComponentWrapper({ children, node }: ComponentContainerProps) { const { pa } = getPreviewUtils(node); - return
    {children}
    ; + return ( +
    + {children} +
    + ); } function News({ content }: NewsPageProps) { @@ -52,53 +52,43 @@ function News({ content }: NewsPageProps) { const { getAlt, getSrcset, isDamImageAsset } = damAssets(content); return ( -
    -
    -
    +
    +
    +
    {/* Main Content */} -
    +
    {/* Heading and Description */} -
    +

    {content.title}

    -

    +

    {content.description}

    {/* Main Body Content */} - + {/* Media Asset - handles images, videos, and files */} {isDamImageAsset(content.image) && ( -
    +
    {getAlt(content.image,
    )}
    -
    - +
    +
    diff --git a/templates/alloy-template/src/components/Product.tsx b/templates/alloy-template/src/components/Product.tsx index 7edb3bca..ce657a18 100644 --- a/templates/alloy-template/src/components/Product.tsx +++ b/templates/alloy-template/src/components/Product.tsx @@ -51,7 +51,7 @@ type ProductProps = { function ComponentWrapper({ children, node }: ComponentContainerProps) { const { pa } = getPreviewUtils(node); return ( -
    +
    {children}
    ); @@ -61,46 +61,36 @@ function Product({ content }: ProductProps) { const { pa } = getPreviewUtils(content); return ( -
    -
    -
    +
    +
    +
    {/* Main Content */} -
    +
    {/* Heading and Description */} -
    +

    {content.heading}

    -

    +

    {content.description}

    {/* Main Body Content */} - +
    {/* Sidebar */} -
    +
    {content.content_area?.map((contentItem, index) => { return ; })}
    -
    - +
    +
    diff --git a/templates/alloy-template/src/components/Standard.tsx b/templates/alloy-template/src/components/Standard.tsx index 37e1a8c8..a3b792a1 100644 --- a/templates/alloy-template/src/components/Standard.tsx +++ b/templates/alloy-template/src/components/Standard.tsx @@ -1,10 +1,6 @@ import { contentType, ContentProps } from '@optimizely/cms-sdk'; import { RichText } from '@optimizely/cms-sdk/react/richText'; -import { - ComponentContainerProps, - getPreviewUtils, - OptimizelyComposition, -} from '@optimizely/cms-sdk/react/server'; +import { ComponentContainerProps, getPreviewUtils, OptimizelyComposition } from '@optimizely/cms-sdk/react/server'; import { SEOContentType } from './base/SEO'; export const StandardContentType = contentType({ @@ -44,44 +40,38 @@ type StandardPageProps = { function ComponentWrapper({ children, node }: ComponentContainerProps) { const { pa } = getPreviewUtils(node); - return
    {children}
    ; + return ( +
    + {children} +
    + ); } function Standard({ content }: StandardPageProps) { const { pa } = getPreviewUtils(content); return ( -
    -
    -
    +
    +
    +
    {/* Heading and Description */} -
    +

    {content.heading}

    -

    +

    {content.description}

    {/* Main Body Content */} - + {/* section Area */} -
    - +
    +
    diff --git a/templates/alloy-template/src/components/Start.tsx b/templates/alloy-template/src/components/Start.tsx index b5126020..e84e039a 100644 --- a/templates/alloy-template/src/components/Start.tsx +++ b/templates/alloy-template/src/components/Start.tsx @@ -1,9 +1,5 @@ import { contentType, ContentProps } from '@optimizely/cms-sdk'; -import { - ComponentContainerProps, - getPreviewUtils, - OptimizelyComposition, -} from '@optimizely/cms-sdk/react/server'; +import { ComponentContainerProps, getPreviewUtils, OptimizelyComposition } from '@optimizely/cms-sdk/react/server'; import { ProductContentType } from './Product'; import { StandardContentType } from './Standard'; import { SEOContentType } from './base/SEO'; @@ -14,8 +10,7 @@ export const StartContentType = contentType({ displayName: 'Start Page', baseType: '_experience', mayContainTypes: [StandardContentType, ProductContentType], - description: - 'The StartPage content type represents the start page of the website.', + description: 'The StartPage content type represents the start page of the website.', properties: { // Content group image: { @@ -122,7 +117,11 @@ type StartProps = { function ComponentWrapper({ children, node }: ComponentContainerProps) { const { pa } = getPreviewUtils(node); - return
    {children}
    ; + return ( +
    + {children} +
    + ); } function Start({ content }: StartProps) { @@ -133,18 +132,18 @@ function Start({ content }: StartProps) {
    {/* Dark overlay for better text readability */} -
    +
    {/* Content */} -
    -
    +
    +
    {/* Large Heading */}

    {content.title}

    @@ -153,7 +152,7 @@ function Start({ content }: StartProps) { {content.description && (

    {content.description}

    @@ -167,13 +166,10 @@ function Start({ content }: StartProps) {
    -
    -
    -
    - +
    +
    +
    +
    diff --git a/templates/alloy-template/src/components/base/BlankSection.tsx b/templates/alloy-template/src/components/base/BlankSection.tsx index fd4716ac..228802bb 100644 --- a/templates/alloy-template/src/components/base/BlankSection.tsx +++ b/templates/alloy-template/src/components/base/BlankSection.tsx @@ -1,20 +1,16 @@ import { BlankSectionContentType, ContentProps } from '@optimizely/cms-sdk'; -import { - OptimizelyGridSection, - StructureContainerProps, - getPreviewUtils, -} from '@optimizely/cms-sdk/react/server'; +import { OptimizelyGridSection, StructureContainerProps, getPreviewUtils } from '@optimizely/cms-sdk/react/server'; type BlankSectionProps = { content: ContentProps; }; function Row({ children }: StructureContainerProps) { - return
    {children}
    ; + return
    {children}
    ; } function Column({ children }: StructureContainerProps) { - return
    {children}
    ; + return
    {children}
    ; } /** Defines a component to render a blank section */ diff --git a/templates/alloy-template/src/components/base/Button.tsx b/templates/alloy-template/src/components/base/Button.tsx index 01b3612b..2b057f24 100644 --- a/templates/alloy-template/src/components/base/Button.tsx +++ b/templates/alloy-template/src/components/base/Button.tsx @@ -5,8 +5,7 @@ export const ButtonContentType = contentType({ key: 'Button', displayName: 'Button', baseType: '_component', - description: - 'The Button content type represents a button component on the website.', + description: 'The Button content type represents a button component on the website.', properties: { link: { type: 'url', @@ -33,7 +32,7 @@ function Button({ content }: ButtonProps) { {content.text} diff --git a/templates/alloy-template/src/components/base/Contact.tsx b/templates/alloy-template/src/components/base/Contact.tsx index 3a15a8cc..f5680272 100644 --- a/templates/alloy-template/src/components/base/Contact.tsx +++ b/templates/alloy-template/src/components/base/Contact.tsx @@ -40,35 +40,27 @@ function Contact({ content }: ContactProps) { const { pa, src } = getPreviewUtils(content); const image = src(content.image); return ( -
    +
    {content.image?.url.default && ( -
    - {image ? ({`${content.name}'s):null} +
    + {image ? + {`${content.name}'s + : null}
    )} -
    -

    +
    +

    {content.name}

    -

    +

    {content.description}

    -
    +
    {content.email && ( {content.email} @@ -77,7 +69,7 @@ function Contact({ content }: ContactProps) { {content.phone} diff --git a/templates/alloy-template/src/components/base/ContentLayout.tsx b/templates/alloy-template/src/components/base/ContentLayout.tsx index e723e92e..8a82cc91 100644 --- a/templates/alloy-template/src/components/base/ContentLayout.tsx +++ b/templates/alloy-template/src/components/base/ContentLayout.tsx @@ -6,23 +6,20 @@ interface ContentLayoutProps { currentPath: string; } -export async function ContentLayout({ - content, - currentPath, -}: ContentLayoutProps) { +export async function ContentLayout({ content, currentPath }: ContentLayoutProps) { const showSidebar = currentPath.includes('about-us'); if (showSidebar) { return ( -
    -
    +
    +
    {/* Sidebar Navigation - Hidden on mobile, visible on md and up */} -
    @@ -31,7 +28,7 @@ export async function ContentLayout({ } return ( -
    +
    ); diff --git a/templates/alloy-template/src/components/base/Footer.tsx b/templates/alloy-template/src/components/base/Footer.tsx index 9d23de6b..a88700cd 100644 --- a/templates/alloy-template/src/components/base/Footer.tsx +++ b/templates/alloy-template/src/components/base/Footer.tsx @@ -31,20 +31,18 @@ async function Footer() { ]; return ( -