@contentful/experiences-validators 3.7.1 → 3.7.2-dev-20250924T1414-f20af61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -232,19 +232,6 @@ const ComponentVariableSchema = zod.z.object({
232
232
  });
233
233
  const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
234
234
  children: zod.z.lazy(() => ComponentTreeNodeSchema.array()),
235
- }).superRefine(({ id, prebindingId, parameters }, ctx) => {
236
- if (prebindingId && !parameters) {
237
- ctx.addIssue({
238
- code: zod.z.ZodIssueCode.custom,
239
- message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
240
- });
241
- }
242
- if (parameters && !prebindingId) {
243
- ctx.addIssue({
244
- code: zod.z.ZodIssueCode.custom,
245
- message: `Found "parameters" but no "prebindingId" for node with id: "${id}"`,
246
- });
247
- }
248
235
  });
249
236
  const ComponentTreeSchema = zod.z
250
237
  .object({
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/schemas/schemaVersions.ts","../src/schemas/v2023_09_28/common.ts","../src/schemas/v2023_09_28/experience.ts","../src/utils/treeVisit.ts","../src/schemas/v2023_09_28/pattern.ts","../src/schemas/componentDefinition.ts","../src/utils/zodToContentfulError.ts","../src/validators/validateBreakpointDefinitions.ts","../src/validators/validateComponentDefinition.ts","../src/validators/validatePatternFields.ts","../src/validators/validateExperienceFields.ts"],"sourcesContent":["import { z } from 'zod';\n// If more than one version is supported, use z.union\nexport const SchemaVersions = z.literal('2023-09-28');\n\nexport type SchemaVersions = z.infer<typeof SchemaVersions>;\n\n// Keep deprecated versions here just for reference\nexport const UnsupportedSchemaVersions = z.union([\n z.literal('2023-08-23'),\n z.literal('2023-07-26'),\n z.literal('2023-06-27'),\n]);\n","import { z, ZodTypeAny } from 'zod';\nimport { Breakpoint } from '@/schemas/v2023_09_28/experience';\nimport { SchemaVersions } from '@/schemas/schemaVersions';\n\nexport const DefinitionPropertyTypeSchema = z.enum([\n 'Text',\n 'RichText',\n 'Number',\n 'Date',\n 'Boolean',\n 'Location',\n 'Media',\n 'Object',\n 'Hyperlink',\n 'Array',\n 'Link',\n]);\n\nexport const DefinitionPropertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,32}$/, { message: 'Property needs to match: /^[a-zA-Z0-9-_]{1,32}$/' });\n\nexport const PrimitiveValueSchema = z.union([\n z.string(),\n z.boolean(),\n z.number(),\n z.record(z.any(), z.any()),\n z.undefined(),\n]);\n\nexport const UsedComponentsSchema = z.array(\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.literal('Entry'),\n }),\n }),\n);\n\nexport const uuidKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });\n\nexport const DataSourceSchema = z.record(\n uuidKeySchema,\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry', 'Asset']),\n }),\n }),\n);\n\nexport const UnboundValuesSchema = z.record(\n uuidKeySchema,\n z.object({\n value: PrimitiveValueSchema,\n }),\n);\n\n/**\n * Property keys for imported components have a limit of 32 characters (to be implemented) while\n * property keys for patterns have a limit of 54 characters (<32-char-variable-name>_<21-char-nanoid-id>).\n * Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.\n */\nexport const propertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });\n\nexport const ComponentTreeNodeIdSchema = z\n .string()\n .regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });\n\nexport const breakpointsRefinement = (value: Breakpoint[], ctx: z.RefinementCtx) => {\n if (!value.length || value[0].query !== '*') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The first breakpoint should include the following attributes: { \"query\": \"*\" }`,\n });\n return;\n }\n\n // Return early if there's only one generic breakpoint\n const hasNoBreakpointsStrategy = value.length === 1;\n if (hasNoBreakpointsStrategy) {\n return;\n }\n\n // Check if any breakpoint id occurs twice\n const ids = value.map((breakpoint) => breakpoint.id);\n const hasDuplicateIds = new Set(ids).size !== ids.length;\n if (hasDuplicateIds) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint IDs must be unique`,\n });\n return;\n }\n\n // Skip the first one which is guaranteed to be a wildcard query\n const nonBaseBreakpoints = value.slice(1);\n const isMobileFirstStrategy = nonBaseBreakpoints[0].query.startsWith('>');\n const isDesktopFirstStrategy = nonBaseBreakpoints[0].query.startsWith('<');\n\n if (isMobileFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('>'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \">[size]px\" for mobile-first strategy`,\n });\n }\n\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n\n // Starting with the third breakpoint, check that every query is higher than the one above\n const isIncreasing = queries.every(\n (value, index, array) => index === 0 || value > array[index - 1],\n );\n if (!isIncreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a mobile-first strategy, all breakpoints must have strictly increasing pixel values`,\n });\n }\n } else if (isDesktopFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('<'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \"<[size]px\" for desktop-first strategy`,\n });\n }\n\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n\n // Starting with the third breakpoint, check that every query is lower than the one above\n const isDecreasing = queries.every(\n (value, index, array) => index === 0 || value < array[index - 1],\n );\n if (!isDecreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a desktop-first strategy, all breakpoints must have strictly decreasing pixel values`,\n });\n }\n } else if (!isMobileFirstStrategy && !isDesktopFirstStrategy) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `You may only use a mobile-first or desktop-first strategy for breakpoints using '<' or '>' queries`,\n });\n }\n};\n\nexport const ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));\n\nexport const BindingSourceTypeEnumSchema = z\n .array(z.enum(['entry', 'asset', 'manual', 'experience']))\n .nonempty();\n\nexport const DesignValueSchema = z\n .object({\n type: z.literal('DesignValue'),\n valuesByBreakpoint: ValuesByBreakpointSchema,\n })\n .strict();\n\nexport const BoundValueSchema = z\n .object({\n type: z.literal('BoundValue'),\n path: z.string(),\n })\n .strict();\n\nexport const HyperlinkValueSchema = z\n .object({\n type: z.literal('HyperlinkValue'),\n linkTargetKey: z.string(),\n /** Allows to override parts of the URL, e.g. the locale */\n overrides: z.object({}).optional(),\n })\n .strict();\n\nexport const UnboundValueSchema = z\n .object({\n type: z.literal('UnboundValue'),\n key: z.string(),\n })\n .strict();\n\nexport const ComponentValueSchema = z\n .object({\n type: z.literal('ComponentValue'),\n key: z.string(),\n })\n .strict();\n\nexport const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();\n\nexport const ComponentPropertyValueSchema = z.discriminatedUnion('type', [\n DesignValueSchema,\n BoundValueSchema,\n UnboundValueSchema,\n HyperlinkValueSchema,\n ComponentValueSchema,\n NoValueSchema,\n]);\n\nexport type ComponentPropertyValue = z.infer<typeof ComponentPropertyValueSchema>;\n\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nexport const ParameterSchema = z.object({\n type: z.literal('BoundValue'),\n path: z.string(),\n});\n\nexport const ParametersSchema = z.record(propertyKeySchema, ParameterSchema);\n\ntype BreakpointQuery = '*' | `>${number}px` | `<${number}px`;\nconst BREAKPOINT_QUERY_REGEX = /^\\*$|^[<>][0-9]+px$/;\n\nexport const BreakpointSchema = z\n .object({\n id: propertyKeySchema,\n // Can be replace with z.templateLiteral when upgrading to zod v4\n query: z.string().refine((s): s is BreakpointQuery => BREAKPOINT_QUERY_REGEX.test(s)),\n previewSize: z.string().optional(),\n displayName: z.string(),\n displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),\n })\n .strict();\n\n// Use helper schema to define a recursive schema with its type correctly below\nconst BaseComponentTreeNodeSchema = z.object({\n id: ComponentTreeNodeIdSchema.optional(),\n definitionId: DefinitionPropertyKeySchema,\n prebindingId: z.string().optional(),\n displayName: z.string().optional(),\n slotId: z.string().optional(),\n variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),\n parameters: ParametersSchema.optional(),\n});\n\nexport type ComponentTreeNode = z.infer<typeof BaseComponentTreeNodeSchema> & {\n children: ComponentTreeNode[];\n};\n\nexport const ComponentVariableSchema = z.object({\n displayName: z.string().optional(),\n type: DefinitionPropertyTypeSchema,\n description: z.string().optional(),\n group: z.string().optional(),\n defaultValue: PrimitiveValueSchema.or(ComponentPropertyValueSchema).optional(),\n validations: z\n .object({\n bindingSourceType: BindingSourceTypeEnumSchema.optional(),\n required: z.boolean().optional(),\n format: z.literal('URL').optional(),\n in: z\n .array(\n z.object({\n value: z.union([z.string(), z.number()]),\n displayName: z.string().optional(),\n }),\n )\n .optional(),\n })\n .optional(),\n});\n\nexport const ComponentTreeNodeSchema: z.ZodType<ComponentTreeNode> =\n BaseComponentTreeNodeSchema.extend({\n children: z.lazy(() => ComponentTreeNodeSchema.array()),\n }).superRefine(({ id, prebindingId, parameters }, ctx) => {\n if (prebindingId && !parameters) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found \"prebindingId\" but no \"parameters\" for node with id: \"${id}\"`,\n });\n }\n\n if (parameters && !prebindingId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found \"parameters\" but no \"prebindingId\" for node with id: \"${id}\"`,\n });\n }\n });\n\nexport const ComponentTreeSchema = z\n .object({\n breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),\n children: z.array(ComponentTreeNodeSchema),\n schemaVersion: SchemaVersions,\n })\n .strict();\nexport const localeWrapper = (fieldSchema: ZodTypeAny) => z.record(z.string(), fieldSchema);\n","import { z } from 'zod';\nimport {\n BindingSourceTypeEnumSchema,\n BoundValueSchema,\n BreakpointSchema,\n breakpointsRefinement,\n ComponentTreeSchema,\n ComponentValueSchema,\n DataSourceSchema,\n DesignValueSchema,\n HyperlinkValueSchema,\n localeWrapper,\n NoValueSchema,\n ParameterSchema,\n PrimitiveValueSchema,\n UnboundValueSchema,\n UnboundValuesSchema,\n UsedComponentsSchema,\n ValuesByBreakpointSchema,\n} from './common';\n\nexport const ExperienceFieldsCMAShapeSchema = z.object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n});\n\nexport type ExperienceFields = z.infer<typeof ExperienceFieldsCMAShapeSchema>;\nexport type ExperienceDataSource = z.infer<typeof DataSourceSchema>;\nexport type ExperienceUnboundValues = z.infer<typeof UnboundValuesSchema>;\nexport type ExperienceUsedComponents = z.infer<typeof UsedComponentsSchema>;\nexport type ExperienceComponentTree = z.infer<typeof ComponentTreeSchema>;\nexport type ValuesByBreakpoint = z.infer<typeof ValuesByBreakpointSchema>;\nexport type Breakpoint = z.infer<typeof BreakpointSchema>;\nexport type PrimitiveValue = z.infer<typeof PrimitiveValueSchema>;\nexport type DesignValue = z.infer<typeof DesignValueSchema>;\nexport type BoundValue = z.infer<typeof BoundValueSchema>;\nexport type NoValue = z.infer<typeof NoValueSchema>;\nexport type UnboundValue = z.infer<typeof UnboundValueSchema>;\nexport type HyperlinkValue = z.infer<typeof HyperlinkValueSchema>;\nexport type ComponentValue = z.infer<typeof ComponentValueSchema>;\nexport type BindingSourceTypeEnum = z.infer<typeof BindingSourceTypeEnumSchema>;\nexport type Parameter = z.infer<typeof ParameterSchema>;\nexport { breakpointsRefinement };\n","type NodeWithChildren<T> = {\n children: T[];\n};\n\nexport function treeVisit<T extends NodeWithChildren<T>>(\n initialNode: T | T[],\n onNode: (node: T) => void,\n) {\n const _treeVisit = (currentNode: T): void => {\n const children = [...currentNode.children];\n onNode(currentNode);\n for (const child of children) {\n _treeVisit(child);\n }\n };\n if (Array.isArray(initialNode)) {\n for (const node of initialNode) {\n _treeVisit(node);\n }\n } else {\n _treeVisit(initialNode);\n }\n}\n","import { z } from 'zod';\nimport {\n ComponentTreeSchema,\n ComponentVariableSchema,\n DataSourceSchema,\n localeWrapper,\n propertyKeySchema,\n UnboundValuesSchema,\n UsedComponentsSchema,\n} from '../v2023_09_28/common';\nimport { treeVisit } from '@/utils/treeVisit';\n\nexport const MAX_ALLOWED_PATHS = 200;\n\nexport const THUMBNAIL_IDS = [\n 'columns',\n 'columnsPlusRight',\n 'imagesSquare',\n 'subtitles',\n 'rowsPlusBottom',\n 'userRectangle',\n 'textbox',\n 'monitorPlay',\n 'article',\n 'table',\n 'star',\n 'heartStraight',\n 'frameCorners',\n 'rows',\n 'dotsThreeOutline',\n 'listDashes',\n 'checkerBoard',\n 'gridFour',\n 'slideshow',\n 'diamondsFour',\n 'cards',\n 'textColumns',\n 'duplex',\n] as const;\n\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nconst VariableMappingSchema = z.object({\n parameterId: propertyKeySchema,\n type: z.literal('ContentTypeMapping'),\n pathsByContentType: z\n .record(z.string(), z.object({ path: z.string() }))\n .superRefine((paths, ctx) => {\n const variableId = ctx.path[ctx.path.length - 2];\n if (Object.keys(paths).length > MAX_ALLOWED_PATHS) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Too many paths defined for variable mapping with id \"${variableId}\", maximum allowed is ${MAX_ALLOWED_PATHS}`,\n });\n }\n }),\n});\n\nexport const PassToNodeSchema = z\n .object({\n nodeId: propertyKeySchema,\n parameterId: propertyKeySchema,\n prebindingId: propertyKeySchema,\n })\n .strict();\n\nconst ParameterDefinitionSchema = z.object({\n defaultSource: z\n .strictObject({\n type: z.enum(['Entry']),\n contentTypeId: z.string(),\n link: z.strictObject({\n sys: z.strictObject({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry']),\n }),\n }),\n })\n .optional(),\n contentTypes: z.array(z.string()).min(1),\n passToNodes: z\n .array(PassToNodeSchema)\n .max(1, 'At most one \"passToNodes\" element is allowed per parameter definition.')\n .optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)\n});\n\nexport const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);\n\nconst VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);\n\nexport const ComponentVariablesSchema = z.record(\n z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length\n ComponentVariableSchema,\n);\n\nexport const PrebindingDefinitionSchema = z\n .object({\n id: propertyKeySchema,\n parameterDefinitions: ParameterDefinitionsSchema,\n variableMappings: VariableMappingsSchema.optional(),\n allowedVariableOverrides: z.array(z.string()).optional(),\n })\n .strict();\n\nconst ComponentSettingsSchema = z\n .object({\n variableDefinitions: ComponentVariablesSchema,\n thumbnailId: z.enum(THUMBNAIL_IDS).optional(),\n category: z.string().max(50, 'Category must contain at most 50 characters').optional(),\n prebindingDefinitions: z.array(PrebindingDefinitionSchema).length(1).optional(),\n })\n .strict()\n .superRefine((componentSettings, ctx) => {\n const { variableDefinitions, prebindingDefinitions } = componentSettings;\n if (!prebindingDefinitions || prebindingDefinitions.length === 0) {\n return;\n }\n const { parameterDefinitions, variableMappings, allowedVariableOverrides } =\n prebindingDefinitions[0];\n\n validateAtMostOneNativeParameterDefinition(parameterDefinitions, ctx);\n validateNoOverlapBetweenMappingAndOverrides(variableMappings, allowedVariableOverrides, ctx);\n validateMappingsAgainstVariableDefinitions(\n variableMappings,\n allowedVariableOverrides,\n variableDefinitions,\n ctx,\n );\n validateMappingsAgainstParameterDefinitions(variableMappings, parameterDefinitions, ctx);\n });\n\nexport const PatternFieldsCMAShapeSchema = z\n .object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n componentSettings: localeWrapper(ComponentSettingsSchema),\n })\n .superRefine((patternFields, ctx) => {\n const { componentTree, componentSettings } = patternFields;\n\n // values at this point are wrapped under locale code\n const nonLocalisedComponentTree = Object.values(componentTree)[0];\n const nonLocalisedComponentSettings = Object.values(componentSettings)[0];\n\n if (!nonLocalisedComponentSettings || !nonLocalisedComponentTree) {\n return;\n }\n\n validatePassToNodes(\n nonLocalisedComponentTree.children || ([] as z.infer<typeof ComponentTreeSchema>['children']),\n nonLocalisedComponentSettings || ({} as PatternComponentSettings),\n ctx,\n );\n });\n\nconst validateAtMostOneNativeParameterDefinition = (\n parameterDefinitions: Record<string, ParameterDefinition>,\n ctx: z.RefinementCtx,\n) => {\n const nativeParamDefinitions = Object.values(parameterDefinitions).filter(\n (paramDefinition) => !(paramDefinition.passToNodes && paramDefinition.passToNodes.length > 0),\n );\n\n if (nativeParamDefinitions.length > 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Only one native parameter definition (parameter definition without passToNodes) is allowed per prebinding definition.`,\n });\n }\n};\n\nconst validateNoOverlapBetweenMappingAndOverrides = (\n variableMappings: VariableMappings | undefined,\n allowedVariableOverrides: string[] | undefined,\n ctx: z.RefinementCtx,\n) => {\n const variableMappingKeys = Object.keys(variableMappings || {});\n const overridesSet = new Set(allowedVariableOverrides || []);\n const overlap = variableMappingKeys.filter((key) => overridesSet.has(key));\n if (overlap.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found both variable mapping and allowed override for the following keys: ${overlap.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\n\nconst validateMappingsAgainstVariableDefinitions = (\n variableMappings: VariableMappings | undefined,\n allowedVariableOverrides: string[] | undefined,\n variableDefinitions: Record<string, z.infer<typeof ComponentVariableSchema>>,\n ctx: z.RefinementCtx,\n) => {\n const nonDesignVariableDefinitionKeys = Object.entries(variableDefinitions)\n .filter(([_, def]) => def.group !== 'style')\n .map(([key]) => key);\n\n const variableMappingKeys = Object.keys(variableMappings || {});\n\n const allKeys = [...variableMappingKeys, ...(allowedVariableOverrides || [])];\n const invalidMappings = allKeys.filter((key) => !nonDesignVariableDefinitionKeys.includes(key));\n if (invalidMappings.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following variable mappings or overrides are missing from the variable definitions: ${invalidMappings.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\n\nconst validateMappingsAgainstParameterDefinitions = (\n variableMappings: VariableMappings | undefined,\n parameterDefinitions: ParameterDefinitions,\n ctx: z.RefinementCtx,\n) => {\n const parameterDefinitionKeys = Object.keys(parameterDefinitions || {});\n for (const [mappingKey, mappingValue] of Object.entries(variableMappings || {})) {\n if (!parameterDefinitionKeys.includes(mappingValue.parameterId)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The variable mapping with id \"${mappingKey}\" references a non-existing parameterId \"${mappingValue.parameterId}\".`,\n });\n }\n }\n};\n\nconst validatePassToNodes = (\n rootChildren: z.infer<typeof ComponentTreeSchema>['children'],\n componentSettings: PatternComponentSettings,\n ctx: z.RefinementCtx,\n) => {\n if (\n !componentSettings.prebindingDefinitions ||\n componentSettings.prebindingDefinitions.length === 0\n ) {\n return;\n }\n const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];\n\n let nodeIds: Set<string> = new Set();\n for (const paramDef of Object.values(parameterDefinitions || {})) {\n paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));\n }\n\n treeVisit(rootChildren, (node) => {\n if (!node.id) return;\n if (nodeIds.has(node.id)) {\n nodeIds.delete(node.id);\n }\n });\n\n if (nodeIds.size > 0) {\n const stringifiedNodeIds = Array.from(nodeIds)\n .map((id) => `\"${id}\"`)\n .join(', ');\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following node IDs referenced in passToNodes are not present in the component tree: ${stringifiedNodeIds}.`,\n });\n }\n};\n\nexport type PatternFields = z.infer<typeof PatternFieldsCMAShapeSchema>;\nexport type ParameterDefinition = z.infer<typeof ParameterDefinitionSchema>;\nexport type ParameterDefinitions = z.infer<typeof ParameterDefinitionsSchema>;\nexport type VariableMapping = z.infer<typeof VariableMappingSchema>;\nexport type VariableMappings = z.infer<typeof VariableMappingsSchema>;\nexport type PatternComponentSettings = z.infer<typeof ComponentSettingsSchema>;\nexport type PrebindingDefinition = z.infer<typeof PrebindingDefinitionSchema>;\n","import { z } from 'zod';\nimport {\n ComponentVariableSchema,\n DefinitionPropertyKeySchema,\n DefinitionPropertyTypeSchema,\n PrimitiveValueSchema,\n} from './v2023_09_28/common';\n\nexport const ComponentDefinitionSchema = z\n .object({\n id: DefinitionPropertyKeySchema,\n name: z.string(),\n category: z.string().optional(),\n thumbnailUrl: z.string().optional(),\n thumbnailId: z.string().optional(),\n hyperlinkPattern: z.string().optional(),\n children: z.boolean().optional(),\n slots: z\n .record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))\n .optional(),\n builtInStyles: z.array(z.string()).optional(),\n tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),\n variables: z.record(\n DefinitionPropertyKeySchema,\n ComponentVariableSchema.extend({\n defaultValue: PrimitiveValueSchema.optional(),\n }).superRefine((val, ctx) => {\n switch (val.type) {\n case 'Array':\n if (typeof val.defaultValue !== 'undefined') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Array\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Boolean':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'boolean') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a boolean when type is \"Boolean\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Date':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Date\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Hyperlink':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Hyperlink\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Link':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Link\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Location':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Location\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Media':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Media\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Number':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'number') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a number when type is \"Number\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Object':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Object\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'RichText':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"RichText\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Text':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Text\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n }\n }),\n ),\n })\n .superRefine((val, ctx) => {\n if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,\n fatal: false,\n });\n }\n // Ensure that slots and variables don't use the same names\n if (val.variables && val.slots) {\n Object.keys(val.variables).forEach((name) => {\n if (val.slots![name]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Variable and slot cannot have the same name: ${name}`,\n fatal: false,\n });\n }\n });\n }\n });\n\nexport type ComponentDefinitionPropertyType = z.infer<typeof DefinitionPropertyTypeSchema>;\nexport type ComponentDefinitionType = z.infer<typeof ComponentDefinitionSchema>;\n","import { ZodIssueCode, ZodIssue, z } from 'zod';\n\nexport enum CodeNames {\n Type = 'type',\n Required = 'required',\n Unexpected = 'unexpected',\n Regex = 'regex',\n In = 'in',\n Size = 'size',\n Custom = 'custom',\n}\n\nexport type ContentfulErrorDetails = {\n details: string;\n min?: number | bigint;\n max?: number | bigint;\n name: (typeof CodeNames)[keyof typeof CodeNames];\n path: (string | number)[];\n value?: string;\n expected?: (string | number)[];\n};\n\nconst convertInvalidType = (issue: z.ZodInvalidTypeIssue): ContentfulErrorDetails => {\n const name = issue.received === 'undefined' ? CodeNames.Required : CodeNames.Type;\n const details =\n issue.received === 'undefined'\n ? `The property \"${issue.path.slice(-1)}\" is required here`\n : `The type of \"${issue.path.slice(-1)}\" is incorrect, expected type: ${issue.expected}`;\n\n return {\n details: details,\n name: name,\n path: issue.path,\n value: issue.received.toString(),\n };\n};\n\nconst convertUnrecognizedKeys = (issue: z.ZodUnrecognizedKeysIssue): ContentfulErrorDetails => {\n const missingProperties = issue.keys.map((k) => `\"${k}\"`).join(', ');\n return {\n details:\n issue.keys.length > 1\n ? `The properties ${missingProperties} are not expected`\n : `The property ${missingProperties} is not expected`,\n name: CodeNames.Unexpected,\n path: issue.path,\n };\n};\n\nconst convertInvalidString = (issue: z.ZodInvalidStringIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Invalid string',\n name: issue.validation === 'regex' ? CodeNames.Regex : CodeNames.Unexpected,\n path: issue.path,\n };\n};\nconst convertInvalidEnumValue = (issue: z.ZodInvalidEnumValueIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received.toString(),\n expected: issue.options,\n };\n};\nconst convertInvalidLiteral = (issue: z.ZodInvalidLiteralIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received as string,\n expected: [issue.expected as string],\n };\n};\n\nconst convertTooBig = (issue: z.ZodTooBigIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || `Size should be at most ${issue.maximum}`,\n name: CodeNames.Size,\n path: issue.path,\n max: issue.maximum,\n };\n};\n\nconst convertTooSmall = (issue: z.ZodTooSmallIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || `Size should be at least ${issue.minimum}`,\n name: CodeNames.Size,\n path: issue.path,\n min: issue.minimum,\n };\n};\nconst defaultConversion = (issue: ZodIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'An unexpected error occurred',\n name: CodeNames.Custom,\n path: issue.path.map(String),\n };\n};\n\nexport const zodToContentfulError = (issue: ZodIssue): ContentfulErrorDetails => {\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n return convertInvalidType(issue);\n case ZodIssueCode.unrecognized_keys:\n return convertUnrecognizedKeys(issue);\n case ZodIssueCode.invalid_enum_value:\n return convertInvalidEnumValue(issue);\n case ZodIssueCode.invalid_string:\n return convertInvalidString(issue);\n case ZodIssueCode.too_small:\n return convertTooSmall(issue);\n case ZodIssueCode.too_big:\n return convertTooBig(issue);\n case ZodIssueCode.invalid_literal:\n return convertInvalidLiteral(issue);\n default:\n return defaultConversion(issue);\n }\n};\n","import { z } from 'zod';\nimport { Breakpoint, BreakpointSchema, breakpointsRefinement } from '../schemas/latest';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { zodToContentfulError } from '@/utils/zodToContentfulError';\n\nexport const validateBreakpointsDefinition = (breakpoints: Breakpoint[]): ValidatorReturnValue => {\n const result = z\n .array(BreakpointSchema)\n .superRefine(breakpointsRefinement)\n .safeParse(breakpoints);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { ComponentDefinitionSchema } from '../schemas';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { zodToContentfulError } from '../utils/zodToContentfulError';\n\nexport const validateComponentDefinition = (definition): ValidatorReturnValue => {\n const result = ComponentDefinitionSchema.safeParse(definition);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { type SchemaVersions } from '../types';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { PatternSchema_2023_09_28 } from '../schemas';\nimport { zodToContentfulError, CodeNames } from '@/utils/zodToContentfulError';\n\nconst VERSION_SCHEMAS = {\n '2023-09-28': PatternSchema_2023_09_28,\n};\n\n/**\n *\n * @param pattern The pattern entry to validate\n * @param schemaVersionOverride Optional override for the schema version to validate against.\n * By default, the schema version is read from the pattern entry\n * @returns object with success property and optional errors array\n */\nexport const validatePatternFields = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- matches KeyValueMap in EntryProps['fields']\n pattern: { fields: Record<string, any> },\n schemaVersionOverride?: SchemaVersions,\n): ValidatorReturnValue => {\n let schemaVersion: SchemaVersions | undefined;\n\n if (schemaVersionOverride) {\n schemaVersion = schemaVersionOverride;\n } else if (pattern.fields.componentTree) {\n const locale = Object.keys(pattern.fields.componentTree)[0];\n schemaVersion = pattern.fields.componentTree[locale].schemaVersion;\n }\n\n const schema = schemaVersion && VERSION_SCHEMAS[schemaVersion];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n name: schemaVersion ? CodeNames.In : CodeNames.Required,\n expected: Object.keys(VERSION_SCHEMAS),\n value: schemaVersion,\n path: ['fields', 'componentTree', 'schemaVersion'],\n details: schemaVersion\n ? 'Unsupported schema version'\n : 'The property \"schemaVersion\" is required here',\n },\n ],\n };\n }\n\n const fieldsToValidate = {\n componentTree: pattern.fields.componentTree,\n dataSource: pattern.fields.dataSource,\n unboundValues: pattern.fields.unboundValues,\n usedComponents: pattern.fields.usedComponents,\n componentSettings: pattern.fields.componentSettings,\n };\n\n const result = schema.safeParse(fieldsToValidate);\n if (!result.success) {\n return {\n success: result.success,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { type SchemaVersions } from '../types';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { ExperienceSchema_2023_09_28 } from '../schemas';\nimport { zodToContentfulError, CodeNames } from '@/utils/zodToContentfulError';\nimport { validatePatternFields } from '@/validators/validatePatternFields';\n\nconst VERSION_SCHEMAS = {\n '2023-09-28': ExperienceSchema_2023_09_28,\n};\n\n// TODO: fix typing when the Entry type is exposed\nfunction isPattern(experience: any): boolean {\n return experience.fields.componentSettings !== undefined;\n}\n\n/**\n *\n * @param experience The experience entry to validate\n * @param schemaVersionOverride Optional override for the schema version to validate against.\n * By default, the schema version is read from the experience entry\n * @returns object with success property and optional errors array\n */\nexport const validateExperienceFields = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- matches KeyValueMap in EntryProps['fields']\n experience: { fields: Record<string, any> },\n schemaVersionOverride?: SchemaVersions,\n): ValidatorReturnValue => {\n // If this is a pattern, use the pattern validator\n if (isPattern(experience)) {\n return validatePatternFields(experience, schemaVersionOverride);\n }\n\n let schemaVersion: SchemaVersions | undefined;\n if (schemaVersionOverride) {\n schemaVersion = schemaVersionOverride;\n } else if (experience.fields.componentTree) {\n const locale = Object.keys(experience.fields.componentTree)[0];\n schemaVersion = experience.fields.componentTree[locale].schemaVersion;\n }\n\n const schema = schemaVersion && VERSION_SCHEMAS[schemaVersion];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n name: schemaVersion ? CodeNames.In : CodeNames.Required,\n expected: ['2023-09-28'],\n value: schemaVersion,\n path: ['fields', 'componentTree', 'schemaVersion'],\n details: schemaVersion\n ? 'Unsupported schema version'\n : 'The property \"schemaVersion\" is required here',\n },\n ],\n };\n }\n\n const fieldsToValidate = {\n componentTree: experience.fields.componentTree,\n dataSource: experience.fields.dataSource,\n unboundValues: experience.fields.unboundValues,\n usedComponents: experience.fields.usedComponents,\n };\n\n const result = schema.safeParse(fieldsToValidate);\n if (!result.success) {\n return {\n success: result.success,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n"],"names":["z","ZodIssueCode","VERSION_SCHEMAS","PatternSchema_2023_09_28","ExperienceSchema_2023_09_28"],"mappings":";;;;AACA;AACO,MAAM,cAAc,GAAGA,KAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAItD;AACyCA,KAAC,CAAC,KAAK,CAAC;AAC/C,IAAAA,KAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IA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BAAA,IAAI,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,eAAe,CAAC;AAClD,oBAAA,OAAO,EAAE,aAAa;AACpB,0BAAE,4BAA4B;AAC9B,0BAAE,+CAA+C;AACpD,iBAAA;AACF,aAAA;SACF,CAAC;KACH;AAED,IAAA,MAAM,gBAAgB,GAAG;AACvB,QAAA,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,aAAa;AAC9C,QAAA,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,UAAU;AACxC,QAAA,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,aAAa;AAC9C,QAAA,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,cAAc;KACjD,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAClD,IAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;SACtD,CAAC;KACH;AACD,IAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/schemas/schemaVersions.ts","../src/schemas/v2023_09_28/common.ts","../src/schemas/v2023_09_28/experience.ts","../src/utils/treeVisit.ts","../src/schemas/v2023_09_28/pattern.ts","../src/schemas/componentDefinition.ts","../src/utils/zodToContentfulError.ts","../src/validators/validateBreakpointDefinitions.ts","../src/validators/validateComponentDefinition.ts","../src/validators/validatePatternFields.ts","../src/validators/validateExperienceFields.ts"],"sourcesContent":["import { z } from 'zod';\n// If more than one version is supported, use z.union\nexport const SchemaVersions = z.literal('2023-09-28');\n\nexport type SchemaVersions = z.infer<typeof SchemaVersions>;\n\n// Keep deprecated versions here just for reference\nexport const UnsupportedSchemaVersions = z.union([\n z.literal('2023-08-23'),\n z.literal('2023-07-26'),\n z.literal('2023-06-27'),\n]);\n","import { z, ZodTypeAny } from 'zod';\nimport { Breakpoint } from '@/schemas/v2023_09_28/experience';\nimport { SchemaVersions } from '@/schemas/schemaVersions';\n\nexport const DefinitionPropertyTypeSchema = z.enum([\n 'Text',\n 'RichText',\n 'Number',\n 'Date',\n 'Boolean',\n 'Location',\n 'Media',\n 'Object',\n 'Hyperlink',\n 'Array',\n 'Link',\n]);\n\nexport const DefinitionPropertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,32}$/, { message: 'Property needs to match: /^[a-zA-Z0-9-_]{1,32}$/' });\n\nexport const PrimitiveValueSchema = z.union([\n z.string(),\n z.boolean(),\n z.number(),\n z.record(z.any(), z.any()),\n z.undefined(),\n]);\n\nexport const UsedComponentsSchema = z.array(\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.literal('Entry'),\n }),\n }),\n);\n\nexport const uuidKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });\n\nexport const DataSourceSchema = z.record(\n uuidKeySchema,\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry', 'Asset']),\n }),\n }),\n);\n\nexport const UnboundValuesSchema = z.record(\n uuidKeySchema,\n z.object({\n value: PrimitiveValueSchema,\n }),\n);\n\n/**\n * Property keys for imported components have a limit of 32 characters (to be implemented) while\n * property keys for patterns have a limit of 54 characters (<32-char-variable-name>_<21-char-nanoid-id>).\n * Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.\n */\nexport const propertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });\n\nexport const ComponentTreeNodeIdSchema = z\n .string()\n .regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });\n\nexport const breakpointsRefinement = (value: Breakpoint[], ctx: z.RefinementCtx) => {\n if (!value.length || value[0].query !== '*') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The first breakpoint should include the following attributes: { \"query\": \"*\" }`,\n });\n return;\n }\n\n // Return early if there's only one generic breakpoint\n const hasNoBreakpointsStrategy = value.length === 1;\n if (hasNoBreakpointsStrategy) {\n return;\n }\n\n // Check if any breakpoint id occurs twice\n const ids = value.map((breakpoint) => breakpoint.id);\n const hasDuplicateIds = new Set(ids).size !== ids.length;\n if (hasDuplicateIds) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint IDs must be unique`,\n });\n return;\n }\n\n // Skip the first one which is guaranteed to be a wildcard query\n const nonBaseBreakpoints = value.slice(1);\n const isMobileFirstStrategy = nonBaseBreakpoints[0].query.startsWith('>');\n const isDesktopFirstStrategy = nonBaseBreakpoints[0].query.startsWith('<');\n\n if (isMobileFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('>'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \">[size]px\" for mobile-first strategy`,\n });\n }\n\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n\n // Starting with the third breakpoint, check that every query is higher than the one above\n const isIncreasing = queries.every(\n (value, index, array) => index === 0 || value > array[index - 1],\n );\n if (!isIncreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a mobile-first strategy, all breakpoints must have strictly increasing pixel values`,\n });\n }\n } else if (isDesktopFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('<'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \"<[size]px\" for desktop-first strategy`,\n });\n }\n\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n\n // Starting with the third breakpoint, check that every query is lower than the one above\n const isDecreasing = queries.every(\n (value, index, array) => index === 0 || value < array[index - 1],\n );\n if (!isDecreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a desktop-first strategy, all breakpoints must have strictly decreasing pixel values`,\n });\n }\n } else if (!isMobileFirstStrategy && !isDesktopFirstStrategy) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `You may only use a mobile-first or desktop-first strategy for breakpoints using '<' or '>' queries`,\n });\n }\n};\n\nexport const ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));\n\nexport const BindingSourceTypeEnumSchema = z\n .array(z.enum(['entry', 'asset', 'manual', 'experience']))\n .nonempty();\n\nexport const DesignValueSchema = z\n .object({\n type: z.literal('DesignValue'),\n valuesByBreakpoint: ValuesByBreakpointSchema,\n })\n .strict();\n\nexport const BoundValueSchema = z\n .object({\n type: z.literal('BoundValue'),\n path: z.string(),\n })\n .strict();\n\nexport const HyperlinkValueSchema = z\n .object({\n type: z.literal('HyperlinkValue'),\n linkTargetKey: z.string(),\n /** Allows to override parts of the URL, e.g. the locale */\n overrides: z.object({}).optional(),\n })\n .strict();\n\nexport const UnboundValueSchema = z\n .object({\n type: z.literal('UnboundValue'),\n key: z.string(),\n })\n .strict();\n\nexport const ComponentValueSchema = z\n .object({\n type: z.literal('ComponentValue'),\n key: z.string(),\n })\n .strict();\n\nexport const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();\n\nexport const ComponentPropertyValueSchema = z.discriminatedUnion('type', [\n DesignValueSchema,\n BoundValueSchema,\n UnboundValueSchema,\n HyperlinkValueSchema,\n ComponentValueSchema,\n NoValueSchema,\n]);\n\nexport type ComponentPropertyValue = z.infer<typeof ComponentPropertyValueSchema>;\n\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nexport const ParameterSchema = z.object({\n type: z.literal('BoundValue'),\n path: z.string(),\n});\n\nexport const ParametersSchema = z.record(propertyKeySchema, ParameterSchema);\n\ntype BreakpointQuery = '*' | `>${number}px` | `<${number}px`;\nconst BREAKPOINT_QUERY_REGEX = /^\\*$|^[<>][0-9]+px$/;\n\nexport const BreakpointSchema = z\n .object({\n id: propertyKeySchema,\n // Can be replace with z.templateLiteral when upgrading to zod v4\n query: z.string().refine((s): s is BreakpointQuery => BREAKPOINT_QUERY_REGEX.test(s)),\n previewSize: z.string().optional(),\n displayName: z.string(),\n displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),\n })\n .strict();\n\n// Use helper schema to define a recursive schema with its type correctly below\nconst BaseComponentTreeNodeSchema = z.object({\n id: ComponentTreeNodeIdSchema.optional(),\n definitionId: DefinitionPropertyKeySchema,\n prebindingId: z.string().optional(),\n displayName: z.string().optional(),\n slotId: z.string().optional(),\n variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),\n parameters: ParametersSchema.optional(),\n});\n\nexport type ComponentTreeNode = z.infer<typeof BaseComponentTreeNodeSchema> & {\n children: ComponentTreeNode[];\n};\n\nexport const ComponentVariableSchema = z.object({\n displayName: z.string().optional(),\n type: DefinitionPropertyTypeSchema,\n description: z.string().optional(),\n group: z.string().optional(),\n defaultValue: PrimitiveValueSchema.or(ComponentPropertyValueSchema).optional(),\n validations: z\n .object({\n bindingSourceType: BindingSourceTypeEnumSchema.optional(),\n required: z.boolean().optional(),\n format: z.literal('URL').optional(),\n in: z\n .array(\n z.object({\n value: z.union([z.string(), z.number()]),\n displayName: z.string().optional(),\n }),\n )\n .optional(),\n })\n .optional(),\n});\n\nexport const ComponentTreeNodeSchema: z.ZodType<ComponentTreeNode> =\n BaseComponentTreeNodeSchema.extend({\n children: z.lazy(() => ComponentTreeNodeSchema.array()),\n });\n\nexport const ComponentTreeSchema = z\n .object({\n breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),\n children: z.array(ComponentTreeNodeSchema),\n schemaVersion: SchemaVersions,\n })\n .strict();\nexport const localeWrapper = (fieldSchema: ZodTypeAny) => z.record(z.string(), fieldSchema);\n","import { z } from 'zod';\nimport {\n BindingSourceTypeEnumSchema,\n BoundValueSchema,\n BreakpointSchema,\n breakpointsRefinement,\n ComponentTreeSchema,\n ComponentValueSchema,\n DataSourceSchema,\n DesignValueSchema,\n HyperlinkValueSchema,\n localeWrapper,\n NoValueSchema,\n ParameterSchema,\n PrimitiveValueSchema,\n UnboundValueSchema,\n UnboundValuesSchema,\n UsedComponentsSchema,\n ValuesByBreakpointSchema,\n} from './common';\n\nexport const ExperienceFieldsCMAShapeSchema = z.object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n});\n\nexport type ExperienceFields = z.infer<typeof ExperienceFieldsCMAShapeSchema>;\nexport type ExperienceDataSource = z.infer<typeof DataSourceSchema>;\nexport type ExperienceUnboundValues = z.infer<typeof UnboundValuesSchema>;\nexport type ExperienceUsedComponents = z.infer<typeof UsedComponentsSchema>;\nexport type ExperienceComponentTree = z.infer<typeof ComponentTreeSchema>;\nexport type ValuesByBreakpoint = z.infer<typeof ValuesByBreakpointSchema>;\nexport type Breakpoint = z.infer<typeof BreakpointSchema>;\nexport type PrimitiveValue = z.infer<typeof PrimitiveValueSchema>;\nexport type DesignValue = z.infer<typeof DesignValueSchema>;\nexport type BoundValue = z.infer<typeof BoundValueSchema>;\nexport type NoValue = z.infer<typeof NoValueSchema>;\nexport type UnboundValue = z.infer<typeof UnboundValueSchema>;\nexport type HyperlinkValue = z.infer<typeof HyperlinkValueSchema>;\nexport type ComponentValue = z.infer<typeof ComponentValueSchema>;\nexport type BindingSourceTypeEnum = z.infer<typeof BindingSourceTypeEnumSchema>;\nexport type Parameter = z.infer<typeof ParameterSchema>;\nexport { breakpointsRefinement };\n","type NodeWithChildren<T> = {\n children: T[];\n};\n\nexport function treeVisit<T extends NodeWithChildren<T>>(\n initialNode: T | T[],\n onNode: (node: T) => void,\n) {\n const _treeVisit = (currentNode: T): void => {\n const children = [...currentNode.children];\n onNode(currentNode);\n for (const child of children) {\n _treeVisit(child);\n }\n };\n if (Array.isArray(initialNode)) {\n for (const node of initialNode) {\n _treeVisit(node);\n }\n } else {\n _treeVisit(initialNode);\n }\n}\n","import { z } from 'zod';\nimport {\n ComponentTreeSchema,\n ComponentVariableSchema,\n DataSourceSchema,\n localeWrapper,\n propertyKeySchema,\n UnboundValuesSchema,\n UsedComponentsSchema,\n} from '../v2023_09_28/common';\nimport { treeVisit } from '@/utils/treeVisit';\n\nexport const MAX_ALLOWED_PATHS = 200;\n\nexport const THUMBNAIL_IDS = [\n 'columns',\n 'columnsPlusRight',\n 'imagesSquare',\n 'subtitles',\n 'rowsPlusBottom',\n 'userRectangle',\n 'textbox',\n 'monitorPlay',\n 'article',\n 'table',\n 'star',\n 'heartStraight',\n 'frameCorners',\n 'rows',\n 'dotsThreeOutline',\n 'listDashes',\n 'checkerBoard',\n 'gridFour',\n 'slideshow',\n 'diamondsFour',\n 'cards',\n 'textColumns',\n 'duplex',\n] as const;\n\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nconst VariableMappingSchema = z.object({\n parameterId: propertyKeySchema,\n type: z.literal('ContentTypeMapping'),\n pathsByContentType: z\n .record(z.string(), z.object({ path: z.string() }))\n .superRefine((paths, ctx) => {\n const variableId = ctx.path[ctx.path.length - 2];\n if (Object.keys(paths).length > MAX_ALLOWED_PATHS) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Too many paths defined for variable mapping with id \"${variableId}\", maximum allowed is ${MAX_ALLOWED_PATHS}`,\n });\n }\n }),\n});\n\nexport const PassToNodeSchema = z\n .object({\n nodeId: propertyKeySchema,\n parameterId: propertyKeySchema,\n prebindingId: propertyKeySchema,\n })\n .strict();\n\nconst ParameterDefinitionSchema = z.object({\n defaultSource: z\n .strictObject({\n type: z.enum(['Entry']),\n contentTypeId: z.string(),\n link: z.strictObject({\n sys: z.strictObject({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry']),\n }),\n }),\n })\n .optional(),\n contentTypes: z.array(z.string()).min(1),\n passToNodes: z\n .array(PassToNodeSchema)\n .max(1, 'At most one \"passToNodes\" element is allowed per parameter definition.')\n .optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)\n});\n\nexport const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);\n\nconst VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);\n\nexport const ComponentVariablesSchema = z.record(\n z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length\n ComponentVariableSchema,\n);\n\nexport const PrebindingDefinitionSchema = z\n .object({\n id: propertyKeySchema,\n parameterDefinitions: ParameterDefinitionsSchema,\n variableMappings: VariableMappingsSchema.optional(),\n allowedVariableOverrides: z.array(z.string()).optional(),\n })\n .strict();\n\nconst ComponentSettingsSchema = z\n .object({\n variableDefinitions: ComponentVariablesSchema,\n thumbnailId: z.enum(THUMBNAIL_IDS).optional(),\n category: z.string().max(50, 'Category must contain at most 50 characters').optional(),\n prebindingDefinitions: z.array(PrebindingDefinitionSchema).length(1).optional(),\n })\n .strict()\n .superRefine((componentSettings, ctx) => {\n const { variableDefinitions, prebindingDefinitions } = componentSettings;\n if (!prebindingDefinitions || prebindingDefinitions.length === 0) {\n return;\n }\n const { parameterDefinitions, variableMappings, allowedVariableOverrides } =\n prebindingDefinitions[0];\n\n validateAtMostOneNativeParameterDefinition(parameterDefinitions, ctx);\n validateNoOverlapBetweenMappingAndOverrides(variableMappings, allowedVariableOverrides, ctx);\n validateMappingsAgainstVariableDefinitions(\n variableMappings,\n allowedVariableOverrides,\n variableDefinitions,\n ctx,\n );\n validateMappingsAgainstParameterDefinitions(variableMappings, parameterDefinitions, ctx);\n });\n\nexport const PatternFieldsCMAShapeSchema = z\n .object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n componentSettings: localeWrapper(ComponentSettingsSchema),\n })\n .superRefine((patternFields, ctx) => {\n const { componentTree, componentSettings } = patternFields;\n\n // values at this point are wrapped under locale code\n const nonLocalisedComponentTree = Object.values(componentTree)[0];\n const nonLocalisedComponentSettings = Object.values(componentSettings)[0];\n\n if (!nonLocalisedComponentSettings || !nonLocalisedComponentTree) {\n return;\n }\n\n validatePassToNodes(\n nonLocalisedComponentTree.children || ([] as z.infer<typeof ComponentTreeSchema>['children']),\n nonLocalisedComponentSettings || ({} as PatternComponentSettings),\n ctx,\n );\n });\n\nconst validateAtMostOneNativeParameterDefinition = (\n parameterDefinitions: Record<string, ParameterDefinition>,\n ctx: z.RefinementCtx,\n) => {\n const nativeParamDefinitions = Object.values(parameterDefinitions).filter(\n (paramDefinition) => !(paramDefinition.passToNodes && paramDefinition.passToNodes.length > 0),\n );\n\n if (nativeParamDefinitions.length > 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Only one native parameter definition (parameter definition without passToNodes) is allowed per prebinding definition.`,\n });\n }\n};\n\nconst validateNoOverlapBetweenMappingAndOverrides = (\n variableMappings: VariableMappings | undefined,\n allowedVariableOverrides: string[] | undefined,\n ctx: z.RefinementCtx,\n) => {\n const variableMappingKeys = Object.keys(variableMappings || {});\n const overridesSet = new Set(allowedVariableOverrides || []);\n const overlap = variableMappingKeys.filter((key) => overridesSet.has(key));\n if (overlap.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found both variable mapping and allowed override for the following keys: ${overlap.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\n\nconst validateMappingsAgainstVariableDefinitions = (\n variableMappings: VariableMappings | undefined,\n allowedVariableOverrides: string[] | undefined,\n variableDefinitions: Record<string, z.infer<typeof ComponentVariableSchema>>,\n ctx: z.RefinementCtx,\n) => {\n const nonDesignVariableDefinitionKeys = Object.entries(variableDefinitions)\n .filter(([_, def]) => def.group !== 'style')\n .map(([key]) => key);\n\n const variableMappingKeys = Object.keys(variableMappings || {});\n\n const allKeys = [...variableMappingKeys, ...(allowedVariableOverrides || [])];\n const invalidMappings = allKeys.filter((key) => !nonDesignVariableDefinitionKeys.includes(key));\n if (invalidMappings.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following variable mappings or overrides are missing from the variable definitions: ${invalidMappings.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\n\nconst validateMappingsAgainstParameterDefinitions = (\n variableMappings: VariableMappings | undefined,\n parameterDefinitions: ParameterDefinitions,\n ctx: z.RefinementCtx,\n) => {\n const parameterDefinitionKeys = Object.keys(parameterDefinitions || {});\n for (const [mappingKey, mappingValue] of Object.entries(variableMappings || {})) {\n if (!parameterDefinitionKeys.includes(mappingValue.parameterId)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The variable mapping with id \"${mappingKey}\" references a non-existing parameterId \"${mappingValue.parameterId}\".`,\n });\n }\n }\n};\n\nconst validatePassToNodes = (\n rootChildren: z.infer<typeof ComponentTreeSchema>['children'],\n componentSettings: PatternComponentSettings,\n ctx: z.RefinementCtx,\n) => {\n if (\n !componentSettings.prebindingDefinitions ||\n componentSettings.prebindingDefinitions.length === 0\n ) {\n return;\n }\n const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];\n\n let nodeIds: Set<string> = new Set();\n for (const paramDef of Object.values(parameterDefinitions || {})) {\n paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));\n }\n\n treeVisit(rootChildren, (node) => {\n if (!node.id) return;\n if (nodeIds.has(node.id)) {\n nodeIds.delete(node.id);\n }\n });\n\n if (nodeIds.size > 0) {\n const stringifiedNodeIds = Array.from(nodeIds)\n .map((id) => `\"${id}\"`)\n .join(', ');\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following node IDs referenced in passToNodes are not present in the component tree: ${stringifiedNodeIds}.`,\n });\n }\n};\n\nexport type PatternFields = z.infer<typeof PatternFieldsCMAShapeSchema>;\nexport type ParameterDefinition = z.infer<typeof ParameterDefinitionSchema>;\nexport type ParameterDefinitions = z.infer<typeof ParameterDefinitionsSchema>;\nexport type VariableMapping = z.infer<typeof VariableMappingSchema>;\nexport type VariableMappings = z.infer<typeof VariableMappingsSchema>;\nexport type PatternComponentSettings = z.infer<typeof ComponentSettingsSchema>;\nexport type PrebindingDefinition = z.infer<typeof PrebindingDefinitionSchema>;\n","import { z } from 'zod';\nimport {\n ComponentVariableSchema,\n DefinitionPropertyKeySchema,\n DefinitionPropertyTypeSchema,\n PrimitiveValueSchema,\n} from './v2023_09_28/common';\n\nexport const ComponentDefinitionSchema = z\n .object({\n id: DefinitionPropertyKeySchema,\n name: z.string(),\n category: z.string().optional(),\n thumbnailUrl: z.string().optional(),\n thumbnailId: z.string().optional(),\n hyperlinkPattern: z.string().optional(),\n children: z.boolean().optional(),\n slots: z\n .record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))\n .optional(),\n builtInStyles: z.array(z.string()).optional(),\n tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),\n variables: z.record(\n DefinitionPropertyKeySchema,\n ComponentVariableSchema.extend({\n defaultValue: PrimitiveValueSchema.optional(),\n }).superRefine((val, ctx) => {\n switch (val.type) {\n case 'Array':\n if (typeof val.defaultValue !== 'undefined') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Array\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Boolean':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'boolean') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a boolean when type is \"Boolean\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Date':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Date\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Hyperlink':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Hyperlink\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Link':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Link\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Location':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Location\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Media':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Media\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Number':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'number') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a number when type is \"Number\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Object':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Object\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'RichText':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"RichText\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Text':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Text\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n }\n }),\n ),\n })\n .superRefine((val, ctx) => {\n if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,\n fatal: false,\n });\n }\n // Ensure that slots and variables don't use the same names\n if (val.variables && val.slots) {\n Object.keys(val.variables).forEach((name) => {\n if (val.slots![name]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Variable and slot cannot have the same name: ${name}`,\n fatal: false,\n });\n }\n });\n }\n });\n\nexport type ComponentDefinitionPropertyType = z.infer<typeof DefinitionPropertyTypeSchema>;\nexport type ComponentDefinitionType = z.infer<typeof ComponentDefinitionSchema>;\n","import { ZodIssueCode, ZodIssue, z } from 'zod';\n\nexport enum CodeNames {\n Type = 'type',\n Required = 'required',\n Unexpected = 'unexpected',\n Regex = 'regex',\n In = 'in',\n Size = 'size',\n Custom = 'custom',\n}\n\nexport type ContentfulErrorDetails = {\n details: string;\n min?: number | bigint;\n max?: number | bigint;\n name: (typeof CodeNames)[keyof typeof CodeNames];\n path: (string | number)[];\n value?: string;\n expected?: (string | number)[];\n};\n\nconst convertInvalidType = (issue: z.ZodInvalidTypeIssue): ContentfulErrorDetails => {\n const name = issue.received === 'undefined' ? CodeNames.Required : CodeNames.Type;\n const details =\n issue.received === 'undefined'\n ? `The property \"${issue.path.slice(-1)}\" is required here`\n : `The type of \"${issue.path.slice(-1)}\" is incorrect, expected type: ${issue.expected}`;\n\n return {\n details: details,\n name: name,\n path: issue.path,\n value: issue.received.toString(),\n };\n};\n\nconst convertUnrecognizedKeys = (issue: z.ZodUnrecognizedKeysIssue): ContentfulErrorDetails => {\n const missingProperties = issue.keys.map((k) => `\"${k}\"`).join(', ');\n return {\n details:\n issue.keys.length > 1\n ? `The properties ${missingProperties} are not expected`\n : `The property ${missingProperties} is not expected`,\n name: CodeNames.Unexpected,\n path: issue.path,\n };\n};\n\nconst convertInvalidString = (issue: z.ZodInvalidStringIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Invalid string',\n name: issue.validation === 'regex' ? CodeNames.Regex : CodeNames.Unexpected,\n path: issue.path,\n };\n};\nconst convertInvalidEnumValue = (issue: z.ZodInvalidEnumValueIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received.toString(),\n expected: issue.options,\n };\n};\nconst convertInvalidLiteral = (issue: z.ZodInvalidLiteralIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received as string,\n expected: [issue.expected as string],\n };\n};\n\nconst convertTooBig = (issue: z.ZodTooBigIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || `Size should be at most ${issue.maximum}`,\n name: CodeNames.Size,\n path: issue.path,\n max: issue.maximum,\n };\n};\n\nconst convertTooSmall = (issue: z.ZodTooSmallIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || `Size should be at least ${issue.minimum}`,\n name: CodeNames.Size,\n path: issue.path,\n min: issue.minimum,\n };\n};\nconst defaultConversion = (issue: ZodIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'An unexpected error occurred',\n name: CodeNames.Custom,\n path: issue.path.map(String),\n };\n};\n\nexport const zodToContentfulError = (issue: ZodIssue): ContentfulErrorDetails => {\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n return convertInvalidType(issue);\n case ZodIssueCode.unrecognized_keys:\n return convertUnrecognizedKeys(issue);\n case ZodIssueCode.invalid_enum_value:\n return convertInvalidEnumValue(issue);\n case ZodIssueCode.invalid_string:\n return convertInvalidString(issue);\n case ZodIssueCode.too_small:\n return convertTooSmall(issue);\n case ZodIssueCode.too_big:\n return convertTooBig(issue);\n case ZodIssueCode.invalid_literal:\n return convertInvalidLiteral(issue);\n default:\n return defaultConversion(issue);\n }\n};\n","import { z } from 'zod';\nimport { Breakpoint, BreakpointSchema, breakpointsRefinement } from '../schemas/latest';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { zodToContentfulError } from '@/utils/zodToContentfulError';\n\nexport const validateBreakpointsDefinition = (breakpoints: Breakpoint[]): ValidatorReturnValue => {\n const result = z\n .array(BreakpointSchema)\n .superRefine(breakpointsRefinement)\n .safeParse(breakpoints);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { ComponentDefinitionSchema } from '../schemas';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { zodToContentfulError } from '../utils/zodToContentfulError';\n\nexport const validateComponentDefinition = (definition): ValidatorReturnValue => {\n const result = ComponentDefinitionSchema.safeParse(definition);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { type SchemaVersions } from '../types';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { PatternSchema_2023_09_28 } from '../schemas';\nimport { zodToContentfulError, CodeNames } from '@/utils/zodToContentfulError';\n\nconst VERSION_SCHEMAS = {\n '2023-09-28': PatternSchema_2023_09_28,\n};\n\n/**\n *\n * @param pattern The pattern entry to validate\n * @param schemaVersionOverride Optional override for the schema version to validate against.\n * By default, the schema version is read from the pattern entry\n * @returns object with success property and optional errors array\n */\nexport const validatePatternFields = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- matches KeyValueMap in EntryProps['fields']\n pattern: { fields: Record<string, any> },\n schemaVersionOverride?: SchemaVersions,\n): ValidatorReturnValue => {\n let schemaVersion: SchemaVersions | undefined;\n\n if (schemaVersionOverride) {\n schemaVersion = schemaVersionOverride;\n } else if (pattern.fields.componentTree) {\n const locale = Object.keys(pattern.fields.componentTree)[0];\n schemaVersion = pattern.fields.componentTree[locale].schemaVersion;\n }\n\n const schema = schemaVersion && VERSION_SCHEMAS[schemaVersion];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n name: schemaVersion ? CodeNames.In : CodeNames.Required,\n expected: Object.keys(VERSION_SCHEMAS),\n value: schemaVersion,\n path: ['fields', 'componentTree', 'schemaVersion'],\n details: schemaVersion\n ? 'Unsupported schema version'\n : 'The property \"schemaVersion\" is required here',\n },\n ],\n };\n }\n\n const fieldsToValidate = {\n componentTree: pattern.fields.componentTree,\n dataSource: pattern.fields.dataSource,\n unboundValues: pattern.fields.unboundValues,\n usedComponents: pattern.fields.usedComponents,\n componentSettings: pattern.fields.componentSettings,\n };\n\n const result = schema.safeParse(fieldsToValidate);\n if (!result.success) {\n return {\n success: result.success,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { type SchemaVersions } from '../types';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { ExperienceSchema_2023_09_28 } from '../schemas';\nimport { zodToContentfulError, CodeNames } from '@/utils/zodToContentfulError';\nimport { validatePatternFields } from '@/validators/validatePatternFields';\n\nconst VERSION_SCHEMAS = {\n '2023-09-28': ExperienceSchema_2023_09_28,\n};\n\n// TODO: fix typing when the Entry type is exposed\nfunction isPattern(experience: any): boolean {\n return experience.fields.componentSettings !== undefined;\n}\n\n/**\n *\n * @param experience The experience entry to validate\n * @param schemaVersionOverride Optional override for the schema version to validate against.\n * By default, the schema version is read from the experience entry\n * @returns object with success property and optional errors array\n */\nexport const validateExperienceFields = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- matches KeyValueMap in EntryProps['fields']\n experience: { fields: Record<string, any> },\n schemaVersionOverride?: SchemaVersions,\n): ValidatorReturnValue => {\n // If this is a pattern, use the pattern validator\n if (isPattern(experience)) {\n return validatePatternFields(experience, schemaVersionOverride);\n }\n\n let schemaVersion: SchemaVersions | undefined;\n if (schemaVersionOverride) {\n schemaVersion = schemaVersionOverride;\n } else if (experience.fields.componentTree) {\n const locale = Object.keys(experience.fields.componentTree)[0];\n schemaVersion = experience.fields.componentTree[locale].schemaVersion;\n }\n\n const schema = schemaVersion && VERSION_SCHEMAS[schemaVersion];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n name: schemaVersion ? CodeNames.In : CodeNames.Required,\n expected: ['2023-09-28'],\n value: schemaVersion,\n path: ['fields', 'componentTree', 'schemaVersion'],\n details: schemaVersion\n ? 'Unsupported schema version'\n : 'The property \"schemaVersion\" is required here',\n },\n ],\n };\n }\n\n const fieldsToValidate = {\n componentTree: experience.fields.componentTree,\n dataSource: experience.fields.dataSource,\n unboundValues: experience.fields.unboundValues,\n usedComponents: experience.fields.usedComponents,\n };\n\n const result = schema.safeParse(fieldsToValidate);\n if (!result.success) {\n return {\n success: result.success,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n"],"names":["z","ZodIssueCode","VERSION_SCHEMAS","PatternSchema_2023_09_28","ExperienceSchema_2023_09_28"],"mappings":";;;;AACA;AACO,MAAM,cAAc,GAAGA,KAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAItD;AACyCA,KAAC,CAAC,KAAK,CAAC;AAC/C,IAAAA,KAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IAAAA,KAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IAAAA,KAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACxB,CAAA;;ACPM,MAAM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AoB,CAAC;SACtD,CAAC;KACH;AACD,IAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -230,19 +230,6 @@ const ComponentVariableSchema = z.object({
230
230
  });
231
231
  const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
232
232
  children: z.lazy(() => ComponentTreeNodeSchema.array()),
233
- }).superRefine(({ id, prebindingId, parameters }, ctx) => {
234
- if (prebindingId && !parameters) {
235
- ctx.addIssue({
236
- code: z.ZodIssueCode.custom,
237
- message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
238
- });
239
- }
240
- if (parameters && !prebindingId) {
241
- ctx.addIssue({
242
- code: z.ZodIssueCode.custom,
243
- message: `Found "parameters" but no "prebindingId" for node with id: "${id}"`,
244
- });
245
- }
246
233
  });
247
234
  const ComponentTreeSchema = z
248
235
  .object({
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/schemas/schemaVersions.ts","../src/schemas/v2023_09_28/common.ts","../src/schemas/v2023_09_28/experience.ts","../src/utils/treeVisit.ts","../src/schemas/v2023_09_28/pattern.ts","../src/schemas/componentDefinition.ts","../src/utils/zodToContentfulError.ts","../src/validators/validateBreakpointDefinitions.ts","../src/validators/validateComponentDefinition.ts","../src/validators/validatePatternFields.ts","../src/validators/validateExperienceFields.ts"],"sourcesContent":["import { z } from 'zod';\n// If more than one version is supported, use z.union\nexport const SchemaVersions = z.literal('2023-09-28');\n\nexport type SchemaVersions = z.infer<typeof SchemaVersions>;\n\n// Keep deprecated versions here just for reference\nexport const UnsupportedSchemaVersions = z.union([\n z.literal('2023-08-23'),\n z.literal('2023-07-26'),\n z.literal('2023-06-27'),\n]);\n","import { z, ZodTypeAny } from 'zod';\nimport { Breakpoint } from '@/schemas/v2023_09_28/experience';\nimport { SchemaVersions } from '@/schemas/schemaVersions';\n\nexport const DefinitionPropertyTypeSchema = z.enum([\n 'Text',\n 'RichText',\n 'Number',\n 'Date',\n 'Boolean',\n 'Location',\n 'Media',\n 'Object',\n 'Hyperlink',\n 'Array',\n 'Link',\n]);\n\nexport const DefinitionPropertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,32}$/, { message: 'Property needs to match: /^[a-zA-Z0-9-_]{1,32}$/' });\n\nexport const PrimitiveValueSchema = z.union([\n z.string(),\n z.boolean(),\n z.number(),\n z.record(z.any(), z.any()),\n z.undefined(),\n]);\n\nexport const UsedComponentsSchema = z.array(\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.literal('Entry'),\n }),\n }),\n);\n\nexport const uuidKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });\n\nexport const DataSourceSchema = z.record(\n uuidKeySchema,\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry', 'Asset']),\n }),\n }),\n);\n\nexport const UnboundValuesSchema = z.record(\n uuidKeySchema,\n z.object({\n value: PrimitiveValueSchema,\n }),\n);\n\n/**\n * Property keys for imported components have a limit of 32 characters (to be implemented) while\n * property keys for patterns have a limit of 54 characters (<32-char-variable-name>_<21-char-nanoid-id>).\n * Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.\n */\nexport const propertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });\n\nexport const ComponentTreeNodeIdSchema = z\n .string()\n .regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });\n\nexport const breakpointsRefinement = (value: Breakpoint[], ctx: z.RefinementCtx) => {\n if (!value.length || value[0].query !== '*') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The first breakpoint should include the following attributes: { \"query\": \"*\" }`,\n });\n return;\n }\n\n // Return early if there's only one generic breakpoint\n const hasNoBreakpointsStrategy = value.length === 1;\n if (hasNoBreakpointsStrategy) {\n return;\n }\n\n // Check if any breakpoint id occurs twice\n const ids = value.map((breakpoint) => breakpoint.id);\n const hasDuplicateIds = new Set(ids).size !== ids.length;\n if (hasDuplicateIds) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint IDs must be unique`,\n });\n return;\n }\n\n // Skip the first one which is guaranteed to be a wildcard query\n const nonBaseBreakpoints = value.slice(1);\n const isMobileFirstStrategy = nonBaseBreakpoints[0].query.startsWith('>');\n const isDesktopFirstStrategy = nonBaseBreakpoints[0].query.startsWith('<');\n\n if (isMobileFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('>'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \">[size]px\" for mobile-first strategy`,\n });\n }\n\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n\n // Starting with the third breakpoint, check that every query is higher than the one above\n const isIncreasing = queries.every(\n (value, index, array) => index === 0 || value > array[index - 1],\n );\n if (!isIncreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a mobile-first strategy, all breakpoints must have strictly increasing pixel values`,\n });\n }\n } else if (isDesktopFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('<'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \"<[size]px\" for desktop-first strategy`,\n });\n }\n\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n\n // Starting with the third breakpoint, check that every query is lower than the one above\n const isDecreasing = queries.every(\n (value, index, array) => index === 0 || value < array[index - 1],\n );\n if (!isDecreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a desktop-first strategy, all breakpoints must have strictly decreasing pixel values`,\n });\n }\n } else if (!isMobileFirstStrategy && !isDesktopFirstStrategy) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `You may only use a mobile-first or desktop-first strategy for breakpoints using '<' or '>' queries`,\n });\n }\n};\n\nexport const ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));\n\nexport const BindingSourceTypeEnumSchema = z\n .array(z.enum(['entry', 'asset', 'manual', 'experience']))\n .nonempty();\n\nexport const DesignValueSchema = z\n .object({\n type: z.literal('DesignValue'),\n valuesByBreakpoint: ValuesByBreakpointSchema,\n })\n .strict();\n\nexport const BoundValueSchema = z\n .object({\n type: z.literal('BoundValue'),\n path: z.string(),\n })\n .strict();\n\nexport const HyperlinkValueSchema = z\n .object({\n type: z.literal('HyperlinkValue'),\n linkTargetKey: z.string(),\n /** Allows to override parts of the URL, e.g. the locale */\n overrides: z.object({}).optional(),\n })\n .strict();\n\nexport const UnboundValueSchema = z\n .object({\n type: z.literal('UnboundValue'),\n key: z.string(),\n })\n .strict();\n\nexport const ComponentValueSchema = z\n .object({\n type: z.literal('ComponentValue'),\n key: z.string(),\n })\n .strict();\n\nexport const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();\n\nexport const ComponentPropertyValueSchema = z.discriminatedUnion('type', [\n DesignValueSchema,\n BoundValueSchema,\n UnboundValueSchema,\n HyperlinkValueSchema,\n ComponentValueSchema,\n NoValueSchema,\n]);\n\nexport type ComponentPropertyValue = z.infer<typeof ComponentPropertyValueSchema>;\n\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nexport const ParameterSchema = z.object({\n type: z.literal('BoundValue'),\n path: z.string(),\n});\n\nexport const ParametersSchema = z.record(propertyKeySchema, ParameterSchema);\n\ntype BreakpointQuery = '*' | `>${number}px` | `<${number}px`;\nconst BREAKPOINT_QUERY_REGEX = /^\\*$|^[<>][0-9]+px$/;\n\nexport const BreakpointSchema = z\n .object({\n id: propertyKeySchema,\n // Can be replace with z.templateLiteral when upgrading to zod v4\n query: z.string().refine((s): s is BreakpointQuery => BREAKPOINT_QUERY_REGEX.test(s)),\n previewSize: z.string().optional(),\n displayName: z.string(),\n displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),\n })\n .strict();\n\n// Use helper schema to define a recursive schema with its type correctly below\nconst BaseComponentTreeNodeSchema = z.object({\n id: ComponentTreeNodeIdSchema.optional(),\n definitionId: DefinitionPropertyKeySchema,\n prebindingId: z.string().optional(),\n displayName: z.string().optional(),\n slotId: z.string().optional(),\n variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),\n parameters: ParametersSchema.optional(),\n});\n\nexport type ComponentTreeNode = z.infer<typeof BaseComponentTreeNodeSchema> & {\n children: ComponentTreeNode[];\n};\n\nexport const ComponentVariableSchema = z.object({\n displayName: z.string().optional(),\n type: DefinitionPropertyTypeSchema,\n description: z.string().optional(),\n group: z.string().optional(),\n defaultValue: PrimitiveValueSchema.or(ComponentPropertyValueSchema).optional(),\n validations: z\n .object({\n bindingSourceType: BindingSourceTypeEnumSchema.optional(),\n required: z.boolean().optional(),\n format: z.literal('URL').optional(),\n in: z\n .array(\n z.object({\n value: z.union([z.string(), z.number()]),\n displayName: z.string().optional(),\n }),\n )\n .optional(),\n })\n .optional(),\n});\n\nexport const ComponentTreeNodeSchema: z.ZodType<ComponentTreeNode> =\n BaseComponentTreeNodeSchema.extend({\n children: z.lazy(() => ComponentTreeNodeSchema.array()),\n }).superRefine(({ id, prebindingId, parameters }, ctx) => {\n if (prebindingId && !parameters) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found \"prebindingId\" but no \"parameters\" for node with id: \"${id}\"`,\n });\n }\n\n if (parameters && !prebindingId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found \"parameters\" but no \"prebindingId\" for node with id: \"${id}\"`,\n });\n }\n });\n\nexport const ComponentTreeSchema = z\n .object({\n breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),\n children: z.array(ComponentTreeNodeSchema),\n schemaVersion: SchemaVersions,\n })\n .strict();\nexport const localeWrapper = (fieldSchema: ZodTypeAny) => z.record(z.string(), fieldSchema);\n","import { z } from 'zod';\nimport {\n BindingSourceTypeEnumSchema,\n BoundValueSchema,\n BreakpointSchema,\n breakpointsRefinement,\n ComponentTreeSchema,\n ComponentValueSchema,\n DataSourceSchema,\n DesignValueSchema,\n HyperlinkValueSchema,\n localeWrapper,\n NoValueSchema,\n ParameterSchema,\n PrimitiveValueSchema,\n UnboundValueSchema,\n UnboundValuesSchema,\n UsedComponentsSchema,\n ValuesByBreakpointSchema,\n} from './common';\n\nexport const ExperienceFieldsCMAShapeSchema = z.object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n});\n\nexport type ExperienceFields = z.infer<typeof ExperienceFieldsCMAShapeSchema>;\nexport type ExperienceDataSource = z.infer<typeof DataSourceSchema>;\nexport type ExperienceUnboundValues = z.infer<typeof UnboundValuesSchema>;\nexport type ExperienceUsedComponents = z.infer<typeof UsedComponentsSchema>;\nexport type ExperienceComponentTree = z.infer<typeof ComponentTreeSchema>;\nexport type ValuesByBreakpoint = z.infer<typeof ValuesByBreakpointSchema>;\nexport type Breakpoint = z.infer<typeof BreakpointSchema>;\nexport type PrimitiveValue = z.infer<typeof PrimitiveValueSchema>;\nexport type DesignValue = z.infer<typeof DesignValueSchema>;\nexport type BoundValue = z.infer<typeof BoundValueSchema>;\nexport type NoValue = z.infer<typeof NoValueSchema>;\nexport type UnboundValue = z.infer<typeof UnboundValueSchema>;\nexport type HyperlinkValue = z.infer<typeof HyperlinkValueSchema>;\nexport type ComponentValue = z.infer<typeof ComponentValueSchema>;\nexport type BindingSourceTypeEnum = z.infer<typeof BindingSourceTypeEnumSchema>;\nexport type Parameter = z.infer<typeof ParameterSchema>;\nexport { breakpointsRefinement };\n","type NodeWithChildren<T> = {\n children: T[];\n};\n\nexport function treeVisit<T extends NodeWithChildren<T>>(\n initialNode: T | T[],\n onNode: (node: T) => void,\n) {\n const _treeVisit = (currentNode: T): void => {\n const children = [...currentNode.children];\n onNode(currentNode);\n for (const child of children) {\n _treeVisit(child);\n }\n };\n if (Array.isArray(initialNode)) {\n for (const node of initialNode) {\n _treeVisit(node);\n }\n } else {\n _treeVisit(initialNode);\n }\n}\n","import { z } from 'zod';\nimport {\n ComponentTreeSchema,\n ComponentVariableSchema,\n DataSourceSchema,\n localeWrapper,\n propertyKeySchema,\n UnboundValuesSchema,\n UsedComponentsSchema,\n} from '../v2023_09_28/common';\nimport { treeVisit } from '@/utils/treeVisit';\n\nexport const MAX_ALLOWED_PATHS = 200;\n\nexport const THUMBNAIL_IDS = [\n 'columns',\n 'columnsPlusRight',\n 'imagesSquare',\n 'subtitles',\n 'rowsPlusBottom',\n 'userRectangle',\n 'textbox',\n 'monitorPlay',\n 'article',\n 'table',\n 'star',\n 'heartStraight',\n 'frameCorners',\n 'rows',\n 'dotsThreeOutline',\n 'listDashes',\n 'checkerBoard',\n 'gridFour',\n 'slideshow',\n 'diamondsFour',\n 'cards',\n 'textColumns',\n 'duplex',\n] as const;\n\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nconst VariableMappingSchema = z.object({\n parameterId: propertyKeySchema,\n type: z.literal('ContentTypeMapping'),\n pathsByContentType: z\n .record(z.string(), z.object({ path: z.string() }))\n .superRefine((paths, ctx) => {\n const variableId = ctx.path[ctx.path.length - 2];\n if (Object.keys(paths).length > MAX_ALLOWED_PATHS) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Too many paths defined for variable mapping with id \"${variableId}\", maximum allowed is ${MAX_ALLOWED_PATHS}`,\n });\n }\n }),\n});\n\nexport const PassToNodeSchema = z\n .object({\n nodeId: propertyKeySchema,\n parameterId: propertyKeySchema,\n prebindingId: propertyKeySchema,\n })\n .strict();\n\nconst ParameterDefinitionSchema = z.object({\n defaultSource: z\n .strictObject({\n type: z.enum(['Entry']),\n contentTypeId: z.string(),\n link: z.strictObject({\n sys: z.strictObject({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry']),\n }),\n }),\n })\n .optional(),\n contentTypes: z.array(z.string()).min(1),\n passToNodes: z\n .array(PassToNodeSchema)\n .max(1, 'At most one \"passToNodes\" element is allowed per parameter definition.')\n .optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)\n});\n\nexport const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);\n\nconst VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);\n\nexport const ComponentVariablesSchema = z.record(\n z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length\n ComponentVariableSchema,\n);\n\nexport const PrebindingDefinitionSchema = z\n .object({\n id: propertyKeySchema,\n parameterDefinitions: ParameterDefinitionsSchema,\n variableMappings: VariableMappingsSchema.optional(),\n allowedVariableOverrides: z.array(z.string()).optional(),\n })\n .strict();\n\nconst ComponentSettingsSchema = z\n .object({\n variableDefinitions: ComponentVariablesSchema,\n thumbnailId: z.enum(THUMBNAIL_IDS).optional(),\n category: z.string().max(50, 'Category must contain at most 50 characters').optional(),\n prebindingDefinitions: z.array(PrebindingDefinitionSchema).length(1).optional(),\n })\n .strict()\n .superRefine((componentSettings, ctx) => {\n const { variableDefinitions, prebindingDefinitions } = componentSettings;\n if (!prebindingDefinitions || prebindingDefinitions.length === 0) {\n return;\n }\n const { parameterDefinitions, variableMappings, allowedVariableOverrides } =\n prebindingDefinitions[0];\n\n validateAtMostOneNativeParameterDefinition(parameterDefinitions, ctx);\n validateNoOverlapBetweenMappingAndOverrides(variableMappings, allowedVariableOverrides, ctx);\n validateMappingsAgainstVariableDefinitions(\n variableMappings,\n allowedVariableOverrides,\n variableDefinitions,\n ctx,\n );\n validateMappingsAgainstParameterDefinitions(variableMappings, parameterDefinitions, ctx);\n });\n\nexport const PatternFieldsCMAShapeSchema = z\n .object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n componentSettings: localeWrapper(ComponentSettingsSchema),\n })\n .superRefine((patternFields, ctx) => {\n const { componentTree, componentSettings } = patternFields;\n\n // values at this point are wrapped under locale code\n const nonLocalisedComponentTree = Object.values(componentTree)[0];\n const nonLocalisedComponentSettings = Object.values(componentSettings)[0];\n\n if (!nonLocalisedComponentSettings || !nonLocalisedComponentTree) {\n return;\n }\n\n validatePassToNodes(\n nonLocalisedComponentTree.children || ([] as z.infer<typeof ComponentTreeSchema>['children']),\n nonLocalisedComponentSettings || ({} as PatternComponentSettings),\n ctx,\n );\n });\n\nconst validateAtMostOneNativeParameterDefinition = (\n parameterDefinitions: Record<string, ParameterDefinition>,\n ctx: z.RefinementCtx,\n) => {\n const nativeParamDefinitions = Object.values(parameterDefinitions).filter(\n (paramDefinition) => !(paramDefinition.passToNodes && paramDefinition.passToNodes.length > 0),\n );\n\n if (nativeParamDefinitions.length > 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Only one native parameter definition (parameter definition without passToNodes) is allowed per prebinding definition.`,\n });\n }\n};\n\nconst validateNoOverlapBetweenMappingAndOverrides = (\n variableMappings: VariableMappings | undefined,\n allowedVariableOverrides: string[] | undefined,\n ctx: z.RefinementCtx,\n) => {\n const variableMappingKeys = Object.keys(variableMappings || {});\n const overridesSet = new Set(allowedVariableOverrides || []);\n const overlap = variableMappingKeys.filter((key) => overridesSet.has(key));\n if (overlap.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found both variable mapping and allowed override for the following keys: ${overlap.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\n\nconst validateMappingsAgainstVariableDefinitions = (\n variableMappings: VariableMappings | undefined,\n allowedVariableOverrides: string[] | undefined,\n variableDefinitions: Record<string, z.infer<typeof ComponentVariableSchema>>,\n ctx: z.RefinementCtx,\n) => {\n const nonDesignVariableDefinitionKeys = Object.entries(variableDefinitions)\n .filter(([_, def]) => def.group !== 'style')\n .map(([key]) => key);\n\n const variableMappingKeys = Object.keys(variableMappings || {});\n\n const allKeys = [...variableMappingKeys, ...(allowedVariableOverrides || [])];\n const invalidMappings = allKeys.filter((key) => !nonDesignVariableDefinitionKeys.includes(key));\n if (invalidMappings.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following variable mappings or overrides are missing from the variable definitions: ${invalidMappings.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\n\nconst validateMappingsAgainstParameterDefinitions = (\n variableMappings: VariableMappings | undefined,\n parameterDefinitions: ParameterDefinitions,\n ctx: z.RefinementCtx,\n) => {\n const parameterDefinitionKeys = Object.keys(parameterDefinitions || {});\n for (const [mappingKey, mappingValue] of Object.entries(variableMappings || {})) {\n if (!parameterDefinitionKeys.includes(mappingValue.parameterId)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The variable mapping with id \"${mappingKey}\" references a non-existing parameterId \"${mappingValue.parameterId}\".`,\n });\n }\n }\n};\n\nconst validatePassToNodes = (\n rootChildren: z.infer<typeof ComponentTreeSchema>['children'],\n componentSettings: PatternComponentSettings,\n ctx: z.RefinementCtx,\n) => {\n if (\n !componentSettings.prebindingDefinitions ||\n componentSettings.prebindingDefinitions.length === 0\n ) {\n return;\n }\n const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];\n\n let nodeIds: Set<string> = new Set();\n for (const paramDef of Object.values(parameterDefinitions || {})) {\n paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));\n }\n\n treeVisit(rootChildren, (node) => {\n if (!node.id) return;\n if (nodeIds.has(node.id)) {\n nodeIds.delete(node.id);\n }\n });\n\n if (nodeIds.size > 0) {\n const stringifiedNodeIds = Array.from(nodeIds)\n .map((id) => `\"${id}\"`)\n .join(', ');\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following node IDs referenced in passToNodes are not present in the component tree: ${stringifiedNodeIds}.`,\n });\n }\n};\n\nexport type PatternFields = z.infer<typeof PatternFieldsCMAShapeSchema>;\nexport type ParameterDefinition = z.infer<typeof ParameterDefinitionSchema>;\nexport type ParameterDefinitions = z.infer<typeof ParameterDefinitionsSchema>;\nexport type VariableMapping = z.infer<typeof VariableMappingSchema>;\nexport type VariableMappings = z.infer<typeof VariableMappingsSchema>;\nexport type PatternComponentSettings = z.infer<typeof ComponentSettingsSchema>;\nexport type PrebindingDefinition = z.infer<typeof PrebindingDefinitionSchema>;\n","import { z } from 'zod';\nimport {\n ComponentVariableSchema,\n DefinitionPropertyKeySchema,\n DefinitionPropertyTypeSchema,\n PrimitiveValueSchema,\n} from './v2023_09_28/common';\n\nexport const ComponentDefinitionSchema = z\n .object({\n id: DefinitionPropertyKeySchema,\n name: z.string(),\n category: z.string().optional(),\n thumbnailUrl: z.string().optional(),\n thumbnailId: z.string().optional(),\n hyperlinkPattern: z.string().optional(),\n children: z.boolean().optional(),\n slots: z\n .record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))\n .optional(),\n builtInStyles: z.array(z.string()).optional(),\n tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),\n variables: z.record(\n DefinitionPropertyKeySchema,\n ComponentVariableSchema.extend({\n defaultValue: PrimitiveValueSchema.optional(),\n }).superRefine((val, ctx) => {\n switch (val.type) {\n case 'Array':\n if (typeof val.defaultValue !== 'undefined') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Array\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Boolean':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'boolean') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a boolean when type is \"Boolean\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Date':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Date\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Hyperlink':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Hyperlink\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Link':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Link\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Location':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Location\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Media':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Media\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Number':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'number') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a number when type is \"Number\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Object':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Object\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'RichText':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"RichText\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Text':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Text\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n }\n }),\n ),\n })\n .superRefine((val, ctx) => {\n if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,\n fatal: false,\n });\n }\n // Ensure that slots and variables don't use the same names\n if (val.variables && val.slots) {\n Object.keys(val.variables).forEach((name) => {\n if (val.slots![name]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Variable and slot cannot have the same name: ${name}`,\n fatal: false,\n });\n }\n });\n }\n });\n\nexport type ComponentDefinitionPropertyType = z.infer<typeof DefinitionPropertyTypeSchema>;\nexport type ComponentDefinitionType = z.infer<typeof ComponentDefinitionSchema>;\n","import { ZodIssueCode, ZodIssue, z } from 'zod';\n\nexport enum CodeNames {\n Type = 'type',\n Required = 'required',\n Unexpected = 'unexpected',\n Regex = 'regex',\n In = 'in',\n Size = 'size',\n Custom = 'custom',\n}\n\nexport type ContentfulErrorDetails = {\n details: string;\n min?: number | bigint;\n max?: number | bigint;\n name: (typeof CodeNames)[keyof typeof CodeNames];\n path: (string | number)[];\n value?: string;\n expected?: (string | number)[];\n};\n\nconst convertInvalidType = (issue: z.ZodInvalidTypeIssue): ContentfulErrorDetails => {\n const name = issue.received === 'undefined' ? CodeNames.Required : CodeNames.Type;\n const details =\n issue.received === 'undefined'\n ? `The property \"${issue.path.slice(-1)}\" is required here`\n : `The type of \"${issue.path.slice(-1)}\" is incorrect, expected type: ${issue.expected}`;\n\n return {\n details: details,\n name: name,\n path: issue.path,\n value: issue.received.toString(),\n };\n};\n\nconst convertUnrecognizedKeys = (issue: z.ZodUnrecognizedKeysIssue): ContentfulErrorDetails => {\n const missingProperties = issue.keys.map((k) => `\"${k}\"`).join(', ');\n return {\n details:\n issue.keys.length > 1\n ? `The properties ${missingProperties} are not expected`\n : `The property ${missingProperties} is not expected`,\n name: CodeNames.Unexpected,\n path: issue.path,\n };\n};\n\nconst convertInvalidString = (issue: z.ZodInvalidStringIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Invalid string',\n name: issue.validation === 'regex' ? CodeNames.Regex : CodeNames.Unexpected,\n path: issue.path,\n };\n};\nconst convertInvalidEnumValue = (issue: z.ZodInvalidEnumValueIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received.toString(),\n expected: issue.options,\n };\n};\nconst convertInvalidLiteral = (issue: z.ZodInvalidLiteralIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received as string,\n expected: [issue.expected as string],\n };\n};\n\nconst convertTooBig = (issue: z.ZodTooBigIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || `Size should be at most ${issue.maximum}`,\n name: CodeNames.Size,\n path: issue.path,\n max: issue.maximum,\n };\n};\n\nconst convertTooSmall = (issue: z.ZodTooSmallIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || `Size should be at least ${issue.minimum}`,\n name: CodeNames.Size,\n path: issue.path,\n min: issue.minimum,\n };\n};\nconst defaultConversion = (issue: ZodIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'An unexpected error occurred',\n name: CodeNames.Custom,\n path: issue.path.map(String),\n };\n};\n\nexport const zodToContentfulError = (issue: ZodIssue): ContentfulErrorDetails => {\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n return convertInvalidType(issue);\n case ZodIssueCode.unrecognized_keys:\n return convertUnrecognizedKeys(issue);\n case ZodIssueCode.invalid_enum_value:\n return convertInvalidEnumValue(issue);\n case ZodIssueCode.invalid_string:\n return convertInvalidString(issue);\n case ZodIssueCode.too_small:\n return convertTooSmall(issue);\n case ZodIssueCode.too_big:\n return convertTooBig(issue);\n case ZodIssueCode.invalid_literal:\n return convertInvalidLiteral(issue);\n default:\n return defaultConversion(issue);\n }\n};\n","import { z } from 'zod';\nimport { Breakpoint, BreakpointSchema, breakpointsRefinement } from '../schemas/latest';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { zodToContentfulError } from '@/utils/zodToContentfulError';\n\nexport const validateBreakpointsDefinition = (breakpoints: Breakpoint[]): ValidatorReturnValue => {\n const result = z\n .array(BreakpointSchema)\n .superRefine(breakpointsRefinement)\n .safeParse(breakpoints);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { ComponentDefinitionSchema } from '../schemas';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { zodToContentfulError } from '../utils/zodToContentfulError';\n\nexport const validateComponentDefinition = (definition): ValidatorReturnValue => {\n const result = ComponentDefinitionSchema.safeParse(definition);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { type SchemaVersions } from '../types';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { PatternSchema_2023_09_28 } from '../schemas';\nimport { zodToContentfulError, CodeNames } from '@/utils/zodToContentfulError';\n\nconst VERSION_SCHEMAS = {\n '2023-09-28': PatternSchema_2023_09_28,\n};\n\n/**\n *\n * @param pattern The pattern entry to validate\n * @param schemaVersionOverride Optional override for the schema version to validate against.\n * By default, the schema version is read from the pattern entry\n * @returns object with success property and optional errors array\n */\nexport const validatePatternFields = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- matches KeyValueMap in EntryProps['fields']\n pattern: { fields: Record<string, any> },\n schemaVersionOverride?: SchemaVersions,\n): ValidatorReturnValue => {\n let schemaVersion: SchemaVersions | undefined;\n\n if (schemaVersionOverride) {\n schemaVersion = schemaVersionOverride;\n } else if (pattern.fields.componentTree) {\n const locale = Object.keys(pattern.fields.componentTree)[0];\n schemaVersion = pattern.fields.componentTree[locale].schemaVersion;\n }\n\n const schema = schemaVersion && VERSION_SCHEMAS[schemaVersion];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n name: schemaVersion ? CodeNames.In : CodeNames.Required,\n expected: Object.keys(VERSION_SCHEMAS),\n value: schemaVersion,\n path: ['fields', 'componentTree', 'schemaVersion'],\n details: schemaVersion\n ? 'Unsupported schema version'\n : 'The property \"schemaVersion\" is required here',\n },\n ],\n };\n }\n\n const fieldsToValidate = {\n componentTree: pattern.fields.componentTree,\n dataSource: pattern.fields.dataSource,\n unboundValues: pattern.fields.unboundValues,\n usedComponents: pattern.fields.usedComponents,\n componentSettings: pattern.fields.componentSettings,\n };\n\n const result = schema.safeParse(fieldsToValidate);\n if (!result.success) {\n return {\n success: result.success,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { type SchemaVersions } from '../types';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { ExperienceSchema_2023_09_28 } from '../schemas';\nimport { zodToContentfulError, CodeNames } from '@/utils/zodToContentfulError';\nimport { validatePatternFields } from '@/validators/validatePatternFields';\n\nconst VERSION_SCHEMAS = {\n '2023-09-28': ExperienceSchema_2023_09_28,\n};\n\n// TODO: fix typing when the Entry type is exposed\nfunction isPattern(experience: any): boolean {\n return experience.fields.componentSettings !== undefined;\n}\n\n/**\n *\n * @param experience The experience entry to validate\n * @param schemaVersionOverride Optional override for the schema version to validate against.\n * By default, the schema version is read from the experience entry\n * @returns object with success property and optional errors array\n */\nexport const validateExperienceFields = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- matches KeyValueMap in EntryProps['fields']\n experience: { fields: Record<string, any> },\n schemaVersionOverride?: SchemaVersions,\n): ValidatorReturnValue => {\n // If this is a pattern, use the pattern validator\n if (isPattern(experience)) {\n return validatePatternFields(experience, schemaVersionOverride);\n }\n\n let schemaVersion: SchemaVersions | undefined;\n if (schemaVersionOverride) {\n schemaVersion = schemaVersionOverride;\n } else if (experience.fields.componentTree) {\n const locale = Object.keys(experience.fields.componentTree)[0];\n schemaVersion = experience.fields.componentTree[locale].schemaVersion;\n }\n\n const schema = schemaVersion && VERSION_SCHEMAS[schemaVersion];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n name: schemaVersion ? CodeNames.In : CodeNames.Required,\n expected: ['2023-09-28'],\n value: schemaVersion,\n path: ['fields', 'componentTree', 'schemaVersion'],\n details: schemaVersion\n ? 'Unsupported schema version'\n : 'The property \"schemaVersion\" is required here',\n },\n ],\n };\n }\n\n const fieldsToValidate = {\n componentTree: experience.fields.componentTree,\n dataSource: experience.fields.dataSource,\n unboundValues: experience.fields.unboundValues,\n usedComponents: experience.fields.usedComponents,\n };\n\n const result = schema.safeParse(fieldsToValidate);\n if (!result.success) {\n return {\n success: result.success,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n"],"names":["VERSION_SCHEMAS","PatternSchema_2023_09_28","ExperienceSchema_2023_09_28"],"mappings":";;AACA;AACO,MAAM,cAAc,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAItD;AACyC,CAAC,CAAC,KAAK,CAAC;AAC/C,IAAA,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IAAA,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IAAA,CAAC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C,aAAa;AAC9C,QAAA,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,UAAU;AACxC,QAAA,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,aAAa;AAC9C,QAAA,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,cAAc;KACjD,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAClD,IAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;SACtD,CAAC;KACH;AACD,IAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/schemas/schemaVersions.ts","../src/schemas/v2023_09_28/common.ts","../src/schemas/v2023_09_28/experience.ts","../src/utils/treeVisit.ts","../src/schemas/v2023_09_28/pattern.ts","../src/schemas/componentDefinition.ts","../src/utils/zodToContentfulError.ts","../src/validators/validateBreakpointDefinitions.ts","../src/validators/validateComponentDefinition.ts","../src/validators/validatePatternFields.ts","../src/validators/validateExperienceFields.ts"],"sourcesContent":["import { z } from 'zod';\n// If more than one version is supported, use z.union\nexport const SchemaVersions = z.literal('2023-09-28');\n\nexport type SchemaVersions = z.infer<typeof SchemaVersions>;\n\n// Keep deprecated versions here just for reference\nexport const UnsupportedSchemaVersions = z.union([\n z.literal('2023-08-23'),\n z.literal('2023-07-26'),\n z.literal('2023-06-27'),\n]);\n","import { z, ZodTypeAny } from 'zod';\nimport { Breakpoint } from '@/schemas/v2023_09_28/experience';\nimport { SchemaVersions } from '@/schemas/schemaVersions';\n\nexport const DefinitionPropertyTypeSchema = z.enum([\n 'Text',\n 'RichText',\n 'Number',\n 'Date',\n 'Boolean',\n 'Location',\n 'Media',\n 'Object',\n 'Hyperlink',\n 'Array',\n 'Link',\n]);\n\nexport const DefinitionPropertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,32}$/, { message: 'Property needs to match: /^[a-zA-Z0-9-_]{1,32}$/' });\n\nexport const PrimitiveValueSchema = z.union([\n z.string(),\n z.boolean(),\n z.number(),\n z.record(z.any(), z.any()),\n z.undefined(),\n]);\n\nexport const UsedComponentsSchema = z.array(\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.literal('Entry'),\n }),\n }),\n);\n\nexport const uuidKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });\n\nexport const DataSourceSchema = z.record(\n uuidKeySchema,\n z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry', 'Asset']),\n }),\n }),\n);\n\nexport const UnboundValuesSchema = z.record(\n uuidKeySchema,\n z.object({\n value: PrimitiveValueSchema,\n }),\n);\n\n/**\n * Property keys for imported components have a limit of 32 characters (to be implemented) while\n * property keys for patterns have a limit of 54 characters (<32-char-variable-name>_<21-char-nanoid-id>).\n * Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.\n */\nexport const propertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });\n\nexport const ComponentTreeNodeIdSchema = z\n .string()\n .regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });\n\nexport const breakpointsRefinement = (value: Breakpoint[], ctx: z.RefinementCtx) => {\n if (!value.length || value[0].query !== '*') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The first breakpoint should include the following attributes: { \"query\": \"*\" }`,\n });\n return;\n }\n\n // Return early if there's only one generic breakpoint\n const hasNoBreakpointsStrategy = value.length === 1;\n if (hasNoBreakpointsStrategy) {\n return;\n }\n\n // Check if any breakpoint id occurs twice\n const ids = value.map((breakpoint) => breakpoint.id);\n const hasDuplicateIds = new Set(ids).size !== ids.length;\n if (hasDuplicateIds) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint IDs must be unique`,\n });\n return;\n }\n\n // Skip the first one which is guaranteed to be a wildcard query\n const nonBaseBreakpoints = value.slice(1);\n const isMobileFirstStrategy = nonBaseBreakpoints[0].query.startsWith('>');\n const isDesktopFirstStrategy = nonBaseBreakpoints[0].query.startsWith('<');\n\n if (isMobileFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('>'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \">[size]px\" for mobile-first strategy`,\n });\n }\n\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n\n // Starting with the third breakpoint, check that every query is higher than the one above\n const isIncreasing = queries.every(\n (value, index, array) => index === 0 || value > array[index - 1],\n );\n if (!isIncreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a mobile-first strategy, all breakpoints must have strictly increasing pixel values`,\n });\n }\n } else if (isDesktopFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('<'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \"<[size]px\" for desktop-first strategy`,\n });\n }\n\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n\n // Starting with the third breakpoint, check that every query is lower than the one above\n const isDecreasing = queries.every(\n (value, index, array) => index === 0 || value < array[index - 1],\n );\n if (!isDecreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a desktop-first strategy, all breakpoints must have strictly decreasing pixel values`,\n });\n }\n } else if (!isMobileFirstStrategy && !isDesktopFirstStrategy) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `You may only use a mobile-first or desktop-first strategy for breakpoints using '<' or '>' queries`,\n });\n }\n};\n\nexport const ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));\n\nexport const BindingSourceTypeEnumSchema = z\n .array(z.enum(['entry', 'asset', 'manual', 'experience']))\n .nonempty();\n\nexport const DesignValueSchema = z\n .object({\n type: z.literal('DesignValue'),\n valuesByBreakpoint: ValuesByBreakpointSchema,\n })\n .strict();\n\nexport const BoundValueSchema = z\n .object({\n type: z.literal('BoundValue'),\n path: z.string(),\n })\n .strict();\n\nexport const HyperlinkValueSchema = z\n .object({\n type: z.literal('HyperlinkValue'),\n linkTargetKey: z.string(),\n /** Allows to override parts of the URL, e.g. the locale */\n overrides: z.object({}).optional(),\n })\n .strict();\n\nexport const UnboundValueSchema = z\n .object({\n type: z.literal('UnboundValue'),\n key: z.string(),\n })\n .strict();\n\nexport const ComponentValueSchema = z\n .object({\n type: z.literal('ComponentValue'),\n key: z.string(),\n })\n .strict();\n\nexport const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();\n\nexport const ComponentPropertyValueSchema = z.discriminatedUnion('type', [\n DesignValueSchema,\n BoundValueSchema,\n UnboundValueSchema,\n HyperlinkValueSchema,\n ComponentValueSchema,\n NoValueSchema,\n]);\n\nexport type ComponentPropertyValue = z.infer<typeof ComponentPropertyValueSchema>;\n\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nexport const ParameterSchema = z.object({\n type: z.literal('BoundValue'),\n path: z.string(),\n});\n\nexport const ParametersSchema = z.record(propertyKeySchema, ParameterSchema);\n\ntype BreakpointQuery = '*' | `>${number}px` | `<${number}px`;\nconst BREAKPOINT_QUERY_REGEX = /^\\*$|^[<>][0-9]+px$/;\n\nexport const BreakpointSchema = z\n .object({\n id: propertyKeySchema,\n // Can be replace with z.templateLiteral when upgrading to zod v4\n query: z.string().refine((s): s is BreakpointQuery => BREAKPOINT_QUERY_REGEX.test(s)),\n previewSize: z.string().optional(),\n displayName: z.string(),\n displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),\n })\n .strict();\n\n// Use helper schema to define a recursive schema with its type correctly below\nconst BaseComponentTreeNodeSchema = z.object({\n id: ComponentTreeNodeIdSchema.optional(),\n definitionId: DefinitionPropertyKeySchema,\n prebindingId: z.string().optional(),\n displayName: z.string().optional(),\n slotId: z.string().optional(),\n variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),\n parameters: ParametersSchema.optional(),\n});\n\nexport type ComponentTreeNode = z.infer<typeof BaseComponentTreeNodeSchema> & {\n children: ComponentTreeNode[];\n};\n\nexport const ComponentVariableSchema = z.object({\n displayName: z.string().optional(),\n type: DefinitionPropertyTypeSchema,\n description: z.string().optional(),\n group: z.string().optional(),\n defaultValue: PrimitiveValueSchema.or(ComponentPropertyValueSchema).optional(),\n validations: z\n .object({\n bindingSourceType: BindingSourceTypeEnumSchema.optional(),\n required: z.boolean().optional(),\n format: z.literal('URL').optional(),\n in: z\n .array(\n z.object({\n value: z.union([z.string(), z.number()]),\n displayName: z.string().optional(),\n }),\n )\n .optional(),\n })\n .optional(),\n});\n\nexport const ComponentTreeNodeSchema: z.ZodType<ComponentTreeNode> =\n BaseComponentTreeNodeSchema.extend({\n children: z.lazy(() => ComponentTreeNodeSchema.array()),\n });\n\nexport const ComponentTreeSchema = z\n .object({\n breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),\n children: z.array(ComponentTreeNodeSchema),\n schemaVersion: SchemaVersions,\n })\n .strict();\nexport const localeWrapper = (fieldSchema: ZodTypeAny) => z.record(z.string(), fieldSchema);\n","import { z } from 'zod';\nimport {\n BindingSourceTypeEnumSchema,\n BoundValueSchema,\n BreakpointSchema,\n breakpointsRefinement,\n ComponentTreeSchema,\n ComponentValueSchema,\n DataSourceSchema,\n DesignValueSchema,\n HyperlinkValueSchema,\n localeWrapper,\n NoValueSchema,\n ParameterSchema,\n PrimitiveValueSchema,\n UnboundValueSchema,\n UnboundValuesSchema,\n UsedComponentsSchema,\n ValuesByBreakpointSchema,\n} from './common';\n\nexport const ExperienceFieldsCMAShapeSchema = z.object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n});\n\nexport type ExperienceFields = z.infer<typeof ExperienceFieldsCMAShapeSchema>;\nexport type ExperienceDataSource = z.infer<typeof DataSourceSchema>;\nexport type ExperienceUnboundValues = z.infer<typeof UnboundValuesSchema>;\nexport type ExperienceUsedComponents = z.infer<typeof UsedComponentsSchema>;\nexport type ExperienceComponentTree = z.infer<typeof ComponentTreeSchema>;\nexport type ValuesByBreakpoint = z.infer<typeof ValuesByBreakpointSchema>;\nexport type Breakpoint = z.infer<typeof BreakpointSchema>;\nexport type PrimitiveValue = z.infer<typeof PrimitiveValueSchema>;\nexport type DesignValue = z.infer<typeof DesignValueSchema>;\nexport type BoundValue = z.infer<typeof BoundValueSchema>;\nexport type NoValue = z.infer<typeof NoValueSchema>;\nexport type UnboundValue = z.infer<typeof UnboundValueSchema>;\nexport type HyperlinkValue = z.infer<typeof HyperlinkValueSchema>;\nexport type ComponentValue = z.infer<typeof ComponentValueSchema>;\nexport type BindingSourceTypeEnum = z.infer<typeof BindingSourceTypeEnumSchema>;\nexport type Parameter = z.infer<typeof ParameterSchema>;\nexport { breakpointsRefinement };\n","type NodeWithChildren<T> = {\n children: T[];\n};\n\nexport function treeVisit<T extends NodeWithChildren<T>>(\n initialNode: T | T[],\n onNode: (node: T) => void,\n) {\n const _treeVisit = (currentNode: T): void => {\n const children = [...currentNode.children];\n onNode(currentNode);\n for (const child of children) {\n _treeVisit(child);\n }\n };\n if (Array.isArray(initialNode)) {\n for (const node of initialNode) {\n _treeVisit(node);\n }\n } else {\n _treeVisit(initialNode);\n }\n}\n","import { z } from 'zod';\nimport {\n ComponentTreeSchema,\n ComponentVariableSchema,\n DataSourceSchema,\n localeWrapper,\n propertyKeySchema,\n UnboundValuesSchema,\n UsedComponentsSchema,\n} from '../v2023_09_28/common';\nimport { treeVisit } from '@/utils/treeVisit';\n\nexport const MAX_ALLOWED_PATHS = 200;\n\nexport const THUMBNAIL_IDS = [\n 'columns',\n 'columnsPlusRight',\n 'imagesSquare',\n 'subtitles',\n 'rowsPlusBottom',\n 'userRectangle',\n 'textbox',\n 'monitorPlay',\n 'article',\n 'table',\n 'star',\n 'heartStraight',\n 'frameCorners',\n 'rows',\n 'dotsThreeOutline',\n 'listDashes',\n 'checkerBoard',\n 'gridFour',\n 'slideshow',\n 'diamondsFour',\n 'cards',\n 'textColumns',\n 'duplex',\n] as const;\n\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nconst VariableMappingSchema = z.object({\n parameterId: propertyKeySchema,\n type: z.literal('ContentTypeMapping'),\n pathsByContentType: z\n .record(z.string(), z.object({ path: z.string() }))\n .superRefine((paths, ctx) => {\n const variableId = ctx.path[ctx.path.length - 2];\n if (Object.keys(paths).length > MAX_ALLOWED_PATHS) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Too many paths defined for variable mapping with id \"${variableId}\", maximum allowed is ${MAX_ALLOWED_PATHS}`,\n });\n }\n }),\n});\n\nexport const PassToNodeSchema = z\n .object({\n nodeId: propertyKeySchema,\n parameterId: propertyKeySchema,\n prebindingId: propertyKeySchema,\n })\n .strict();\n\nconst ParameterDefinitionSchema = z.object({\n defaultSource: z\n .strictObject({\n type: z.enum(['Entry']),\n contentTypeId: z.string(),\n link: z.strictObject({\n sys: z.strictObject({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry']),\n }),\n }),\n })\n .optional(),\n contentTypes: z.array(z.string()).min(1),\n passToNodes: z\n .array(PassToNodeSchema)\n .max(1, 'At most one \"passToNodes\" element is allowed per parameter definition.')\n .optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)\n});\n\nexport const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);\n\nconst VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);\n\nexport const ComponentVariablesSchema = z.record(\n z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length\n ComponentVariableSchema,\n);\n\nexport const PrebindingDefinitionSchema = z\n .object({\n id: propertyKeySchema,\n parameterDefinitions: ParameterDefinitionsSchema,\n variableMappings: VariableMappingsSchema.optional(),\n allowedVariableOverrides: z.array(z.string()).optional(),\n })\n .strict();\n\nconst ComponentSettingsSchema = z\n .object({\n variableDefinitions: ComponentVariablesSchema,\n thumbnailId: z.enum(THUMBNAIL_IDS).optional(),\n category: z.string().max(50, 'Category must contain at most 50 characters').optional(),\n prebindingDefinitions: z.array(PrebindingDefinitionSchema).length(1).optional(),\n })\n .strict()\n .superRefine((componentSettings, ctx) => {\n const { variableDefinitions, prebindingDefinitions } = componentSettings;\n if (!prebindingDefinitions || prebindingDefinitions.length === 0) {\n return;\n }\n const { parameterDefinitions, variableMappings, allowedVariableOverrides } =\n prebindingDefinitions[0];\n\n validateAtMostOneNativeParameterDefinition(parameterDefinitions, ctx);\n validateNoOverlapBetweenMappingAndOverrides(variableMappings, allowedVariableOverrides, ctx);\n validateMappingsAgainstVariableDefinitions(\n variableMappings,\n allowedVariableOverrides,\n variableDefinitions,\n ctx,\n );\n validateMappingsAgainstParameterDefinitions(variableMappings, parameterDefinitions, ctx);\n });\n\nexport const PatternFieldsCMAShapeSchema = z\n .object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n componentSettings: localeWrapper(ComponentSettingsSchema),\n })\n .superRefine((patternFields, ctx) => {\n const { componentTree, componentSettings } = patternFields;\n\n // values at this point are wrapped under locale code\n const nonLocalisedComponentTree = Object.values(componentTree)[0];\n const nonLocalisedComponentSettings = Object.values(componentSettings)[0];\n\n if (!nonLocalisedComponentSettings || !nonLocalisedComponentTree) {\n return;\n }\n\n validatePassToNodes(\n nonLocalisedComponentTree.children || ([] as z.infer<typeof ComponentTreeSchema>['children']),\n nonLocalisedComponentSettings || ({} as PatternComponentSettings),\n ctx,\n );\n });\n\nconst validateAtMostOneNativeParameterDefinition = (\n parameterDefinitions: Record<string, ParameterDefinition>,\n ctx: z.RefinementCtx,\n) => {\n const nativeParamDefinitions = Object.values(parameterDefinitions).filter(\n (paramDefinition) => !(paramDefinition.passToNodes && paramDefinition.passToNodes.length > 0),\n );\n\n if (nativeParamDefinitions.length > 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Only one native parameter definition (parameter definition without passToNodes) is allowed per prebinding definition.`,\n });\n }\n};\n\nconst validateNoOverlapBetweenMappingAndOverrides = (\n variableMappings: VariableMappings | undefined,\n allowedVariableOverrides: string[] | undefined,\n ctx: z.RefinementCtx,\n) => {\n const variableMappingKeys = Object.keys(variableMappings || {});\n const overridesSet = new Set(allowedVariableOverrides || []);\n const overlap = variableMappingKeys.filter((key) => overridesSet.has(key));\n if (overlap.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found both variable mapping and allowed override for the following keys: ${overlap.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\n\nconst validateMappingsAgainstVariableDefinitions = (\n variableMappings: VariableMappings | undefined,\n allowedVariableOverrides: string[] | undefined,\n variableDefinitions: Record<string, z.infer<typeof ComponentVariableSchema>>,\n ctx: z.RefinementCtx,\n) => {\n const nonDesignVariableDefinitionKeys = Object.entries(variableDefinitions)\n .filter(([_, def]) => def.group !== 'style')\n .map(([key]) => key);\n\n const variableMappingKeys = Object.keys(variableMappings || {});\n\n const allKeys = [...variableMappingKeys, ...(allowedVariableOverrides || [])];\n const invalidMappings = allKeys.filter((key) => !nonDesignVariableDefinitionKeys.includes(key));\n if (invalidMappings.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following variable mappings or overrides are missing from the variable definitions: ${invalidMappings.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\n\nconst validateMappingsAgainstParameterDefinitions = (\n variableMappings: VariableMappings | undefined,\n parameterDefinitions: ParameterDefinitions,\n ctx: z.RefinementCtx,\n) => {\n const parameterDefinitionKeys = Object.keys(parameterDefinitions || {});\n for (const [mappingKey, mappingValue] of Object.entries(variableMappings || {})) {\n if (!parameterDefinitionKeys.includes(mappingValue.parameterId)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The variable mapping with id \"${mappingKey}\" references a non-existing parameterId \"${mappingValue.parameterId}\".`,\n });\n }\n }\n};\n\nconst validatePassToNodes = (\n rootChildren: z.infer<typeof ComponentTreeSchema>['children'],\n componentSettings: PatternComponentSettings,\n ctx: z.RefinementCtx,\n) => {\n if (\n !componentSettings.prebindingDefinitions ||\n componentSettings.prebindingDefinitions.length === 0\n ) {\n return;\n }\n const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];\n\n let nodeIds: Set<string> = new Set();\n for (const paramDef of Object.values(parameterDefinitions || {})) {\n paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));\n }\n\n treeVisit(rootChildren, (node) => {\n if (!node.id) return;\n if (nodeIds.has(node.id)) {\n nodeIds.delete(node.id);\n }\n });\n\n if (nodeIds.size > 0) {\n const stringifiedNodeIds = Array.from(nodeIds)\n .map((id) => `\"${id}\"`)\n .join(', ');\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following node IDs referenced in passToNodes are not present in the component tree: ${stringifiedNodeIds}.`,\n });\n }\n};\n\nexport type PatternFields = z.infer<typeof PatternFieldsCMAShapeSchema>;\nexport type ParameterDefinition = z.infer<typeof ParameterDefinitionSchema>;\nexport type ParameterDefinitions = z.infer<typeof ParameterDefinitionsSchema>;\nexport type VariableMapping = z.infer<typeof VariableMappingSchema>;\nexport type VariableMappings = z.infer<typeof VariableMappingsSchema>;\nexport type PatternComponentSettings = z.infer<typeof ComponentSettingsSchema>;\nexport type PrebindingDefinition = z.infer<typeof PrebindingDefinitionSchema>;\n","import { z } from 'zod';\nimport {\n ComponentVariableSchema,\n DefinitionPropertyKeySchema,\n DefinitionPropertyTypeSchema,\n PrimitiveValueSchema,\n} from './v2023_09_28/common';\n\nexport const ComponentDefinitionSchema = z\n .object({\n id: DefinitionPropertyKeySchema,\n name: z.string(),\n category: z.string().optional(),\n thumbnailUrl: z.string().optional(),\n thumbnailId: z.string().optional(),\n hyperlinkPattern: z.string().optional(),\n children: z.boolean().optional(),\n slots: z\n .record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))\n .optional(),\n builtInStyles: z.array(z.string()).optional(),\n tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),\n variables: z.record(\n DefinitionPropertyKeySchema,\n ComponentVariableSchema.extend({\n defaultValue: PrimitiveValueSchema.optional(),\n }).superRefine((val, ctx) => {\n switch (val.type) {\n case 'Array':\n if (typeof val.defaultValue !== 'undefined') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Array\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Boolean':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'boolean') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a boolean when type is \"Boolean\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Date':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Date\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Hyperlink':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Hyperlink\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Link':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Link\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Location':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Location\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Media':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Media\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Number':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'number') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a number when type is \"Number\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Object':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Object\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'RichText':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"RichText\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Text':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Text\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n }\n }),\n ),\n })\n .superRefine((val, ctx) => {\n if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,\n fatal: false,\n });\n }\n // Ensure that slots and variables don't use the same names\n if (val.variables && val.slots) {\n Object.keys(val.variables).forEach((name) => {\n if (val.slots![name]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Variable and slot cannot have the same name: ${name}`,\n fatal: false,\n });\n }\n });\n }\n });\n\nexport type ComponentDefinitionPropertyType = z.infer<typeof DefinitionPropertyTypeSchema>;\nexport type ComponentDefinitionType = z.infer<typeof ComponentDefinitionSchema>;\n","import { ZodIssueCode, ZodIssue, z } from 'zod';\n\nexport enum CodeNames {\n Type = 'type',\n Required = 'required',\n Unexpected = 'unexpected',\n Regex = 'regex',\n In = 'in',\n Size = 'size',\n Custom = 'custom',\n}\n\nexport type ContentfulErrorDetails = {\n details: string;\n min?: number | bigint;\n max?: number | bigint;\n name: (typeof CodeNames)[keyof typeof CodeNames];\n path: (string | number)[];\n value?: string;\n expected?: (string | number)[];\n};\n\nconst convertInvalidType = (issue: z.ZodInvalidTypeIssue): ContentfulErrorDetails => {\n const name = issue.received === 'undefined' ? CodeNames.Required : CodeNames.Type;\n const details =\n issue.received === 'undefined'\n ? `The property \"${issue.path.slice(-1)}\" is required here`\n : `The type of \"${issue.path.slice(-1)}\" is incorrect, expected type: ${issue.expected}`;\n\n return {\n details: details,\n name: name,\n path: issue.path,\n value: issue.received.toString(),\n };\n};\n\nconst convertUnrecognizedKeys = (issue: z.ZodUnrecognizedKeysIssue): ContentfulErrorDetails => {\n const missingProperties = issue.keys.map((k) => `\"${k}\"`).join(', ');\n return {\n details:\n issue.keys.length > 1\n ? `The properties ${missingProperties} are not expected`\n : `The property ${missingProperties} is not expected`,\n name: CodeNames.Unexpected,\n path: issue.path,\n };\n};\n\nconst convertInvalidString = (issue: z.ZodInvalidStringIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Invalid string',\n name: issue.validation === 'regex' ? CodeNames.Regex : CodeNames.Unexpected,\n path: issue.path,\n };\n};\nconst convertInvalidEnumValue = (issue: z.ZodInvalidEnumValueIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received.toString(),\n expected: issue.options,\n };\n};\nconst convertInvalidLiteral = (issue: z.ZodInvalidLiteralIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received as string,\n expected: [issue.expected as string],\n };\n};\n\nconst convertTooBig = (issue: z.ZodTooBigIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || `Size should be at most ${issue.maximum}`,\n name: CodeNames.Size,\n path: issue.path,\n max: issue.maximum,\n };\n};\n\nconst convertTooSmall = (issue: z.ZodTooSmallIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || `Size should be at least ${issue.minimum}`,\n name: CodeNames.Size,\n path: issue.path,\n min: issue.minimum,\n };\n};\nconst defaultConversion = (issue: ZodIssue): ContentfulErrorDetails => {\n return {\n details: issue.message || 'An unexpected error occurred',\n name: CodeNames.Custom,\n path: issue.path.map(String),\n };\n};\n\nexport const zodToContentfulError = (issue: ZodIssue): ContentfulErrorDetails => {\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n return convertInvalidType(issue);\n case ZodIssueCode.unrecognized_keys:\n return convertUnrecognizedKeys(issue);\n case ZodIssueCode.invalid_enum_value:\n return convertInvalidEnumValue(issue);\n case ZodIssueCode.invalid_string:\n return convertInvalidString(issue);\n case ZodIssueCode.too_small:\n return convertTooSmall(issue);\n case ZodIssueCode.too_big:\n return convertTooBig(issue);\n case ZodIssueCode.invalid_literal:\n return convertInvalidLiteral(issue);\n default:\n return defaultConversion(issue);\n }\n};\n","import { z } from 'zod';\nimport { Breakpoint, BreakpointSchema, breakpointsRefinement } from '../schemas/latest';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { zodToContentfulError } from '@/utils/zodToContentfulError';\n\nexport const validateBreakpointsDefinition = (breakpoints: Breakpoint[]): ValidatorReturnValue => {\n const result = z\n .array(BreakpointSchema)\n .superRefine(breakpointsRefinement)\n .safeParse(breakpoints);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { ComponentDefinitionSchema } from '../schemas';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { zodToContentfulError } from '../utils/zodToContentfulError';\n\nexport const validateComponentDefinition = (definition): ValidatorReturnValue => {\n const result = ComponentDefinitionSchema.safeParse(definition);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { type SchemaVersions } from '../types';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { PatternSchema_2023_09_28 } from '../schemas';\nimport { zodToContentfulError, CodeNames } from '@/utils/zodToContentfulError';\n\nconst VERSION_SCHEMAS = {\n '2023-09-28': PatternSchema_2023_09_28,\n};\n\n/**\n *\n * @param pattern The pattern entry to validate\n * @param schemaVersionOverride Optional override for the schema version to validate against.\n * By default, the schema version is read from the pattern entry\n * @returns object with success property and optional errors array\n */\nexport const validatePatternFields = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- matches KeyValueMap in EntryProps['fields']\n pattern: { fields: Record<string, any> },\n schemaVersionOverride?: SchemaVersions,\n): ValidatorReturnValue => {\n let schemaVersion: SchemaVersions | undefined;\n\n if (schemaVersionOverride) {\n schemaVersion = schemaVersionOverride;\n } else if (pattern.fields.componentTree) {\n const locale = Object.keys(pattern.fields.componentTree)[0];\n schemaVersion = pattern.fields.componentTree[locale].schemaVersion;\n }\n\n const schema = schemaVersion && VERSION_SCHEMAS[schemaVersion];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n name: schemaVersion ? CodeNames.In : CodeNames.Required,\n expected: Object.keys(VERSION_SCHEMAS),\n value: schemaVersion,\n path: ['fields', 'componentTree', 'schemaVersion'],\n details: schemaVersion\n ? 'Unsupported schema version'\n : 'The property \"schemaVersion\" is required here',\n },\n ],\n };\n }\n\n const fieldsToValidate = {\n componentTree: pattern.fields.componentTree,\n dataSource: pattern.fields.dataSource,\n unboundValues: pattern.fields.unboundValues,\n usedComponents: pattern.fields.usedComponents,\n componentSettings: pattern.fields.componentSettings,\n };\n\n const result = schema.safeParse(fieldsToValidate);\n if (!result.success) {\n return {\n success: result.success,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n","import { type SchemaVersions } from '../types';\nimport { ValidatorReturnValue } from './ValidatorReturnValue';\nimport { ExperienceSchema_2023_09_28 } from '../schemas';\nimport { zodToContentfulError, CodeNames } from '@/utils/zodToContentfulError';\nimport { validatePatternFields } from '@/validators/validatePatternFields';\n\nconst VERSION_SCHEMAS = {\n '2023-09-28': ExperienceSchema_2023_09_28,\n};\n\n// TODO: fix typing when the Entry type is exposed\nfunction isPattern(experience: any): boolean {\n return experience.fields.componentSettings !== undefined;\n}\n\n/**\n *\n * @param experience The experience entry to validate\n * @param schemaVersionOverride Optional override for the schema version to validate against.\n * By default, the schema version is read from the experience entry\n * @returns object with success property and optional errors array\n */\nexport const validateExperienceFields = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- matches KeyValueMap in EntryProps['fields']\n experience: { fields: Record<string, any> },\n schemaVersionOverride?: SchemaVersions,\n): ValidatorReturnValue => {\n // If this is a pattern, use the pattern validator\n if (isPattern(experience)) {\n return validatePatternFields(experience, schemaVersionOverride);\n }\n\n let schemaVersion: SchemaVersions | undefined;\n if (schemaVersionOverride) {\n schemaVersion = schemaVersionOverride;\n } else if (experience.fields.componentTree) {\n const locale = Object.keys(experience.fields.componentTree)[0];\n schemaVersion = experience.fields.componentTree[locale].schemaVersion;\n }\n\n const schema = schemaVersion && VERSION_SCHEMAS[schemaVersion];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n name: schemaVersion ? CodeNames.In : CodeNames.Required,\n expected: ['2023-09-28'],\n value: schemaVersion,\n path: ['fields', 'componentTree', 'schemaVersion'],\n details: schemaVersion\n ? 'Unsupported schema version'\n : 'The property \"schemaVersion\" is required here',\n },\n ],\n };\n }\n\n const fieldsToValidate = {\n componentTree: experience.fields.componentTree,\n dataSource: experience.fields.dataSource,\n unboundValues: experience.fields.unboundValues,\n usedComponents: experience.fields.usedComponents,\n };\n\n const result = schema.safeParse(fieldsToValidate);\n if (!result.success) {\n return {\n success: result.success,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n"],"names":["VERSION_SCHEMAS","PatternSchema_2023_09_28","ExperienceSchema_2023_09_28"],"mappings":";;AACA;AACO,MAAM,cAAc,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAItD;AACyC,CAAC,CAAC,KAAK,CAAC;AAC/C,IAAA,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IAAA,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACvB,IAAA,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACxB,CAAA;;ACPM,MAAM,4BAA4B,GAAG,CAAC,CAAC,IAAI,CAAC;IACjD,MAAM;IACN,UAAU;IACV,QAAQ;IACR,MAAM;IACN,SAAS;IACT,UAAU;IACV,OAAO;IACP,QAAQ;IACR,WAAW;IACX,OAAO;IACP,MAAM;AACP,CAAA,CAAC,CAAC;AAEI,MAAM,2BAA2B,GAAG,CAAC;AACzC,KAAA,MAAM,EAAE;KACR,KAAK,CAAC,uBAAuB,EAAE,EAAE,OAAO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AAQ;oBACvD,QAAQ,EAAE,CAAC,YAAY,CAAC;AACxB,oBAAA,KAAK,EAAE,aAAa;AACpB,oBAAA,IAAI,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,eAAe,CAAC;AAClD,oBAAA,OAAO,EAAE,aAAa;AACpB,0BAAE,4BAA4B;AAC9B,0BAAE,+CAA+C;AACpD,iBAAA;AACF,aAAA;SACF,CAAC;KACH;AAED,IAAA,MAAM,gBAAgB,GAAG;AACvB,QAAA,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,aAAa;AAC9C,QAAA,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,UAAU;AACxC,QAAA,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,aAAa;AAC9C,QAAA,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,cAAc;KACjD,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAClD,IAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACnB,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;SACtD,CAAC;KACH;AACD,IAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-validators",
3
- "version": "3.7.1",
3
+ "version": "3.7.2-dev-20250924T1414-f20af61.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -51,5 +51,5 @@
51
51
  "publishConfig": {
52
52
  "registry": "https://npm.pkg.github.com/"
53
53
  },
54
- "gitHead": "6bf3b52adc830191d3d45eec3a4ed2db54d80617"
54
+ "gitHead": "c7e2aea76b17c0511d39a2da5067e90800f0a846"
55
55
  }