@json-to-office/shared-pptx 0.22.0 → 0.24.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.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -318,7 +318,7 @@ function isGenericUnionCatchAll(error) {
|
|
|
318
318
|
const atRoot = !error.path || error.path === "root" || error.path === "/";
|
|
319
319
|
if (!atRoot) return false;
|
|
320
320
|
const msg = error.message || "";
|
|
321
|
-
return /invalid
|
|
321
|
+
return /invalid component configurations?/i.test(msg) || /invalid document structure/i.test(msg);
|
|
322
322
|
}
|
|
323
323
|
function deduplicateErrors(errors) {
|
|
324
324
|
const seen = /* @__PURE__ */ new Set();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/validation/image-source-conflicts.ts","../src/validation/unified/index.ts","../src/validation/unified/deep-validator.ts","../src/index.ts"],"sourcesContent":["/**\n * Image source conflict detection (PPTX)\n *\n * Mirrors core-docx: `path`, `base64`, and `svg` are mutually exclusive on the\n * image component, but all three are optional fields on a single object schema —\n * so a multi-source payload passes the structural check and would otherwise be\n * silently resolved by runtime precedence (svg > base64 > path). This walk runs\n * unconditionally during validation and rejects such payloads. It traverses every\n * nested value, so images inside slides, grids, containers, and table cells are\n * all covered regardless of container shape.\n */\n\nimport type { ValidationError } from '@json-to-office/shared';\n\n// Image source fields that are mutually exclusive: exactly one may be set.\nconst IMAGE_SOURCE_FIELDS = ['path', 'base64', 'svg'] as const;\n\n/**\n * Names of the image source fields that carry a non-empty value on a props object.\n */\nexport function presentImageSources(props: unknown): string[] {\n if (!props || typeof props !== 'object') return [];\n const p = props as Record<string, unknown>;\n return IMAGE_SOURCE_FIELDS.filter((f) => {\n const v = p[f];\n return typeof v === 'string' && v.trim().length > 0;\n });\n}\n\n/**\n * Collect \"more than one image source\" conflicts anywhere in a presentation.\n */\nexport function collectImageSourceConflicts(data: unknown): ValidationError[] {\n const errors: ValidationError[] = [];\n\n const visit = (node: any, path: string): void => {\n if (Array.isArray(node)) {\n node.forEach((item, i) => visit(item, `${path}/${i}`));\n return;\n }\n if (!node || typeof node !== 'object') return;\n\n if (node.name === 'image') {\n const present = presentImageSources(node.props);\n if (present.length > 1) {\n errors.push({\n path: `${path}/props`,\n message: `Image component accepts only one source, but found ${present\n .map((f) => `\"${f}\"`)\n .join(', ')}. Use exactly one of \"path\", \"base64\", or \"svg\".`,\n code: 'mutually_exclusive',\n });\n }\n }\n\n for (const key of Object.keys(node)) {\n visit(node[key], `${path}/${key}`);\n }\n };\n\n visit(data, '');\n return errors;\n}\n","/**\n * Unified validation facade for PPTX.\n *\n * Mirrors the shared-docx `validate` / `validateStrict` API surface the CLI\n * consumes, so `jto pptx validate` gets real schema validation instead of the\n * historical unconditional pass.\n */\n\nimport { Value } from '@sinclair/typebox/value';\nimport type { ValidationError } from '@json-to-office/shared';\nimport { transformValueErrors } from '@json-to-office/shared';\nimport { ThemeConfigSchema } from '../../schemas/theme';\nimport { collectImageSourceConflicts } from '../image-source-conflicts';\nimport {\n comprehensiveValidatePresentation,\n type DeepValidateOptions,\n} from './deep-validator';\n\nexport {\n deepValidatePresentation,\n comprehensiveValidatePresentation,\n} from './deep-validator';\nexport type { DeepValidateOptions } from './deep-validator';\n\nexport interface PptxValidationResult {\n valid: boolean;\n errors: ValidationError[];\n warnings?: ValidationError[];\n documentType?: 'pptx';\n data?: unknown;\n}\n\nfunction parseJsonInput(jsonInput: string | object): {\n parsed?: unknown;\n error?: ValidationError;\n} {\n if (typeof jsonInput !== 'string') return { parsed: jsonInput };\n try {\n return { parsed: JSON.parse(jsonInput) };\n } catch (err: any) {\n return {\n error: {\n path: 'root',\n message: `Invalid JSON: ${err?.message ?? String(err)}`,\n code: 'json_parse_error',\n },\n };\n }\n}\n\n/**\n * Validate a presentation component tree.\n *\n * The deep walk is the source of truth: it re-implements everything the\n * recursive discriminated union checks (component names, per-component props\n * schemas, container narrowing) with precise paths, so we run it directly\n * instead of the union check whose failures collapse into a generic root\n * error. Image-source mutual exclusivity is a semantic rule the structural\n * schema cannot express, so it runs unconditionally on top.\n */\nexport function validatePresentationDocument(\n data: unknown,\n opts: DeepValidateOptions = {}\n): PptxValidationResult {\n const errors = comprehensiveValidatePresentation(data, [], opts);\n errors.push(...collectImageSourceConflicts(data));\n const valid = errors.length === 0;\n return {\n valid,\n errors,\n documentType: 'pptx',\n data: valid ? data : undefined,\n };\n}\n\n/**\n * Validate a presentation from a JSON string or object.\n */\nexport function validateJsonPresentationDocument(\n jsonInput: string | object,\n opts: DeepValidateOptions = {}\n): PptxValidationResult {\n const { parsed, error } = parseJsonInput(jsonInput);\n if (error) return { valid: false, errors: [error], documentType: 'pptx' };\n return validatePresentationDocument(parsed, opts);\n}\n\n/**\n * Validate a PPTX theme config.\n */\nexport function validatePptxTheme(data: unknown): PptxValidationResult {\n if (Value.Check(ThemeConfigSchema, data)) {\n return { valid: true, errors: [], data };\n }\n const valueErrors = [...Value.Errors(ThemeConfigSchema, data)];\n const errors = transformValueErrors(valueErrors, { maxErrors: 100 });\n return { valid: false, errors };\n}\n\n/**\n * Validate a PPTX theme from a JSON string or object.\n */\nexport function validateJsonPptxTheme(\n jsonInput: string | object\n): PptxValidationResult {\n const { parsed, error } = parseJsonInput(jsonInput);\n if (error) return { valid: false, errors: [error] };\n return validatePptxTheme(parsed);\n}\n\n/**\n * Simple validation API — the entry point the CLI consumes.\n */\nexport const validate = {\n document: (data: unknown) => validatePresentationDocument(data),\n jsonDocument: (jsonInput: string | object) =>\n validateJsonPresentationDocument(jsonInput),\n theme: (data: unknown) => validatePptxTheme(data),\n jsonTheme: (jsonInput: string | object) => validateJsonPptxTheme(jsonInput),\n isDocument: (data: unknown) => validatePresentationDocument(data).valid,\n isTheme: (data: unknown) => validatePptxTheme(data).valid,\n};\n\n/**\n * Strict validation API. PPTX deep validation never cleans or applies\n * defaults, so this is currently an alias kept for docx API parity — the CLI\n * picks one of the two based on its --strict flag.\n */\nexport const validateStrict = {\n document: (data: unknown) => validatePresentationDocument(data),\n jsonDocument: (jsonInput: string | object) =>\n validateJsonPresentationDocument(jsonInput),\n theme: (data: unknown) => validatePptxTheme(data),\n jsonTheme: (jsonInput: string | object) => validateJsonPptxTheme(jsonInput),\n};\n","/**\n * Deep validation utilities for collecting ALL errors in nested structures.\n *\n * Mirrors the docx deep validator: the recursive discriminated union\n * (PptxComponentDefinitionSchema) short-circuits on the first mismatch and\n * collapses failures into a generic root error, so this walk visits every\n * component in the tree and validates its props against the real per-component\n * schema, producing precise, path-aware errors.\n */\n\nimport { Value } from '@sinclair/typebox/value';\nimport type { TSchema } from '@sinclair/typebox';\nimport type { ValidationError } from '@json-to-office/shared';\nimport { transformValueErrors } from '@json-to-office/shared';\nimport {\n PPTX_STANDARD_COMPONENTS_REGISTRY,\n getPptxStandardComponent,\n} from '../../schemas/component-registry';\n\n// Map of component names to their props schemas, sourced from the registry.\n// This stays in sync as new standard components are added, so the presentation\n// root ('pptx') and every standard child component are recognized here.\nconst COMPONENT_SCHEMAS: Record<string, TSchema> = Object.fromEntries(\n PPTX_STANDARD_COMPONENTS_REGISTRY.map((c) => [c.name, c.propsSchema])\n);\n\n// Root component names that may appear at the top of a presentation.\nconst ROOT_COMPONENT_NAMES = new Set(\n PPTX_STANDARD_COMPONENTS_REGISTRY.filter((c) =>\n Boolean(c.special?.hasSchemaField)\n ).map((c) => c.name)\n);\n\n// Top-level keys allowed on a component object. The recursive union enforces\n// this via additionalProperties:false; the walk re-checks it so a typo like\n// \"porps\" is reported at a precise path instead of a generic union failure.\nconst COMPONENT_OBJECT_KEYS = new Set([\n 'name',\n 'id',\n 'enabled',\n 'props',\n 'children',\n]);\nconst CUSTOM_COMPONENT_OBJECT_KEYS = new Set([\n ...COMPONENT_OBJECT_KEYS,\n 'version',\n]);\nconst ROOT_OBJECT_KEYS = new Set([...COMPONENT_OBJECT_KEYS, '$schema']);\n\n/**\n * Options that tune deep validation.\n *\n * `knownCustomNames` — names of registered plugin components. The deep\n * validator neither flags these as \"unknown component\" nor validates their\n * props here; the plugin layer validates custom props separately.\n *\n * `allowUnknownFields` — when true, unknown properties are stripped before the\n * per-component check instead of being rejected. The escape hatch for callers\n * migrating onto strict schemas.\n */\nexport interface DeepValidateOptions {\n knownCustomNames?: Set<string>;\n allowUnknownFields?: boolean;\n}\n\n/**\n * Deep validate a presentation to collect ALL errors, not just union-level errors.\n */\nexport function deepValidatePresentation(\n data: any,\n opts: DeepValidateOptions = {}\n): ValidationError[] {\n const allErrors: ValidationError[] = [];\n\n if (!data || typeof data !== 'object') {\n allErrors.push({\n path: 'root',\n message: 'Presentation must be an object',\n code: 'invalid_type',\n });\n return allErrors;\n }\n\n if (!data.name) {\n allErrors.push({\n path: '/name',\n message: 'Missing required field \"name\"',\n code: 'required_property',\n });\n } else if (!ROOT_COMPONENT_NAMES.has(data.name)) {\n const expected = [...ROOT_COMPONENT_NAMES].map((n) => `\"${n}\"`).join(', ');\n allErrors.push({\n path: '/name',\n message: `Invalid name \"${data.name}\". Expected ${expected}`,\n code: 'invalid_value',\n });\n }\n\n for (const key of Object.keys(data)) {\n if (!ROOT_OBJECT_KEYS.has(key)) {\n allErrors.push({\n path: `/${key}`,\n message: `Unknown field \"${key}\" on the root component`,\n code: 'unknown_field',\n });\n }\n }\n\n // Validate props when the key is present so explicit `null` (or any falsy\n // non-object) is checked against the component's schema instead of silently\n // passing.\n if (!('props' in data)) {\n allErrors.push({\n path: '/props',\n message: 'Missing required field \"props\"',\n code: 'required_property',\n });\n } else if (ROOT_COMPONENT_NAMES.has(data.name)) {\n allErrors.push(\n ...validateComponentProps(data.name, data.props, '/props', opts)\n );\n }\n\n // The root requires a children array (the slides); nested containers may\n // legitimately omit theirs.\n if (!data.children) {\n allErrors.push({\n path: '/children',\n message: 'Missing required field \"children\"',\n code: 'required_property',\n });\n } else if (!Array.isArray(data.children)) {\n allErrors.push({\n path: '/children',\n message: 'Field \"children\" must be an array',\n code: 'invalid_type',\n });\n }\n\n walkComponentTree(data, '', opts, allErrors);\n\n return allErrors;\n}\n\n/**\n * Recursively validate every component nested under `node`.\n *\n * Walks two kinds of child position to any depth:\n * - the `children` array — `pptx` holds slides, `slide` holds content\n * components. The registry's `allowedChildren` narrows what each container\n * accepts, and leaf components must not carry children at all; and\n * - a slide's `props.placeholders` record — added dynamically by the\n * component registry on top of the static SlidePropsSchema, so its values\n * are not covered by the slide's own props validation and this walk is\n * their only checker.\n *\n * The node's own props are NOT validated here — the caller validates the root\n * props, and every entry is validated as it is visited.\n */\nfunction walkComponentTree(\n node: any,\n path: string,\n opts: DeepValidateOptions,\n errors: ValidationError[]\n): void {\n if (!node || typeof node !== 'object') return;\n\n const validateEntry = (child: any, childPath: string): void => {\n if (!child || typeof child !== 'object' || Array.isArray(child)) {\n errors.push({\n path: childPath,\n message: 'Component must be an object',\n code: 'invalid_type',\n });\n return;\n }\n if (typeof child.name !== 'string' || child.name.length === 0) {\n errors.push({\n path: `${childPath}/name`,\n message: 'Component missing required field \"name\"',\n code: 'required_property',\n });\n return;\n }\n\n // Registered plugin props are validated version-aware by the plugin layer.\n // Their children still need walking: custom containers may hold authored\n // standard components, and those must obey the same prop/tree contract as\n // standard components elsewhere in the presentation.\n const isCustomComponent = opts.knownCustomNames?.has(child.name) ?? false;\n const allowedObjectKeys = isCustomComponent\n ? CUSTOM_COMPONENT_OBJECT_KEYS\n : COMPONENT_OBJECT_KEYS;\n\n for (const key of Object.keys(child)) {\n if (!allowedObjectKeys.has(key)) {\n errors.push({\n path: `${childPath}/${key}`,\n message: `Unknown field \"${key}\" on component \"${child.name}\"`,\n code: 'unknown_field',\n });\n }\n }\n\n if (isCustomComponent) {\n walkComponentTree(child, childPath, opts, errors);\n return;\n }\n\n // Validate props against the component's schema. When props is omitted,\n // validate an empty object so the schema decides whether props are\n // required (e.g. `slide` needs none; `text` requires text).\n const propsPath = `${childPath}/props`;\n if (child.props != null) {\n errors.push(\n ...validateComponentProps(child.name, child.props, propsPath, opts)\n );\n } else {\n errors.push(...validateComponentProps(child.name, {}, propsPath, opts));\n }\n\n const def = getPptxStandardComponent(child.name);\n if (def && !def.hasChildren && child.children != null) {\n errors.push({\n path: `${childPath}/children`,\n message: `Component \"${child.name}\" does not accept children`,\n code: 'invalid_value',\n });\n return;\n }\n\n // Recurse so arbitrarily nested containers are covered.\n walkComponentTree(child, childPath, opts, errors);\n };\n\n const parentDef = getPptxStandardComponent(node.name);\n\n // A slide's `placeholders` record maps placeholder names to full components\n // ({ \"title\": { \"name\": \"text\", ... } }). The static SlidePropsSchema does\n // not include the field (it is injected with the recursive ref at schema\n // generation time), so validateComponentProps strips it before checking the\n // slide's own props — each value is validated here instead.\n if (node.name === 'slide' && node.props && typeof node.props === 'object') {\n const placeholders = node.props.placeholders;\n if (\n placeholders &&\n typeof placeholders === 'object' &&\n !Array.isArray(placeholders)\n ) {\n for (const [key, child] of Object.entries(placeholders)) {\n validateEntry(child, `${path}/props/placeholders/${key}`);\n }\n } else if (placeholders != null) {\n errors.push({\n path: `${path}/props/placeholders`,\n message:\n 'Field \"placeholders\" must be an object mapping placeholder names to components',\n code: 'invalid_type',\n });\n }\n }\n\n if (Array.isArray(node.children)) {\n node.children.forEach((child: any, i: number) => {\n const childPath = `${path}/children/${i}`;\n // Enforce the registry's container narrowing (pptx → slide,\n // slide → content) for known components; unknown names are already\n // reported by validateComponentProps inside validateEntry.\n if (\n parentDef?.allowedChildren &&\n child &&\n typeof child === 'object' &&\n typeof child.name === 'string' &&\n getPptxStandardComponent(child.name) &&\n !parentDef.allowedChildren.includes(child.name)\n ) {\n const expected = parentDef.allowedChildren\n .map((n) => `\"${n}\"`)\n .join(', ');\n errors.push({\n path: `${childPath}/name`,\n message: `Component \"${child.name}\" is not allowed inside \"${node.name}\". Expected ${expected}`,\n code: 'invalid_value',\n });\n }\n validateEntry(child, childPath);\n });\n } else if (node.children != null && path !== '') {\n // `children` is present but not an array on a nested container. The root's\n // `children` is already checked by deepValidatePresentation (skipped here\n // via `path !== ''` so it is not reported twice).\n errors.push({\n path: `${path}/children`,\n message: 'Field \"children\" must be an array',\n code: 'invalid_type',\n });\n }\n}\n\n/**\n * Validate a component's props against its schema.\n */\nfunction validateComponentProps(\n componentName: string,\n props: any,\n basePath: string,\n opts: DeepValidateOptions = {}\n): ValidationError[] {\n const errors: ValidationError[] = [];\n\n const schema = COMPONENT_SCHEMAS[componentName];\n if (!schema) {\n // Unknown component type. `basePath` always ends in `/props`; anchor the\n // swap to the end so a nested path like `…/props/placeholders/title/props`\n // becomes `…/props/placeholders/title/name` rather than mangling an\n // earlier `/props`.\n errors.push({\n path: basePath.replace(/\\/props$/, '/name'),\n message: `Unknown component \"${componentName}\"`,\n code: 'unknown_component',\n });\n return errors;\n }\n\n // A slide's `placeholders` field is injected at schema-generation time and\n // absent from the static props schema; its values are walked separately, so\n // strip it here to avoid a false additionalProperties rejection.\n let toCheck = props;\n if (\n componentName === 'slide' &&\n props &&\n typeof props === 'object' &&\n 'placeholders' in props\n ) {\n const rest = { ...props };\n delete rest.placeholders;\n toCheck = rest;\n }\n\n // When unknown fields are explicitly allowed, strip them before checking so\n // additionalProperties:false no longer rejects — required/typed fields are\n // still enforced.\n if (opts.allowUnknownFields) {\n toCheck = Value.Clean(schema, Value.Clone(toCheck));\n }\n\n if (!Value.Check(schema, toCheck)) {\n const valueErrors = [...Value.Errors(schema, toCheck)];\n const transformedErrors = transformValueErrors(valueErrors, {\n maxErrors: 100,\n });\n\n // Adjust paths to be relative to the document root\n transformedErrors.forEach((error) => {\n const fullPath =\n error.path === 'root'\n ? basePath\n : `${basePath}${error.path.startsWith('/') ? error.path : '/' + error.path}`;\n\n errors.push({\n ...error,\n path: fullPath,\n });\n });\n }\n\n return errors;\n}\n\n/**\n * Combine deep validation with standard validation.\n *\n * Deep validation produces precise, path-aware errors. TypeBox's discriminated-\n * union check, by contrast, often collapses any failure under the root into a\n * single generic \"Invalid component configuration for 'pptx'\" message at\n * `root` — useful as a signal that something is wrong, but actionable only via\n * the deep-validator's output. We always strip that catch-all so it doesn't\n * appear alongside (or, worse, instead of) the real diagnostics.\n */\nexport function comprehensiveValidatePresentation(\n data: any,\n existingErrors: ValidationError[] = [],\n opts: DeepValidateOptions = {}\n): ValidationError[] {\n const deepErrors = deepValidatePresentation(data, opts);\n\n const filteredExisting = existingErrors.filter(\n (e) => !isGenericUnionCatchAll(e)\n );\n\n return deduplicateErrors([...filteredExisting, ...deepErrors]);\n}\n\n/**\n * Detect TypeBox's generic union/discriminator catch-all error at the document\n * root. These messages name the component type ('pptx') but give no actionable\n * detail — the deep validator emits the actual path-level errors instead.\n */\nfunction isGenericUnionCatchAll(error: ValidationError): boolean {\n const atRoot = !error.path || error.path === 'root' || error.path === '/';\n if (!atRoot) return false;\n const msg = error.message || '';\n return (\n /invalid (component|module) configurations?/i.test(msg) ||\n /invalid document structure/i.test(msg)\n );\n}\n\n/**\n * Deduplicate errors by path and message.\n */\nfunction deduplicateErrors(errors: ValidationError[]): ValidationError[] {\n const seen = new Set<string>();\n const unique: ValidationError[] = [];\n\n for (const error of errors) {\n const key = `${error.path}:${error.message}`;\n if (!seen.has(key)) {\n seen.add(key);\n unique.push(error);\n }\n }\n\n return unique;\n}\n","export const PPTX_SHARED_VERSION = '1.0.0';\n\n// Component Schemas\nexport {\n PositionSchema,\n SlideBackgroundSchema,\n TransitionSchema,\n VerticalAlignmentSchema,\n ShadowSchema,\n PresentationPropsSchema,\n SlidePropsSchema,\n TextPropsSchema,\n PptxImagePropsSchema,\n ShapePropsSchema,\n ShapeTypeSchema,\n PptxTablePropsSchema,\n PptxHighchartsPropsSchema,\n PptxStandardComponentDefinitionSchema,\n PptxComponentDefinitionSchema,\n PptxSlideContentSchema,\n} from './schemas/components';\n\nexport type {\n Position,\n SlideBackground,\n Transition,\n VerticalAlignment,\n Shadow,\n PresentationProps,\n SlideProps,\n TextProps,\n PptxImageProps,\n ShapeType,\n ShapeProps,\n TextSegment,\n PptxTableProps,\n PptxHighchartsProps,\n PptxComponentDefinition,\n PptxSlideContent,\n} from './schemas/components';\n\n// Chart (not re-exported from components barrel)\nexport { PptxChartPropsSchema } from './schemas/components/chart';\nexport type { PptxChartProps } from './schemas/components/chart';\n\n// Component Registry\nexport {\n PPTX_STANDARD_COMPONENTS_REGISTRY,\n getPptxStandardComponent,\n getAllPptxComponentNames,\n getPptxComponentsByCategory,\n getPptxContainerComponents,\n getPptxContentComponents,\n isPptxStandardComponent,\n createPptxComponentSchemaObject,\n createAllPptxComponentSchemas,\n} from './schemas/component-registry';\n\nexport type { PptxStandardComponentDefinition } from './schemas/component-registry';\n\n// Document Schema\nexport {\n PptxJsonComponentDefinitionSchema,\n PPTX_JSON_SCHEMA_URLS,\n} from './schemas/document';\n\nexport type { PptxJsonComponentDefinition } from './schemas/document';\n\n// Schema Export Metadata\nexport {\n PPTX_COMPONENT_METADATA,\n PPTX_BASE_SCHEMA_METADATA,\n} from './schemas/export';\n\n// Component Defaults\nexport {\n PptxComponentDefaultsSchema,\n TextComponentDefaultsSchema,\n ImageComponentDefaultsSchema,\n ShapeComponentDefaultsSchema,\n TableComponentDefaultsSchema,\n HighchartsComponentDefaultsSchema,\n ChartComponentDefaultsSchema,\n} from './schemas/component-defaults';\nexport type {\n PptxComponentDefaults,\n TextComponentDefaults,\n ImageComponentDefaults,\n ShapeComponentDefaults,\n TableComponentDefaults,\n HighchartsComponentDefaults,\n ChartComponentDefaults,\n} from './schemas/component-defaults';\n\n// Theme\nexport {\n ThemeConfigSchema,\n ColorValueSchema,\n SEMANTIC_COLOR_NAMES,\n SEMANTIC_COLOR_ALIASES,\n STYLE_NAMES,\n StyleNameSchema,\n TextStyleSchema,\n isValidThemeConfig,\n} from './schemas/theme';\nexport type { ThemeConfigJson, StyleName, TextStyle } from './schemas/theme';\n\n// Schema Generator\nexport { generateUnifiedDocumentSchema } from './schemas/generator';\nexport type {\n VersionedPropsEntry,\n CustomComponentInfo,\n GenerateSchemaOptions,\n} from './schemas/generator';\n\n// Types\nexport type { ReportComponent } from './types/components';\n\n// Image source conflict detection (path/base64/svg mutual exclusivity)\nexport {\n collectImageSourceConflicts,\n presentImageSources,\n} from './validation/image-source-conflicts';\n\n// Unified validation facade (deep, path-aware validation of whole presentations\n// and themes) — the API the CLI's `pptx validate` consumes.\nexport {\n validate,\n validateStrict,\n validatePresentationDocument,\n validateJsonPresentationDocument,\n validatePptxTheme,\n validateJsonPptxTheme,\n deepValidatePresentation,\n comprehensiveValidatePresentation,\n} from './validation/unified';\nexport type {\n PptxValidationResult,\n DeepValidateOptions,\n} from './validation/unified';\n\n// Re-export shared validation utilities for convenience\nexport {\n transformValueError,\n transformValueErrors,\n DEFAULT_ERROR_CONFIG,\n createErrorConfig,\n} from '@json-to-office/shared';\n\nexport type {\n ErrorFormatterConfig,\n ValidationError,\n} from '@json-to-office/shared';\n\n// Re-export shared utilities\nexport {\n latestVersion,\n isValidSemver,\n parseSemver,\n compareSemver,\n} from '@json-to-office/shared';\nexport type { ParsedSemver } from '@json-to-office/shared';\n\n// Re-export schema utils\nexport {\n fixSchemaReferences,\n convertToJsonSchema,\n createComponentSchema,\n exportSchemaToFile,\n} from '@json-to-office/shared';\nexport type { ComponentSchemaConfig } from '@json-to-office/shared';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAM,sBAAsB,CAAC,QAAQ,UAAU,KAAK;AAK7C,SAAS,oBAAoB,OAA0B;AAC5D,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO,CAAC;AACjD,QAAM,IAAI;AACV,SAAO,oBAAoB,OAAO,CAAC,MAAM;AACvC,UAAM,IAAI,EAAE,CAAC;AACb,WAAO,OAAO,MAAM,YAAY,EAAE,KAAK,EAAE,SAAS;AAAA,EACpD,CAAC;AACH;AAKO,SAAS,4BAA4B,MAAkC;AAC5E,QAAM,SAA4B,CAAC;AAEnC,QAAM,QAAQ,C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E,SAAS,CAAC,SAAkB,kBAAkB,IAAI,EAAE;AACtD;AAOO,IAAM,iBAAiB;AAAA,EAC5B,UAAU,CAAC,SAAkB,6BAA6B,IAAI;AAAA,EAC9D,cAAc,CAAC,cACb,iCAAiC,SAAS;AAAA,EAC5C,OAAO,CAAC,SAAkB,kBAAkB,IAAI;AAAA,EAChD,WAAW,CAAC,cAA+B,sBAAsB,SAAS;AAC5E;;;AEQA;AAAA,EACE;AAAA,EACA,wBAAAC;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAzKA,IAAM,sBAAsB;","names":["Value","transformValueErrors","Value","transformValueErrors","transformValueErrors"]}
|
|
1
|
+
{"version":3,"sources":["../src/validation/image-source-conflicts.ts","../src/validation/unified/index.ts","../src/validation/unified/deep-validator.ts","../src/index.ts"],"sourcesContent":["/**\n * Image source conflict detection (PPTX)\n *\n * Mirrors core-docx: `path`, `base64`, and `svg` are mutually exclusive on the\n * image component, but all three are optional fields on a single object schema —\n * so a multi-source payload passes the structural check and would otherwise be\n * silently resolved by runtime precedence (svg > base64 > path). This walk runs\n * unconditionally during validation and rejects such payloads. It traverses every\n * nested value, so images inside slides, grids, containers, and table cells are\n * all covered regardless of container shape.\n */\n\nimport type { ValidationError } from '@json-to-office/shared';\n\n// Image source fields that are mutually exclusive: exactly one may be set.\nconst IMAGE_SOURCE_FIELDS = ['path', 'base64', 'svg'] as const;\n\n/**\n * Names of the image source fields that carry a non-empty value on a props object.\n */\nexport function presentImageSources(props: unknown): string[] {\n if (!props || typeof props !== 'object') return [];\n const p = props as Record<string, unknown>;\n return IMAGE_SOURCE_FIELDS.filter((f) => {\n const v = p[f];\n return typeof v === 'string' && v.trim().length > 0;\n });\n}\n\n/**\n * Collect \"more than one image source\" conflicts anywhere in a presentation.\n */\nexport function collectImageSourceConflicts(data: unknown): ValidationError[] {\n const errors: ValidationError[] = [];\n\n const visit = (node: any, path: string): void => {\n if (Array.isArray(node)) {\n node.forEach((item, i) => visit(item, `${path}/${i}`));\n return;\n }\n if (!node || typeof node !== 'object') return;\n\n if (node.name === 'image') {\n const present = presentImageSources(node.props);\n if (present.length > 1) {\n errors.push({\n path: `${path}/props`,\n message: `Image component accepts only one source, but found ${present\n .map((f) => `\"${f}\"`)\n .join(', ')}. Use exactly one of \"path\", \"base64\", or \"svg\".`,\n code: 'mutually_exclusive',\n });\n }\n }\n\n for (const key of Object.keys(node)) {\n visit(node[key], `${path}/${key}`);\n }\n };\n\n visit(data, '');\n return errors;\n}\n","/**\n * Unified validation facade for PPTX.\n *\n * Mirrors the shared-docx `validate` / `validateStrict` API surface the CLI\n * consumes, so `jto pptx validate` gets real schema validation instead of the\n * historical unconditional pass.\n */\n\nimport { Value } from '@sinclair/typebox/value';\nimport type { ValidationError } from '@json-to-office/shared';\nimport { transformValueErrors } from '@json-to-office/shared';\nimport { ThemeConfigSchema } from '../../schemas/theme';\nimport { collectImageSourceConflicts } from '../image-source-conflicts';\nimport {\n comprehensiveValidatePresentation,\n type DeepValidateOptions,\n} from './deep-validator';\n\nexport {\n deepValidatePresentation,\n comprehensiveValidatePresentation,\n} from './deep-validator';\nexport type { DeepValidateOptions } from './deep-validator';\n\nexport interface PptxValidationResult {\n valid: boolean;\n errors: ValidationError[];\n warnings?: ValidationError[];\n documentType?: 'pptx';\n data?: unknown;\n}\n\nfunction parseJsonInput(jsonInput: string | object): {\n parsed?: unknown;\n error?: ValidationError;\n} {\n if (typeof jsonInput !== 'string') return { parsed: jsonInput };\n try {\n return { parsed: JSON.parse(jsonInput) };\n } catch (err: any) {\n return {\n error: {\n path: 'root',\n message: `Invalid JSON: ${err?.message ?? String(err)}`,\n code: 'json_parse_error',\n },\n };\n }\n}\n\n/**\n * Validate a presentation component tree.\n *\n * The deep walk is the source of truth: it re-implements everything the\n * recursive discriminated union checks (component names, per-component props\n * schemas, container narrowing) with precise paths, so we run it directly\n * instead of the union check whose failures collapse into a generic root\n * error. Image-source mutual exclusivity is a semantic rule the structural\n * schema cannot express, so it runs unconditionally on top.\n */\nexport function validatePresentationDocument(\n data: unknown,\n opts: DeepValidateOptions = {}\n): PptxValidationResult {\n const errors = comprehensiveValidatePresentation(data, [], opts);\n errors.push(...collectImageSourceConflicts(data));\n const valid = errors.length === 0;\n return {\n valid,\n errors,\n documentType: 'pptx',\n data: valid ? data : undefined,\n };\n}\n\n/**\n * Validate a presentation from a JSON string or object.\n */\nexport function validateJsonPresentationDocument(\n jsonInput: string | object,\n opts: DeepValidateOptions = {}\n): PptxValidationResult {\n const { parsed, error } = parseJsonInput(jsonInput);\n if (error) return { valid: false, errors: [error], documentType: 'pptx' };\n return validatePresentationDocument(parsed, opts);\n}\n\n/**\n * Validate a PPTX theme config.\n */\nexport function validatePptxTheme(data: unknown): PptxValidationResult {\n if (Value.Check(ThemeConfigSchema, data)) {\n return { valid: true, errors: [], data };\n }\n const valueErrors = [...Value.Errors(ThemeConfigSchema, data)];\n const errors = transformValueErrors(valueErrors, { maxErrors: 100 });\n return { valid: false, errors };\n}\n\n/**\n * Validate a PPTX theme from a JSON string or object.\n */\nexport function validateJsonPptxTheme(\n jsonInput: string | object\n): PptxValidationResult {\n const { parsed, error } = parseJsonInput(jsonInput);\n if (error) return { valid: false, errors: [error] };\n return validatePptxTheme(parsed);\n}\n\n/**\n * Simple validation API — the entry point the CLI consumes.\n */\nexport const validate = {\n document: (data: unknown) => validatePresentationDocument(data),\n jsonDocument: (jsonInput: string | object) =>\n validateJsonPresentationDocument(jsonInput),\n theme: (data: unknown) => validatePptxTheme(data),\n jsonTheme: (jsonInput: string | object) => validateJsonPptxTheme(jsonInput),\n isDocument: (data: unknown) => validatePresentationDocument(data).valid,\n isTheme: (data: unknown) => validatePptxTheme(data).valid,\n};\n\n/**\n * Strict validation API. PPTX deep validation never cleans or applies\n * defaults, so this is currently an alias kept for docx API parity — the CLI\n * picks one of the two based on its --strict flag.\n */\nexport const validateStrict = {\n document: (data: unknown) => validatePresentationDocument(data),\n jsonDocument: (jsonInput: string | object) =>\n validateJsonPresentationDocument(jsonInput),\n theme: (data: unknown) => validatePptxTheme(data),\n jsonTheme: (jsonInput: string | object) => validateJsonPptxTheme(jsonInput),\n};\n","/**\n * Deep validation utilities for collecting ALL errors in nested structures.\n *\n * Mirrors the docx deep validator: the recursive discriminated union\n * (PptxComponentDefinitionSchema) short-circuits on the first mismatch and\n * collapses failures into a generic root error, so this walk visits every\n * component in the tree and validates its props against the real per-component\n * schema, producing precise, path-aware errors.\n */\n\nimport { Value } from '@sinclair/typebox/value';\nimport type { TSchema } from '@sinclair/typebox';\nimport type { ValidationError } from '@json-to-office/shared';\nimport { transformValueErrors } from '@json-to-office/shared';\nimport {\n PPTX_STANDARD_COMPONENTS_REGISTRY,\n getPptxStandardComponent,\n} from '../../schemas/component-registry';\n\n// Map of component names to their props schemas, sourced from the registry.\n// This stays in sync as new standard components are added, so the presentation\n// root ('pptx') and every standard child component are recognized here.\nconst COMPONENT_SCHEMAS: Record<string, TSchema> = Object.fromEntries(\n PPTX_STANDARD_COMPONENTS_REGISTRY.map((c) => [c.name, c.propsSchema])\n);\n\n// Root component names that may appear at the top of a presentation.\nconst ROOT_COMPONENT_NAMES = new Set(\n PPTX_STANDARD_COMPONENTS_REGISTRY.filter((c) =>\n Boolean(c.special?.hasSchemaField)\n ).map((c) => c.name)\n);\n\n// Top-level keys allowed on a component object. The recursive union enforces\n// this via additionalProperties:false; the walk re-checks it so a typo like\n// \"porps\" is reported at a precise path instead of a generic union failure.\nconst COMPONENT_OBJECT_KEYS = new Set([\n 'name',\n 'id',\n 'enabled',\n 'props',\n 'children',\n]);\nconst CUSTOM_COMPONENT_OBJECT_KEYS = new Set([\n ...COMPONENT_OBJECT_KEYS,\n 'version',\n]);\nconst ROOT_OBJECT_KEYS = new Set([...COMPONENT_OBJECT_KEYS, '$schema']);\n\n/**\n * Options that tune deep validation.\n *\n * `knownCustomNames` — names of registered plugin components. The deep\n * validator neither flags these as \"unknown component\" nor validates their\n * props here; the plugin layer validates custom props separately.\n *\n * `allowUnknownFields` — when true, unknown properties are stripped before the\n * per-component check instead of being rejected. The escape hatch for callers\n * migrating onto strict schemas.\n */\nexport interface DeepValidateOptions {\n knownCustomNames?: Set<string>;\n allowUnknownFields?: boolean;\n}\n\n/**\n * Deep validate a presentation to collect ALL errors, not just union-level errors.\n */\nexport function deepValidatePresentation(\n data: any,\n opts: DeepValidateOptions = {}\n): ValidationError[] {\n const allErrors: ValidationError[] = [];\n\n if (!data || typeof data !== 'object') {\n allErrors.push({\n path: 'root',\n message: 'Presentation must be an object',\n code: 'invalid_type',\n });\n return allErrors;\n }\n\n if (!data.name) {\n allErrors.push({\n path: '/name',\n message: 'Missing required field \"name\"',\n code: 'required_property',\n });\n } else if (!ROOT_COMPONENT_NAMES.has(data.name)) {\n const expected = [...ROOT_COMPONENT_NAMES].map((n) => `\"${n}\"`).join(', ');\n allErrors.push({\n path: '/name',\n message: `Invalid name \"${data.name}\". Expected ${expected}`,\n code: 'invalid_value',\n });\n }\n\n for (const key of Object.keys(data)) {\n if (!ROOT_OBJECT_KEYS.has(key)) {\n allErrors.push({\n path: `/${key}`,\n message: `Unknown field \"${key}\" on the root component`,\n code: 'unknown_field',\n });\n }\n }\n\n // Validate props when the key is present so explicit `null` (or any falsy\n // non-object) is checked against the component's schema instead of silently\n // passing.\n if (!('props' in data)) {\n allErrors.push({\n path: '/props',\n message: 'Missing required field \"props\"',\n code: 'required_property',\n });\n } else if (ROOT_COMPONENT_NAMES.has(data.name)) {\n allErrors.push(\n ...validateComponentProps(data.name, data.props, '/props', opts)\n );\n }\n\n // The root requires a children array (the slides); nested containers may\n // legitimately omit theirs.\n if (!data.children) {\n allErrors.push({\n path: '/children',\n message: 'Missing required field \"children\"',\n code: 'required_property',\n });\n } else if (!Array.isArray(data.children)) {\n allErrors.push({\n path: '/children',\n message: 'Field \"children\" must be an array',\n code: 'invalid_type',\n });\n }\n\n walkComponentTree(data, '', opts, allErrors);\n\n return allErrors;\n}\n\n/**\n * Recursively validate every component nested under `node`.\n *\n * Walks two kinds of child position to any depth:\n * - the `children` array — `pptx` holds slides, `slide` holds content\n * components. The registry's `allowedChildren` narrows what each container\n * accepts, and leaf components must not carry children at all; and\n * - a slide's `props.placeholders` record — added dynamically by the\n * component registry on top of the static SlidePropsSchema, so its values\n * are not covered by the slide's own props validation and this walk is\n * their only checker.\n *\n * The node's own props are NOT validated here — the caller validates the root\n * props, and every entry is validated as it is visited.\n */\nfunction walkComponentTree(\n node: any,\n path: string,\n opts: DeepValidateOptions,\n errors: ValidationError[]\n): void {\n if (!node || typeof node !== 'object') return;\n\n const validateEntry = (child: any, childPath: string): void => {\n if (!child || typeof child !== 'object' || Array.isArray(child)) {\n errors.push({\n path: childPath,\n message: 'Component must be an object',\n code: 'invalid_type',\n });\n return;\n }\n if (typeof child.name !== 'string' || child.name.length === 0) {\n errors.push({\n path: `${childPath}/name`,\n message: 'Component missing required field \"name\"',\n code: 'required_property',\n });\n return;\n }\n\n // Registered plugin props are validated version-aware by the plugin layer.\n // Their children still need walking: custom containers may hold authored\n // standard components, and those must obey the same prop/tree contract as\n // standard components elsewhere in the presentation.\n const isCustomComponent = opts.knownCustomNames?.has(child.name) ?? false;\n const allowedObjectKeys = isCustomComponent\n ? CUSTOM_COMPONENT_OBJECT_KEYS\n : COMPONENT_OBJECT_KEYS;\n\n for (const key of Object.keys(child)) {\n if (!allowedObjectKeys.has(key)) {\n errors.push({\n path: `${childPath}/${key}`,\n message: `Unknown field \"${key}\" on component \"${child.name}\"`,\n code: 'unknown_field',\n });\n }\n }\n\n if (isCustomComponent) {\n walkComponentTree(child, childPath, opts, errors);\n return;\n }\n\n // Validate props against the component's schema. When props is omitted,\n // validate an empty object so the schema decides whether props are\n // required (e.g. `slide` needs none; `text` requires text).\n const propsPath = `${childPath}/props`;\n if (child.props != null) {\n errors.push(\n ...validateComponentProps(child.name, child.props, propsPath, opts)\n );\n } else {\n errors.push(...validateComponentProps(child.name, {}, propsPath, opts));\n }\n\n const def = getPptxStandardComponent(child.name);\n if (def && !def.hasChildren && child.children != null) {\n errors.push({\n path: `${childPath}/children`,\n message: `Component \"${child.name}\" does not accept children`,\n code: 'invalid_value',\n });\n return;\n }\n\n // Recurse so arbitrarily nested containers are covered.\n walkComponentTree(child, childPath, opts, errors);\n };\n\n const parentDef = getPptxStandardComponent(node.name);\n\n // A slide's `placeholders` record maps placeholder names to full components\n // ({ \"title\": { \"name\": \"text\", ... } }). The static SlidePropsSchema does\n // not include the field (it is injected with the recursive ref at schema\n // generation time), so validateComponentProps strips it before checking the\n // slide's own props — each value is validated here instead.\n if (node.name === 'slide' && node.props && typeof node.props === 'object') {\n const placeholders = node.props.placeholders;\n if (\n placeholders &&\n typeof placeholders === 'object' &&\n !Array.isArray(placeholders)\n ) {\n for (const [key, child] of Object.entries(placeholders)) {\n validateEntry(child, `${path}/props/placeholders/${key}`);\n }\n } else if (placeholders != null) {\n errors.push({\n path: `${path}/props/placeholders`,\n message:\n 'Field \"placeholders\" must be an object mapping placeholder names to components',\n code: 'invalid_type',\n });\n }\n }\n\n if (Array.isArray(node.children)) {\n node.children.forEach((child: any, i: number) => {\n const childPath = `${path}/children/${i}`;\n // Enforce the registry's container narrowing (pptx → slide,\n // slide → content) for known components; unknown names are already\n // reported by validateComponentProps inside validateEntry.\n if (\n parentDef?.allowedChildren &&\n child &&\n typeof child === 'object' &&\n typeof child.name === 'string' &&\n getPptxStandardComponent(child.name) &&\n !parentDef.allowedChildren.includes(child.name)\n ) {\n const expected = parentDef.allowedChildren\n .map((n) => `\"${n}\"`)\n .join(', ');\n errors.push({\n path: `${childPath}/name`,\n message: `Component \"${child.name}\" is not allowed inside \"${node.name}\". Expected ${expected}`,\n code: 'invalid_value',\n });\n }\n validateEntry(child, childPath);\n });\n } else if (node.children != null && path !== '') {\n // `children` is present but not an array on a nested container. The root's\n // `children` is already checked by deepValidatePresentation (skipped here\n // via `path !== ''` so it is not reported twice).\n errors.push({\n path: `${path}/children`,\n message: 'Field \"children\" must be an array',\n code: 'invalid_type',\n });\n }\n}\n\n/**\n * Validate a component's props against its schema.\n */\nfunction validateComponentProps(\n componentName: string,\n props: any,\n basePath: string,\n opts: DeepValidateOptions = {}\n): ValidationError[] {\n const errors: ValidationError[] = [];\n\n const schema = COMPONENT_SCHEMAS[componentName];\n if (!schema) {\n // Unknown component type. `basePath` always ends in `/props`; anchor the\n // swap to the end so a nested path like `…/props/placeholders/title/props`\n // becomes `…/props/placeholders/title/name` rather than mangling an\n // earlier `/props`.\n errors.push({\n path: basePath.replace(/\\/props$/, '/name'),\n message: `Unknown component \"${componentName}\"`,\n code: 'unknown_component',\n });\n return errors;\n }\n\n // A slide's `placeholders` field is injected at schema-generation time and\n // absent from the static props schema; its values are walked separately, so\n // strip it here to avoid a false additionalProperties rejection.\n let toCheck = props;\n if (\n componentName === 'slide' &&\n props &&\n typeof props === 'object' &&\n 'placeholders' in props\n ) {\n const rest = { ...props };\n delete rest.placeholders;\n toCheck = rest;\n }\n\n // When unknown fields are explicitly allowed, strip them before checking so\n // additionalProperties:false no longer rejects — required/typed fields are\n // still enforced.\n if (opts.allowUnknownFields) {\n toCheck = Value.Clean(schema, Value.Clone(toCheck));\n }\n\n if (!Value.Check(schema, toCheck)) {\n const valueErrors = [...Value.Errors(schema, toCheck)];\n const transformedErrors = transformValueErrors(valueErrors, {\n maxErrors: 100,\n });\n\n // Adjust paths to be relative to the document root\n transformedErrors.forEach((error) => {\n const fullPath =\n error.path === 'root'\n ? basePath\n : `${basePath}${error.path.startsWith('/') ? error.path : '/' + error.path}`;\n\n errors.push({\n ...error,\n path: fullPath,\n });\n });\n }\n\n return errors;\n}\n\n/**\n * Combine deep validation with standard validation.\n *\n * Deep validation produces precise, path-aware errors. TypeBox's discriminated-\n * union check, by contrast, often collapses any failure under the root into a\n * single generic \"Invalid component configuration for 'pptx'\" message at\n * `root` — useful as a signal that something is wrong, but actionable only via\n * the deep-validator's output. We always strip that catch-all so it doesn't\n * appear alongside (or, worse, instead of) the real diagnostics.\n */\nexport function comprehensiveValidatePresentation(\n data: any,\n existingErrors: ValidationError[] = [],\n opts: DeepValidateOptions = {}\n): ValidationError[] {\n const deepErrors = deepValidatePresentation(data, opts);\n\n const filteredExisting = existingErrors.filter(\n (e) => !isGenericUnionCatchAll(e)\n );\n\n return deduplicateErrors([...filteredExisting, ...deepErrors]);\n}\n\n/**\n * Detect TypeBox's generic union/discriminator catch-all error at the document\n * root. These messages name the component type ('pptx') but give no actionable\n * detail — the deep validator emits the actual path-level errors instead.\n */\nfunction isGenericUnionCatchAll(error: ValidationError): boolean {\n const atRoot = !error.path || error.path === 'root' || error.path === '/';\n if (!atRoot) return false;\n const msg = error.message || '';\n return (\n /invalid component configurations?/i.test(msg) ||\n /invalid document structure/i.test(msg)\n );\n}\n\n/**\n * Deduplicate errors by path and message.\n */\nfunction deduplicateErrors(errors: ValidationError[]): ValidationError[] {\n const seen = new Set<string>();\n const unique: ValidationError[] = [];\n\n for (const error of errors) {\n const key = `${error.path}:${error.message}`;\n if (!seen.has(key)) {\n seen.add(key);\n unique.push(error);\n }\n }\n\n return unique;\n}\n","export const PPTX_SHARED_VERSION = '1.0.0';\n\n// Component Schemas\nexport {\n PositionSchema,\n SlideBackgroundSchema,\n TransitionSchema,\n VerticalAlignmentSchema,\n ShadowSchema,\n PresentationPropsSchema,\n SlidePropsSchema,\n TextPropsSchema,\n PptxImagePropsSchema,\n ShapePropsSchema,\n ShapeTypeSchema,\n PptxTablePropsSchema,\n PptxHighchartsPropsSchema,\n PptxStandardComponentDefinitionSchema,\n PptxComponentDefinitionSchema,\n PptxSlideContentSchema,\n} from './schemas/components';\n\nexport type {\n Position,\n SlideBackground,\n Transition,\n VerticalAlignment,\n Shadow,\n PresentationProps,\n SlideProps,\n TextProps,\n PptxImageProps,\n ShapeType,\n ShapeProps,\n TextSegment,\n PptxTableProps,\n PptxHighchartsProps,\n PptxComponentDefinition,\n PptxSlideContent,\n} from './schemas/components';\n\n// Chart (not re-exported from components barrel)\nexport { PptxChartPropsSchema } from './schemas/components/chart';\nexport type { PptxChartProps } from './schemas/components/chart';\n\n// Component Registry\nexport {\n PPTX_STANDARD_COMPONENTS_REGISTRY,\n getPptxStandardComponent,\n getAllPptxComponentNames,\n getPptxComponentsByCategory,\n getPptxContainerComponents,\n getPptxContentComponents,\n isPptxStandardComponent,\n createPptxComponentSchemaObject,\n createAllPptxComponentSchemas,\n} from './schemas/component-registry';\n\nexport type { PptxStandardComponentDefinition } from './schemas/component-registry';\n\n// Document Schema\nexport {\n PptxJsonComponentDefinitionSchema,\n PPTX_JSON_SCHEMA_URLS,\n} from './schemas/document';\n\nexport type { PptxJsonComponentDefinition } from './schemas/document';\n\n// Schema Export Metadata\nexport {\n PPTX_COMPONENT_METADATA,\n PPTX_BASE_SCHEMA_METADATA,\n} from './schemas/export';\n\n// Component Defaults\nexport {\n PptxComponentDefaultsSchema,\n TextComponentDefaultsSchema,\n ImageComponentDefaultsSchema,\n ShapeComponentDefaultsSchema,\n TableComponentDefaultsSchema,\n HighchartsComponentDefaultsSchema,\n ChartComponentDefaultsSchema,\n} from './schemas/component-defaults';\nexport type {\n PptxComponentDefaults,\n TextComponentDefaults,\n ImageComponentDefaults,\n ShapeComponentDefaults,\n TableComponentDefaults,\n HighchartsComponentDefaults,\n ChartComponentDefaults,\n} from './schemas/component-defaults';\n\n// Theme\nexport {\n ThemeConfigSchema,\n ColorValueSchema,\n SEMANTIC_COLOR_NAMES,\n SEMANTIC_COLOR_ALIASES,\n STYLE_NAMES,\n StyleNameSchema,\n TextStyleSchema,\n isValidThemeConfig,\n} from './schemas/theme';\nexport type { ThemeConfigJson, StyleName, TextStyle } from './schemas/theme';\n\n// Schema Generator\nexport { generateUnifiedDocumentSchema } from './schemas/generator';\nexport type {\n VersionedPropsEntry,\n CustomComponentInfo,\n GenerateSchemaOptions,\n} from './schemas/generator';\n\n// Types\nexport type { ReportComponent } from './types/components';\n\n// Image source conflict detection (path/base64/svg mutual exclusivity)\nexport {\n collectImageSourceConflicts,\n presentImageSources,\n} from './validation/image-source-conflicts';\n\n// Unified validation facade (deep, path-aware validation of whole presentations\n// and themes) — the API the CLI's `pptx validate` consumes.\nexport {\n validate,\n validateStrict,\n validatePresentationDocument,\n validateJsonPresentationDocument,\n validatePptxTheme,\n validateJsonPptxTheme,\n deepValidatePresentation,\n comprehensiveValidatePresentation,\n} from './validation/unified';\nexport type {\n PptxValidationResult,\n DeepValidateOptions,\n} from './validation/unified';\n\n// Re-export shared validation utilities for convenience\nexport {\n transformValueError,\n transformValueErrors,\n DEFAULT_ERROR_CONFIG,\n createErrorConfig,\n} from '@json-to-office/shared';\n\nexport type {\n ErrorFormatterConfig,\n ValidationError,\n} from '@json-to-office/shared';\n\n// Re-export shared utilities\nexport {\n latestVersion,\n isValidSemver,\n parseSemver,\n compareSemver,\n} from '@json-to-office/shared';\nexport type { ParsedSemver } from '@json-to-office/shared';\n\n// Re-export schema utils\nexport {\n fixSchemaReferences,\n convertToJsonSchema,\n createComponentSchema,\n exportSchemaToFile,\n} from '@json-to-office/shared';\nexport type { ComponentSchemaConfig } from '@json-to-office/shared';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAM,sBAAsB,CAAC,QAAQ,UAAU,KAAK;AAK7C,SAAS,oBAAoB,OAA0B;AAC5D,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO,CAAC;AACjD,QAAM,IAAI;AACV,SAAO,oBAAoB,OAAO,CAAC,MAAM;AACvC,UAAM,IAAI,EAAE,CAAC;AACb,WAAO,OAAO,MAAM,YAAY,EAAE,KAAK,EAAE,SAAS;AAAA,EACpD,CAAC;AACH;AAKO,SAAS,4BAA4B,MAAkC;AAC5E,QAAM,SAA4B,CAAC;AAEnC,QAAM,QAAQ,CAAC,MAAW,SA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