@json-to-office/shared-docx 0.6.0 → 0.8.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.
Files changed (41) hide show
  1. package/dist/{chunk-6SLVQATI.js → chunk-3AJ5NHUF.js} +2 -2
  2. package/dist/{chunk-YQECZGRR.js → chunk-7PK36JXG.js} +2 -2
  3. package/dist/chunk-F5IGGVWN.js +1339 -0
  4. package/dist/chunk-F5IGGVWN.js.map +1 -0
  5. package/dist/{chunk-V4L4S6ZS.js → chunk-JYGWHRMY.js} +2 -2
  6. package/dist/{chunk-L5TZFC47.js → chunk-M4OD7UER.js} +4 -42
  7. package/dist/chunk-M4OD7UER.js.map +1 -0
  8. package/dist/{chunk-22VYYAC2.js → chunk-MQ7KNRW2.js} +6 -4
  9. package/dist/{chunk-22VYYAC2.js.map → chunk-MQ7KNRW2.js.map} +1 -1
  10. package/dist/{chunk-OE5JFL7S.js → chunk-QEDASPGD.js} +8 -6
  11. package/dist/{chunk-OE5JFL7S.js.map → chunk-QEDASPGD.js.map} +1 -1
  12. package/dist/{chunk-SK6LSPFN.js → chunk-RFNU2AYT.js} +2 -2
  13. package/dist/chunk-S5KMAUDZ.js +645 -0
  14. package/dist/chunk-S5KMAUDZ.js.map +1 -0
  15. package/dist/{chunk-ABVYMFDA.js → chunk-VQXTI6WF.js} +2 -2
  16. package/dist/index.d.ts +220 -1
  17. package/dist/index.js +16 -14
  18. package/dist/index.js.map +1 -1
  19. package/dist/schemas/api.js +4 -3
  20. package/dist/schemas/component-defaults.d.ts +448 -0
  21. package/dist/schemas/component-defaults.js +24 -0
  22. package/dist/schemas/component-defaults.js.map +1 -0
  23. package/dist/schemas/component-registry.js +2 -1
  24. package/dist/schemas/components.d.ts +436 -0
  25. package/dist/schemas/components.js +13 -11
  26. package/dist/schemas/document.js +5 -4
  27. package/dist/schemas/export.js +3 -2
  28. package/dist/schemas/generator.js +3 -2
  29. package/dist/schemas/theme.d.ts +4 -444
  30. package/dist/schemas/theme.js +12 -12
  31. package/dist/validation/unified/index.d.ts +223 -0
  32. package/dist/validation/unified/index.js +6 -5
  33. package/package.json +2 -2
  34. package/dist/chunk-L5TZFC47.js.map +0 -1
  35. package/dist/chunk-PN6JT3KF.js +0 -1926
  36. package/dist/chunk-PN6JT3KF.js.map +0 -1
  37. /package/dist/{chunk-6SLVQATI.js.map → chunk-3AJ5NHUF.js.map} +0 -0
  38. /package/dist/{chunk-YQECZGRR.js.map → chunk-7PK36JXG.js.map} +0 -0
  39. /package/dist/{chunk-V4L4S6ZS.js.map → chunk-JYGWHRMY.js.map} +0 -0
  40. /package/dist/{chunk-SK6LSPFN.js.map → chunk-RFNU2AYT.js.map} +0 -0
  41. /package/dist/{chunk-ABVYMFDA.js.map → chunk-VQXTI6WF.js.map} +0 -0
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/validation/parsers/json.ts","../src/validation/validators/theme.ts","../src/validation/validators/component.ts","../src/validation/core/validator.ts","../src/validation/core/errors.ts","../src/types/components.ts"],"sourcesContent":["// Version information\nexport const SHARED_DOCX_VERSION = '1.0.0';\n\n// ============================================================================\n// Format-agnostic re-exports from @json-to-office/shared\n// ============================================================================\n\n// Types\nexport type { ComponentDefinition as SharedComponentDefinition } from '@json-to-office/shared';\nexport type {\n GenerationWarning,\n AddWarningFunction,\n} from '@json-to-office/shared';\n\n// Schema utilities\nexport {\n fixSchemaReferences,\n convertToJsonSchema,\n createComponentSchema,\n createComponentSchemaObject as sharedCreateComponentSchemaObject,\n exportSchemaToFile,\n} from '@json-to-office/shared';\nexport type { ComponentSchemaConfig } from '@json-to-office/shared';\n\n// Validation - format-agnostic from shared\nexport {\n transformValueError,\n transformValueErrors,\n formatErrorSummary,\n groupErrorsByPath,\n createJsonParseError,\n calculatePosition,\n} from '@json-to-office/shared';\nexport type { ValidationError, ValidationResult } from '@json-to-office/shared';\nexport {\n type ErrorFormatterConfig,\n DEFAULT_ERROR_CONFIG,\n createErrorConfig,\n ERROR_EMOJIS,\n formatErrorMessage,\n} from '@json-to-office/shared';\nexport {\n isUnionSchema,\n isObjectSchema,\n isLiteralSchema,\n getObjectSchemaPropertyNames,\n getLiteralValue,\n extractStandardComponentNames,\n clearComponentNamesCache,\n getSchemaMetadata,\n} from '@json-to-office/shared';\n\n// Semver utilities\nexport {\n isValidSemver,\n parseSemver,\n compareSemver,\n latestVersion,\n type ParsedSemver,\n} from '@json-to-office/shared';\n\n// ============================================================================\n// Docx-specific: Document schemas\n// ============================================================================\n\nexport {\n JsonComponentDefinitionSchema,\n JSON_SCHEMA_URLS,\n validateDocumentWithSchema,\n validateJsonComponent as validateJsonComponentDoc,\n} from './schemas/document';\n\nexport type {\n DocumentValidationResult,\n ValidationError as DocumentValidationError,\n} from './schemas/document';\n\n// ============================================================================\n// Docx-specific: Theme schemas\n// ============================================================================\n\nexport { ThemeConfigSchema, isValidThemeConfig } from './schemas/theme';\n\nexport type {\n ThemeConfigJson,\n StyleDefinitions,\n DocumentMargins,\n PageDimensions,\n Page,\n FontDefinition,\n Fonts,\n ComponentDefaults,\n HeadingComponentDefaults,\n ParagraphComponentDefaults,\n ImageComponentDefaults,\n StatisticComponentDefaults,\n TableComponentDefaults,\n SectionComponentDefaults,\n ColumnsComponentDefaults,\n ListComponentDefaults,\n HeadingDefinition,\n} from './schemas/theme';\n\n// ============================================================================\n// Docx-specific: API schemas\n// ============================================================================\n\nexport * from './schemas/api';\n\n// ============================================================================\n// Docx-specific: Validation utilities\n// ============================================================================\n\n// Parser utilities\nexport {\n JsonDocumentParser,\n JsonParsingError,\n JsonValidationError,\n parseJsonComponent,\n validateJsonComponent,\n parseJsonWithLineNumbers,\n} from './validation/parsers/json';\n\n// Theme validators\nexport {\n validateThemeJson,\n isValidThemeJson,\n getValidationSummary,\n} from './validation/validators/theme';\n\n// Component validators\nexport {\n validateComponentProps,\n safeValidateComponentProps,\n safeValidateComponentDefinition,\n isReportProps,\n isSectionProps,\n isHeadingProps,\n isParagraphProps,\n isColumnsProps,\n isImageProps,\n isStatisticProps,\n isTableProps,\n isListProps,\n isCustomComponentProps,\n getValidationErrors,\n} from './validation/validators/component';\n\n// Export formatValidationErrors from theme validator (works for both)\nexport { formatValidationErrors } from './validation/validators/theme';\n\n// New comprehensive validation exports\nexport {\n // Core validators\n validateComponent,\n validateComponentDefinition,\n validateComponents,\n transformAndValidate,\n createValidatedComponent,\n isValidComponent,\n // Error formatting\n formatValidationError,\n formatValidationErrorStrings,\n formatErrorReport,\n getErrorSummary,\n hasCriticalErrors,\n getValidationContext,\n} from './validation';\n\n// Export types from validation\nexport type { ThemeValidationResult } from './validation/validators/theme';\n\nexport type {\n CoreValidationResult,\n StandardComponentName,\n FormattedError,\n} from './validation';\n\n// ============================================================================\n// Docx-specific: Unified Validation System\n// ============================================================================\n\nexport * from './validation/unified';\n\n// Re-export the simple validation API as the main validation interface\nexport { validate, validateStrict } from './validation/unified';\n\n// ============================================================================\n// Docx-specific: Component schemas (JavaScript values)\n// ============================================================================\n\nexport {\n AlignmentSchema,\n JustifiedAlignmentSchema,\n HeadingLevelSchema,\n SpacingSchema,\n LineSpacingSchema,\n IndentSchema,\n NumberingSchema,\n BorderSchema,\n MarginsSchema,\n BaseComponentPropsSchema,\n ReportPropsSchema,\n SectionPropsSchema,\n ColumnsPropsSchema,\n HeadingPropsSchema,\n ParagraphPropsSchema,\n ImagePropsSchema,\n TextBoxPropsSchema,\n StatisticPropsSchema,\n TablePropsSchema,\n ListPropsSchema,\n TocPropsSchema,\n StandardComponentDefinitionSchema,\n ComponentDefinitionSchema,\n} from './schemas/components';\n\n// Component types - export as types only\nexport type {\n BaseComponentProps,\n ReportProps,\n SectionProps,\n ColumnsProps,\n HeadingProps,\n ParagraphProps,\n ImageProps,\n TextBoxProps,\n StatisticProps,\n TableProps,\n ListProps,\n TocProps,\n Alignment,\n JustifiedAlignment,\n HeadingLevel,\n Spacing,\n LineSpacing,\n Indent,\n Numbering,\n} from './schemas/components';\n\n// Export ComponentDefinition from types/components.ts (better type inference)\nexport type {\n ComponentDefinition,\n StandardComponentDefinition,\n} from './types/components';\n\nexport {\n STANDARD_COMPONENTS,\n STANDARD_COMPONENTS_SET,\n} from './types/components';\n\n// Highcharts component schema (standard component)\nexport { HighchartsPropsSchema } from './schemas/components/highcharts';\nexport type { HighchartsProps } from './schemas/components/highcharts';\n\n// Custom component schemas\nexport {\n TextSpaceAfterPropsSchema,\n TextSpaceAfterComponentSchema,\n CustomComponentDefinitionSchema,\n} from './schemas/custom-components';\n\nexport type { TextSpaceAfterProps } from './schemas/custom-components';\n\n// Legacy support - re-export common types from schemas\nexport type { ThemeName } from './types/common';\n\n// ============================================================================\n// Docx-specific: Schema Export Utilities\n// ============================================================================\n\nexport {\n fixSchemaReferences as fixDocxSchemaReferences,\n convertToJsonSchema as convertDocxToJsonSchema,\n createComponentSchema as createDocxComponentSchema,\n exportSchemaToFile as exportDocxSchemaToFile,\n COMPONENT_METADATA,\n BASE_SCHEMA_METADATA,\n THEME_SCHEMA_METADATA,\n} from './schemas/export';\n\nexport type { ComponentSchemaConfig as DocxComponentSchemaConfig } from './schemas/export';\n\n// ============================================================================\n// Docx-specific: Unified Schema Generation\n// ============================================================================\n\nexport { generateUnifiedDocumentSchema } from './schemas/generator';\n\nexport type {\n CustomComponentInfo,\n GenerateDocumentSchemaOptions,\n} from './schemas/generator';\n\n// ============================================================================\n// Docx-specific: Plugin System Type Support\n// ============================================================================\n\nexport {\n type ReportComponent,\n type SectionComponent,\n type ColumnsComponent,\n type HeadingComponent,\n type ParagraphComponent,\n type TextBoxComponent,\n type ImageComponent,\n type HighchartsComponent,\n type StatisticComponent,\n type TableComponent,\n type ListComponent,\n type TocComponent,\n type TextSpaceAfterComponent,\n isReportComponent,\n isSectionComponent,\n isColumnsComponent,\n isHeadingComponent,\n isParagraphComponent,\n isTextBoxComponent,\n isImageComponent,\n isHighchartsComponent,\n isStatisticComponent,\n isTableComponent,\n isListComponent,\n isTocComponent,\n isTextSpaceAfterComponent,\n} from './types/components';\n","import { Value, ValueError } from '@sinclair/typebox/value';\nimport { FormatRegistry } from '@sinclair/typebox';\nimport {\n DocumentValidationResult,\n ValidationError,\n} from '../../schemas/document';\nimport {\n ComponentDefinitionSchema,\n ComponentDefinition,\n} from '../../schemas/components';\n\n// Register format validators with TypeBox\nFormatRegistry.Set('uri', (value: string) => {\n // Accept URLs, relative paths, and file paths\n try {\n new URL(value);\n return true;\n } catch {\n // Check if it's a relative path (common for JSON schemas)\n if (\n value.includes('.json') ||\n value.includes('/') ||\n value.includes('\\\\')\n ) {\n return true;\n }\n // Check if it's an HTTP/HTTPS URL\n return /^https?:\\/\\/.+/.test(value);\n }\n});\n\nFormatRegistry.Set('date-time', (value: string) => {\n // ISO 8601 date-time format validation\n const dateTimeRegex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z?$/;\n return dateTimeRegex.test(value) && !isNaN(Date.parse(value));\n});\n\n/**\n * JSON parser\n * @module validation/parsers/json\n * @description\n * Advanced JSON parsing with line number tracking and detailed error reporting.\n * Provides enhanced error messages for JSON syntax and validation errors.\n */\n\n/**\n * JSON Document Parser - Handles parsing and validation of JSON report definitions\n */\nexport class JsonDocumentParser {\n private schema = ComponentDefinitionSchema;\n\n constructor() {\n // Schema is assigned above\n }\n\n /**\n * Parse JSON input (string or object) and validate against schema\n * Only supports unified ComponentDefinition structure where document IS a report component\n */\n public parse(jsonInput: string | object): ComponentDefinition {\n let parsedObject: unknown;\n\n // Step 1: Parse JSON if it's a string\n if (typeof jsonInput === 'string') {\n try {\n parsedObject = JSON.parse(jsonInput);\n } catch (error) {\n throw new JsonParsingError(\n 'Invalid JSON syntax',\n this.extractJSONSyntaxError(error as Error, jsonInput)\n );\n }\n } else {\n parsedObject = jsonInput;\n }\n\n // Step 2: Validate it's a report component\n if (\n typeof parsedObject !== 'object' ||\n parsedObject === null ||\n !('name' in parsedObject) ||\n (parsedObject as any).name !== 'docx'\n ) {\n throw new JsonValidationError(\n 'Invalid document structure: Document must be a docx component with name=\"docx\"',\n [\n {\n path: 'name',\n message: 'Document must be a docx component with name=\"docx\"',\n code: 'INVALID_STRUCTURE',\n },\n ]\n );\n }\n\n // Step 3: Validate against schema\n if (!Value.Check(this.schema, parsedObject)) {\n const errors = [...Value.Errors(this.schema, parsedObject)];\n\n throw new JsonValidationError(\n 'JSON validation failed',\n this.formatTypeBoxErrors(\n errors,\n typeof jsonInput === 'string'\n ? jsonInput\n : JSON.stringify(jsonInput, null, 2)\n )\n );\n }\n\n return parsedObject as ComponentDefinition;\n }\n\n /**\n * Validate JSON without throwing errors - returns ValidationResult\n */\n public validate(jsonInput: string | object): DocumentValidationResult {\n try {\n this.parse(jsonInput);\n return {\n valid: true,\n errors: [],\n warnings: [],\n };\n } catch (error) {\n if (\n error instanceof JsonParsingError ||\n error instanceof JsonValidationError\n ) {\n return {\n valid: false,\n errors: error.validationErrors,\n warnings: [],\n };\n }\n\n // Unexpected error\n return {\n valid: false,\n errors: [\n {\n path: '',\n message:\n error instanceof Error\n ? error.message\n : 'Unknown validation error',\n code: 'UNEXPECTED_ERROR',\n },\n ],\n warnings: [],\n };\n }\n }\n\n /**\n * Parse JSON file content with line number tracking\n */\n public parseWithLineNumbers(jsonString: string): ComponentDefinition {\n const lines = jsonString.split('\\n');\n\n try {\n return this.parse(jsonString);\n } catch (error) {\n if (\n error instanceof JsonParsingError ||\n error instanceof JsonValidationError\n ) {\n // Enhance errors with line numbers\n const enhancedErrors = error.validationErrors.map((err) => ({\n ...err,\n ...this.findLineNumber(err.path, jsonString, lines),\n }));\n\n if (error instanceof JsonParsingError) {\n throw new JsonParsingError(error.message, enhancedErrors);\n } else {\n throw new JsonValidationError(error.message, enhancedErrors);\n }\n }\n throw error;\n }\n }\n\n /**\n * Extract JSON syntax error information\n */\n private extractJSONSyntaxError(\n error: Error,\n jsonString: string\n ): ValidationError[] {\n const message = error.message;\n\n // Try to extract position from error message\n const positionMatch =\n message.match(/position\\s+(\\d+)/i) ||\n message.match(/at\\s+(\\d+)/i) ||\n message.match(/character\\s+(\\d+)/i);\n\n let line = 0;\n let column = 0;\n\n if (positionMatch) {\n const position = parseInt(positionMatch[1], 10);\n const lines = jsonString.substring(0, position).split('\\n');\n line = lines.length;\n column = lines[lines.length - 1].length + 1;\n }\n\n return [\n {\n path: '',\n message: `JSON syntax error: ${message}`,\n code: 'JSON_SYNTAX_ERROR',\n line: line || undefined,\n column: column || undefined,\n suggestions: [\n 'Check for missing commas, brackets, or quotes',\n 'Validate JSON syntax using a JSON validator',\n 'Ensure all strings are properly quoted',\n ],\n },\n ];\n }\n\n /**\n * Format TypeBox validation errors into ValidationError format\n */\n private formatTypeBoxErrors(\n errors: ValueError[],\n originalJson: string\n ): ValidationError[] {\n return errors.map((error) => {\n const path = error.path || '';\n const lineInfo = this.findLineNumber(path, originalJson);\n\n return {\n path,\n message: this.formatTypeBoxErrorMessage(error),\n code: this.getErrorCode(error),\n line: lineInfo.line,\n column: lineInfo.column,\n suggestions: this.generateSuggestions(error),\n };\n });\n }\n\n /**\n * Format individual TypeBox error message\n */\n private formatTypeBoxErrorMessage(error: ValueError): string {\n const path = error.path ? `at \"${error.path}\"` : '';\n const message = error.message;\n\n // TypeBox provides descriptive messages, so we can use them directly\n // but enhance common patterns\n if (message.includes('Expected')) {\n return `${message} ${path}`;\n } else if (message.includes('Required property')) {\n return `${message} ${path}`;\n } else if (message.includes('Unexpected property')) {\n return `${message} ${path}`;\n } else if (message.includes('minimum')) {\n return `Value is too small ${path}. ${message}`;\n } else if (message.includes('maximum')) {\n return `Value is too big ${path}. ${message}`;\n } else {\n return `${message} ${path}`;\n }\n }\n\n /**\n * Get error code from TypeBox error\n */\n private getErrorCode(error: ValueError): string {\n const baseCode = String(error.type || 'VALIDATION_ERROR').toUpperCase();\n const path = error.path ? error.path.replace(/\\//g, '_').toUpperCase() : '';\n return path ? `${baseCode}_${path}` : baseCode;\n }\n\n /**\n * Generate helpful suggestions based on error type\n */\n private generateSuggestions(error: ValueError): string[] {\n const suggestions: string[] = [];\n const message = error.message;\n\n // Parse TypeBox error messages to provide suggestions\n if (message.includes('Expected string')) {\n suggestions.push('Ensure the value is wrapped in quotes');\n } else if (message.includes('Expected number')) {\n suggestions.push('Remove quotes around numeric values');\n } else if (message.includes('Expected array')) {\n suggestions.push('Use square brackets [] for arrays');\n } else if (message.includes('Expected object')) {\n suggestions.push('Use curly braces {} for objects');\n } else if (message.includes('Expected literal')) {\n const match = message.match(/Expected literal (.+)/);\n if (match) {\n suggestions.push(`Use the exact value: ${match[1]}`);\n }\n } else if (message.includes('Unexpected property')) {\n suggestions.push('Remove unknown properties or check spelling');\n suggestions.push(\n 'Refer to the JSON schema documentation for valid properties'\n );\n } else if (message.includes('Expected union')) {\n suggestions.push(\n 'Check that the value matches one of the allowed formats'\n );\n suggestions.push('Verify the module type is spelled correctly');\n } else if (message.includes('minimum')) {\n const match = message.match(/minimum.*?(\\d+)/);\n if (match) {\n if (message.includes('Array')) {\n suggestions.push(`Array must have at least ${match[1]} items`);\n } else {\n suggestions.push(`Value must be at least ${match[1]}`);\n }\n }\n } else if (message.includes('format') && message.includes('uri')) {\n suggestions.push(\n 'Ensure the URL is valid and starts with http:// or https://'\n );\n }\n\n // Generic suggestions\n if (suggestions.length === 0) {\n suggestions.push('Check the JSON schema documentation for valid values');\n suggestions.push('Verify the property name and value format');\n }\n\n return suggestions;\n }\n\n /**\n * Find line and column number for a given JSON path\n */\n private findLineNumber(\n path: string,\n jsonString: string,\n lines?: string[]\n ): { line?: number; column?: number } {\n if (!path) {\n return {};\n }\n\n const jsonLines = lines || jsonString.split('\\n');\n const pathParts = path.split('.');\n\n // Simple heuristic: find the line containing the property name\n for (let i = 0; i < jsonLines.length; i++) {\n const line = jsonLines[i];\n const lastPathPart = pathParts[pathParts.length - 1];\n\n // Look for property name in quotes\n if (line.includes(`\"${lastPathPart}\"`)) {\n const column = line.indexOf(`\"${lastPathPart}\"`) + 1;\n return {\n line: i + 1,\n column,\n };\n }\n }\n\n return {};\n }\n}\n\n/**\n * Custom error classes for better error handling\n */\nexport class JsonParsingError extends Error {\n public readonly validationErrors: ValidationError[];\n\n constructor(message: string, errors: ValidationError[]) {\n super(message);\n this.name = 'JsonParsingError';\n this.validationErrors = errors;\n }\n}\n\nexport class JsonValidationError extends Error {\n public readonly validationErrors: ValidationError[];\n\n constructor(message: string, errors: ValidationError[]) {\n super(message);\n this.name = 'JsonValidationError';\n this.validationErrors = errors;\n }\n}\n\n/**\n * Utility functions for external use\n */\n\n/**\n * Parse and validate JSON component definition\n * Only supports report components (documents)\n */\nexport function parseJsonComponent(\n jsonInput: string | object\n): ComponentDefinition {\n const parser = new JsonDocumentParser();\n return parser.parse(jsonInput);\n}\n\n/**\n * Validate JSON component definition without throwing\n * Now uses unified validation\n */\nexport { validateJsonDocument as validateJsonComponent } from '../unified/document-validator';\n\n/**\n * Parse JSON with enhanced line number error reporting\n * Only supports unified ComponentDefinition structure where document IS a report component\n */\nexport function parseJsonWithLineNumbers(\n jsonString: string\n): ComponentDefinition {\n const parser = new JsonDocumentParser();\n return parser.parseWithLineNumbers(jsonString);\n}\n","/**\n * Theme validators\n * @module validation/validators/theme\n * @description\n * Now uses unified validation system\n */\n\n// Re-export everything from unified theme validator\nexport {\n validateThemeJson,\n isValidTheme as isValidThemeJson,\n getThemeName,\n isThemeConfig,\n type ThemeValidationResult,\n} from '../unified/theme-validator';\n\n// Re-export utility for getting validation summary\nexport { getValidationSummary } from '../unified/base-validator';\n\n// For backward compatibility, provide formatValidationErrors\nexport function formatValidationErrors(errors: any[]): string[] {\n if (!Array.isArray(errors)) return [];\n\n return errors.map((error) => {\n if (typeof error === 'string') return error;\n\n const path = error.path ? `${error.path}: ` : '';\n const message = error.message || 'Validation error';\n return `${path}${message}`;\n });\n}\n","/**\n * Component validators\n * @module validation/validators/component\n * @description\n * Now uses unified validation system\n */\n\nimport {\n validateComponent as unifiedValidateComponent,\n validateComponentDefinition as unifiedValidateComponentDefinition,\n isStandardComponentName,\n} from '../unified/component-validator';\n\n// Re-export everything from unified component validator\nexport {\n validateComponent as validateComponentProps,\n validateComponentDefinition,\n validateComponents,\n validateCustomComponentProps,\n isStandardComponentName,\n // Type guards\n isReportProps,\n isSectionProps,\n isHeadingProps,\n isParagraphProps,\n isColumnsProps,\n isImageProps,\n isStatisticProps,\n isTableProps,\n isListProps,\n isCustomComponentProps,\n type StandardComponentName,\n} from '../unified/component-validator';\n\n// For backward compatibility, provide safeValidateComponentProps\nexport function safeValidateComponentProps<T>(\n name: string,\n props: unknown\n): { success: true; data: T } | { success: false; error: any[] } {\n // For non-standard types, use 'custom'\n const componentName = isStandardComponentName(name) ? name : 'custom';\n const result = unifiedValidateComponent(componentName, props);\n\n if (result.valid) {\n return { success: true, data: result.data as T };\n }\n\n return { success: false, error: result.errors || [] };\n}\n\n// For backward compatibility, provide safeValidateComponentDefinition\nexport function safeValidateComponentDefinition(\n component: unknown\n): { success: true; data: any } | { success: false; error: any[] } {\n const result = unifiedValidateComponentDefinition(component);\n\n if (result.valid) {\n return { success: true, data: result.data };\n }\n\n return { success: false, error: result.errors || [] };\n}\n\n// For backward compatibility, provide error formatting\nexport function getValidationErrors(props: unknown, name?: string): string[] {\n // For non-standard types, use 'custom'\n const componentName = name && isStandardComponentName(name) ? name : 'custom';\n const result = unifiedValidateComponent(componentName, props);\n\n if (result.valid) return [];\n\n return (result.errors || []).map((e: any) =>\n e.path ? `${e.path}: ${e.message}` : e.message\n );\n}\n","import { Value } from '@sinclair/typebox/value';\nimport { Static } from '@sinclair/typebox';\nimport {\n ComponentDefinitionSchema,\n ReportPropsSchema,\n SectionPropsSchema,\n HeadingPropsSchema,\n ParagraphPropsSchema,\n ColumnsPropsSchema,\n ImagePropsSchema,\n StatisticPropsSchema,\n TablePropsSchema,\n ListPropsSchema,\n} from '../../schemas/components';\nimport { CustomComponentDefinitionSchema } from '../../schemas/custom-components';\nimport {\n formatTypeBoxError,\n formatTypeBoxErrorStrings,\n formatErrorReport,\n hasCriticalErrors,\n} from './errors';\nimport type {\n CoreValidationResult,\n ValidationOptions,\n BatchValidationResult,\n ComponentValidationConfig,\n DataTransformer,\n} from './types';\n\n/**\n * Core validation engine\n * @module validation/core/validator\n * @description\n * Main validation utilities using TypeBox for runtime validation.\n * Provides comprehensive validation with error handling and data transformation.\n */\n\n/**\n * Component name to schema mapping\n */\nconst COMPONENT_SCHEMA_MAP = {\n report: ReportPropsSchema,\n section: SectionPropsSchema,\n heading: HeadingPropsSchema,\n paragraph: ParagraphPropsSchema,\n columns: ColumnsPropsSchema,\n image: ImagePropsSchema,\n statistic: StatisticPropsSchema,\n table: TablePropsSchema,\n list: ListPropsSchema,\n} as const;\n\nexport type StandardComponentName = keyof typeof COMPONENT_SCHEMA_MAP;\n\n/**\n * Validate any component configuration with comprehensive error handling\n */\nexport function validateComponent<T extends StandardComponentName>(\n name: T,\n props: unknown,\n options?: ValidationOptions\n): CoreValidationResult<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>> {\n const schema = COMPONENT_SCHEMA_MAP[name];\n\n if (!schema) {\n // Handle custom components\n if (Value.Check(CustomComponentDefinitionSchema, props)) {\n return {\n success: true,\n data: props as Static<(typeof COMPONENT_SCHEMA_MAP)[T]>,\n };\n }\n\n const errors = [...Value.Errors(CustomComponentDefinitionSchema, props)];\n const formattedErrors = formatTypeBoxError(errors);\n return {\n success: false,\n errors: formattedErrors,\n errorStrings: formatTypeBoxErrorStrings(errors),\n report: options?.includeReport ? formatErrorReport(errors) : undefined,\n hasCriticalErrors: options?.checkCritical\n ? hasCriticalErrors(errors)\n : undefined,\n };\n }\n\n // Validate with the schema\n if (Value.Check(schema, props)) {\n return {\n success: true,\n data: props as Static<(typeof COMPONENT_SCHEMA_MAP)[T]>,\n };\n }\n\n const errors = [...Value.Errors(schema, props)];\n const formattedErrors = formatTypeBoxError(errors);\n return {\n success: false,\n errors: formattedErrors,\n errorStrings: formatTypeBoxErrorStrings(errors),\n report: options?.includeReport ? formatErrorReport(errors) : undefined,\n hasCriticalErrors: options?.checkCritical\n ? hasCriticalErrors(errors)\n : undefined,\n };\n}\n\n/**\n * Validate a complete component definition (with nested children)\n */\nexport function validateComponentDefinition(\n component: unknown,\n options?: ValidationOptions\n): CoreValidationResult<Static<typeof ComponentDefinitionSchema>> {\n // Check for circular references or excessive nesting\n const maxDepth = options?.maxDepth ?? 10;\n const currentDepth = options?.currentDepth ?? 0;\n\n if (currentDepth > maxDepth) {\n return {\n success: false,\n errors: [\n {\n path: 'children',\n message: `Maximum nesting depth (${maxDepth}) exceeded`,\n code: 'custom',\n suggestion: 'Reduce the nesting level of components',\n },\n ],\n errorStrings: [`Maximum nesting depth (${maxDepth}) exceeded`],\n hasCriticalErrors: true,\n };\n }\n\n if (Value.Check(ComponentDefinitionSchema, component)) {\n // Validate nested children recursively\n const data = component as any;\n const warnings: string[] = [];\n\n if (data.children && Array.isArray(data.children)) {\n for (let i = 0; i < data.children.length; i++) {\n const nestedResult = validateComponentDefinition(data.children[i], {\n ...options,\n currentDepth: currentDepth + 1,\n });\n\n if (!nestedResult.success) {\n // Add context to nested errors\n const nestedErrors = nestedResult.errors?.map((err) => ({\n ...err,\n path: `children[${i}].${err.path}`,\n }));\n\n return {\n success: false,\n errors: nestedErrors,\n errorStrings: nestedErrors?.map(\n (err) => `${err.path}: ${err.message}`\n ),\n report: options?.includeReport\n ? `Validation failed in nested component at index ${i}:\\n${nestedResult.report}`\n : undefined,\n hasCriticalErrors: nestedResult.hasCriticalErrors,\n };\n }\n\n if (nestedResult.warnings) {\n warnings.push(\n ...nestedResult.warnings.map((w) => `children[${i}]: ${w}`)\n );\n }\n }\n }\n\n return {\n success: true,\n data: component as Static<typeof ComponentDefinitionSchema>,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n }\n\n const errors = [...Value.Errors(ComponentDefinitionSchema, component)];\n const formattedErrors = formatTypeBoxError(errors);\n return {\n success: false,\n errors: formattedErrors,\n errorStrings: formatTypeBoxErrorStrings(errors),\n report: options?.includeReport ? formatErrorReport(errors) : undefined,\n hasCriticalErrors: options?.checkCritical\n ? hasCriticalErrors(errors)\n : undefined,\n };\n}\n\n/**\n * Batch validate multiple components\n */\nexport function validateComponents(\n components: ComponentValidationConfig[],\n options?: ValidationOptions\n): BatchValidationResult {\n const results: CoreValidationResult<any>[] = [];\n let criticalCount = 0;\n\n for (const { name, props } of components) {\n const result =\n name in COMPONENT_SCHEMA_MAP\n ? validateComponent(name as StandardComponentName, props, options)\n : validateComponentDefinition(props, options);\n\n results.push(result);\n\n if (result.hasCriticalErrors) {\n criticalCount++;\n }\n\n if (!result.success && options?.stopOnFirst) {\n break;\n }\n }\n\n const valid = results.filter((r) => r.success).length;\n const invalid = results.length - valid;\n\n return {\n success: invalid === 0,\n results,\n summary: {\n total: results.length,\n valid,\n invalid,\n criticalErrors: criticalCount,\n },\n };\n}\n\n/**\n * Transform and validate data (for migration scenarios)\n */\nexport function transformAndValidate<T extends StandardComponentName>(\n name: T,\n data: unknown,\n transformer?: DataTransformer\n): CoreValidationResult<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>> {\n try {\n // Apply custom transformation if provided\n const transformed = transformer ? transformer(data) : data;\n\n // Validate the transformed data\n return validateComponent(name, transformed, {\n includeReport: true,\n checkCritical: true,\n });\n } catch (error) {\n return {\n success: false,\n errors: [\n {\n path: 'root',\n message: `Transformation failed: ${error instanceof Error ? error.message : String(error)}`,\n code: 'custom',\n },\n ],\n errorStrings: [\n `Transformation failed: ${error instanceof Error ? error.message : String(error)}`,\n ],\n hasCriticalErrors: true,\n };\n }\n}\n\n/**\n * Create a validated component with defaults\n */\nexport function createValidatedComponent<T extends StandardComponentName>(\n name: T,\n partialConfig: Partial<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>>\n): CoreValidationResult<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>> {\n const schema = COMPONENT_SCHEMA_MAP[name];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n path: 'name',\n message: `Unknown component name: ${name}`,\n code: 'custom',\n suggestion: `Use one of: ${Object.keys(COMPONENT_SCHEMA_MAP).join(', ')}`,\n },\n ],\n errorStrings: [`Unknown component name: ${name}`],\n hasCriticalErrors: true,\n };\n }\n\n // Validate with TypeBox\n if (Value.Check(schema, partialConfig)) {\n return {\n success: true,\n data: partialConfig as Static<(typeof COMPONENT_SCHEMA_MAP)[T]>,\n };\n }\n\n const errors = [...Value.Errors(schema, partialConfig)];\n const formattedErrors = formatTypeBoxError(errors);\n return {\n success: false,\n errors: formattedErrors,\n errorStrings: formatTypeBoxErrorStrings(errors),\n report: formatErrorReport(errors),\n hasCriticalErrors: hasCriticalErrors(errors),\n };\n}\n\n/**\n * Type guard functions with proper error context\n */\nexport function isValidComponent<T extends StandardComponentName>(\n name: T,\n props: unknown\n): props is Static<(typeof COMPONENT_SCHEMA_MAP)[T]> {\n const result = validateComponent(name, props);\n return result.success;\n}\n\n/**\n * Validate JSON string input\n */\nexport function validateJsonComponent<T extends StandardComponentName>(\n name: T,\n jsonString: string\n): CoreValidationResult<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>> {\n try {\n const parsed = JSON.parse(jsonString);\n return validateComponent(name, parsed, {\n includeReport: true,\n checkCritical: true,\n });\n } catch (error) {\n return {\n success: false,\n errors: [\n {\n path: 'root',\n message: `Invalid JSON: ${error instanceof Error ? error.message : String(error)}`,\n code: 'custom',\n suggestion: 'Check for syntax errors in your JSON',\n },\n ],\n errorStrings: [\n `Invalid JSON: ${error instanceof Error ? error.message : String(error)}`,\n ],\n hasCriticalErrors: true,\n };\n }\n}\n","import { ValueError } from '@sinclair/typebox/value';\nimport type { FormattedError } from './types';\n\n/**\n * Error formatting utilities\n * @module validation/core/errors\n * @description\n * Enhanced error formatting for TypeBox validation errors.\n * Provides detailed, user-friendly error messages with context and suggestions.\n */\n\n/**\n * Format a single TypeBox error into a user-friendly error message\n */\nfunction formatSingleIssue(issue: ValueError): FormattedError {\n const path = issue.path || 'root';\n let message = issue.message;\n let suggestion: string | undefined;\n let expected: string | undefined;\n let received: string | undefined;\n let options: string[] | undefined;\n\n // Enhance error messages based on error type\n if (message.includes('Expected')) {\n const match = message.match(/Expected (.+) but received (.+)/);\n if (match) {\n expected = match[1];\n received = match[2];\n suggestion = getSuggestionForType(expected, received);\n }\n }\n\n // Handle required property errors\n if (message.includes('Required property')) {\n const match = message.match(/Required property '(.+)'/);\n if (match) {\n message = `Missing required field: ${match[1]}`;\n suggestion = `Add the required field: ${match[1]}`;\n }\n }\n\n // Handle unexpected property errors\n if (message.includes('Unexpected property')) {\n const match = message.match(/Unexpected property '(.+)'/);\n if (match) {\n message = `Unknown property: ${match[1]}`;\n suggestion = `Remove the unknown property: ${match[1]}`;\n }\n }\n\n // Handle union type errors\n if (message.includes('Expected union')) {\n message = 'Value does not match any of the expected types';\n suggestion = 'Check the documentation for valid format options';\n }\n\n // Handle literal value errors\n if (message.includes('Expected literal')) {\n const match = message.match(/Expected literal (.+)/);\n if (match) {\n expected = match[1];\n message = `Expected value: ${expected}`;\n suggestion = `Use the exact value: ${expected}`;\n }\n }\n\n // Handle string length errors\n if (message.includes('String length')) {\n const minMatch = message.match(/minimum length of (\\d+)/);\n const maxMatch = message.match(/maximum length of (\\d+)/);\n if (minMatch) {\n message = `String must be at least ${minMatch[1]} characters long`;\n suggestion = `Add more characters to meet the minimum length of ${minMatch[1]}`;\n } else if (maxMatch) {\n message = `String must be at most ${maxMatch[1]} characters long`;\n suggestion = `Reduce to ${maxMatch[1]} characters or less`;\n }\n }\n\n // Handle number range errors\n if (message.includes('Expected number')) {\n const minMatch = message.match(/minimum value of ([\\d.]+)/);\n const maxMatch = message.match(/maximum value of ([\\d.]+)/);\n if (minMatch) {\n message = `Number must be greater than or equal to ${minMatch[1]}`;\n suggestion = `Use a value of ${minMatch[1]} or higher`;\n } else if (maxMatch) {\n message = `Number must be less than or equal to ${maxMatch[1]}`;\n suggestion = `Use a value of ${maxMatch[1]} or lower`;\n }\n }\n\n // Handle array length errors\n if (message.includes('Array length')) {\n const minMatch = message.match(/minimum length of (\\d+)/);\n const maxMatch = message.match(/maximum length of (\\d+)/);\n if (minMatch) {\n message = `Array must have at least ${minMatch[1]} items`;\n suggestion = `Add more items to meet the minimum of ${minMatch[1]}`;\n } else if (maxMatch) {\n message = `Array must have at most ${maxMatch[1]} items`;\n suggestion = `Remove items to meet the maximum of ${maxMatch[1]}`;\n }\n }\n\n // Handle format errors\n if (message.includes('format')) {\n if (message.includes('email')) {\n message = 'Invalid email address format';\n suggestion = 'Use a valid email format like user@example.com';\n } else if (message.includes('uri') || message.includes('url')) {\n message = 'Invalid URL format';\n suggestion = 'Use a valid URL format like https://example.com';\n } else if (message.includes('date-time')) {\n message = 'Invalid date-time format';\n suggestion = 'Use ISO 8601 format like 2024-01-01T00:00:00Z';\n }\n }\n\n // Handle pattern errors\n if (message.includes('pattern')) {\n message = 'String does not match the required pattern';\n suggestion = 'Check the format requirements for this field';\n }\n\n return {\n path,\n message,\n code: String(issue.type || 'validation_error'),\n suggestion,\n expected,\n received,\n options,\n };\n}\n\n/**\n * Get type-specific suggestions for common type mismatches\n */\nfunction getSuggestionForType(\n expected: string,\n received: string\n): string | undefined {\n // Number/String confusion\n if (expected === 'number' && received === 'string') {\n return 'Remove quotes or convert the string to a number';\n }\n if (expected === 'string' && received === 'number') {\n return 'Add quotes or convert the number to a string';\n }\n\n // Boolean confusion\n if (expected === 'boolean') {\n return 'Use true or false (without quotes)';\n }\n\n // Array/Object confusion\n if (expected === 'array' && received === 'object') {\n return 'Use square brackets [] for arrays instead of curly braces {}';\n }\n if (expected === 'object' && received === 'array') {\n return 'Use curly braces {} for objects instead of square brackets []';\n }\n\n // Null/undefined handling\n if (received === 'null' || received === 'undefined') {\n return `Provide a valid ${expected} value or mark the field as optional`;\n }\n\n return undefined;\n}\n\n/**\n * Format TypeBox validation errors into detailed, user-friendly messages\n */\nexport function formatTypeBoxError(errors: ValueError[]): FormattedError[] {\n return errors.map(formatSingleIssue);\n}\n\n/**\n * Format errors as simple string array (backward compatible)\n */\nexport function formatTypeBoxErrorStrings(errors: ValueError[]): string[] {\n return formatTypeBoxError(errors).map((err) => {\n let msg = `${err.path}: ${err.message}`;\n if (err.suggestion) {\n msg += ` (Suggestion: ${err.suggestion})`;\n }\n return msg;\n });\n}\n\n/**\n * Get a summary of validation errors grouped by path\n */\nexport function getErrorSummary(\n errors: ValueError[]\n): Map<string, FormattedError[]> {\n const summary = new Map<string, FormattedError[]>();\n\n for (const formattedError of formatTypeBoxError(errors)) {\n const existing = summary.get(formattedError.path) || [];\n existing.push(formattedError);\n summary.set(formattedError.path, existing);\n }\n\n return summary;\n}\n\n/**\n * Format validation errors as a detailed report\n */\nexport function formatErrorReport(errors: ValueError[]): string {\n const formattedErrors = formatTypeBoxError(errors);\n const summary = getErrorSummary(errors);\n\n let report = `Validation failed with ${formattedErrors.length} error${formattedErrors.length > 1 ? 's' : ''}:\\n\\n`;\n\n for (const [path, pathErrors] of summary) {\n report += `📍 ${path}:\\n`;\n for (const err of pathErrors) {\n report += ` ❌ ${err.message}\\n`;\n if (err.suggestion) {\n report += ` 💡 ${err.suggestion}\\n`;\n }\n if (err.expected && err.received) {\n report += ` 📋 Expected: ${err.expected}, Received: ${err.received}\\n`;\n }\n if (err.options) {\n report += ` 📋 Valid options: ${err.options.join(', ')}\\n`;\n }\n }\n report += '\\n';\n }\n\n return report;\n}\n\n/**\n * Check if an error is critical (affects core functionality)\n */\nexport function hasCriticalErrors(errors: ValueError[]): boolean {\n return errors.some((issue) => {\n // Missing required fields are critical\n if (issue.message.includes('Required property')) {\n return true;\n }\n\n // Invalid component names are critical\n if (\n issue.path.includes('name') &&\n issue.message.includes('Expected literal')\n ) {\n return true;\n }\n\n // Schema structure errors are critical\n if (\n issue.message.includes('Expected union') ||\n issue.message.includes('Never')\n ) {\n return true;\n }\n\n return false;\n });\n}\n\n/**\n * Get validation context for better error messages\n */\nexport function getValidationContext(path: string): string {\n if (!path || path === 'root') return 'document root';\n\n const pathParts = path.split('.');\n\n // Identify component context\n if (pathParts.includes('children')) {\n const childIndex = pathParts.indexOf('children');\n if (pathParts.length > childIndex + 1) {\n const index = pathParts[childIndex + 1];\n return `component at index ${index}`;\n }\n }\n\n // Identify props context\n if (pathParts.includes('props')) {\n return 'props section';\n }\n\n // Identify theme context\n if (pathParts.includes('theme')) {\n return 'theme configuration';\n }\n\n return pathParts.join(' > ');\n}\n\n// ============================================================================\n// Legacy Compatibility Exports (for API backward compatibility)\n// ============================================================================\n\n// Primary exports - use formatTypeBoxError and formatTypeBoxErrorStrings directly\nexport const formatValidationError = formatTypeBoxError;\nexport const formatValidationErrorStrings = formatTypeBoxErrorStrings;\n","/**\n * Component Type Definitions for Plugin System\n *\n * This file provides properly typed discriminated union interfaces for all component types.\n * These types enable TypeScript to automatically infer component props based on\n * the 'name' field when building component arrays in render functions.\n */\n\nimport type { Static } from '@sinclair/typebox';\nimport type {\n ReportPropsSchema,\n SectionPropsSchema,\n HeadingPropsSchema,\n ParagraphPropsSchema,\n ColumnsPropsSchema,\n ImagePropsSchema,\n HighchartsPropsSchema,\n StatisticPropsSchema,\n TablePropsSchema,\n ListPropsSchema,\n TocPropsSchema,\n} from '../schemas/components';\n\nimport type { TextSpaceAfterPropsSchema } from '../schemas/custom-components';\nimport type { TextBoxPropsSchema } from '../schemas/components/text-box';\n\n// ============================================================================\n// Standard Component Types with Discriminated Union Support\n// ============================================================================\n\n/**\n * Report component with literal name discriminator\n */\nexport interface ReportComponent {\n name: 'docx';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ReportPropsSchema>;\n children?: ComponentDefinition[];\n}\n\n/**\n * Section component with literal name discriminator\n */\nexport interface SectionComponent {\n name: 'section';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof SectionPropsSchema>;\n children?: ComponentDefinition[];\n}\n\n/**\n * Columns component with literal name discriminator\n */\nexport interface ColumnsComponent {\n name: 'columns';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ColumnsPropsSchema>;\n children?: ComponentDefinition[];\n}\n\n/**\n * Heading component with literal name discriminator\n */\nexport interface HeadingComponent {\n name: 'heading';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof HeadingPropsSchema>;\n}\n\n/**\n * Paragraph component with literal name discriminator\n */\nexport interface ParagraphComponent {\n name: 'paragraph';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ParagraphPropsSchema>;\n}\n\n/**\n * Image component with literal name discriminator\n */\nexport interface ImageComponent {\n name: 'image';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ImagePropsSchema>;\n}\n\n/**\n * Statistic component with literal name discriminator\n */\nexport interface StatisticComponent {\n name: 'statistic';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof StatisticPropsSchema>;\n}\n\n/**\n * Table component with literal name discriminator\n */\nexport interface TableComponent {\n name: 'table';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof TablePropsSchema>;\n}\n\n/**\n * Highcharts component with literal name discriminator\n */\nexport interface HighchartsComponent {\n name: 'highcharts';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof HighchartsPropsSchema>;\n}\n\n/**\n * Text Box component with literal name discriminator\n * Container for child components with floating positioning\n */\nexport interface TextBoxComponent {\n name: 'text-box';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof TextBoxPropsSchema>;\n children?: ComponentDefinition[];\n}\n\n/**\n * List component with literal name discriminator\n */\nexport interface ListComponent {\n name: 'list';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ListPropsSchema>;\n}\n\n/**\n * Table of Contents component with literal name discriminator\n */\nexport interface TocComponent {\n name: 'toc';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof TocPropsSchema>;\n}\n\n// ============================================================================\n// Specific Custom Component Types\n// ============================================================================\n\n/**\n * Text Space After component with literal name discriminator\n */\nexport interface TextSpaceAfterComponent {\n name: 'text-space-after';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof TextSpaceAfterPropsSchema>;\n}\n\n// ============================================================================\n// Discriminated Union Types\n// ============================================================================\n\n/**\n * Union of all standard component types\n */\nexport type StandardComponentDefinition =\n | ReportComponent\n | SectionComponent\n | ColumnsComponent\n | HeadingComponent\n | ParagraphComponent\n | TextBoxComponent\n | ImageComponent\n | HighchartsComponent\n | StatisticComponent\n | TableComponent\n | ListComponent\n | TocComponent;\n\n/**\n * Array of all standard component names.\n * Useful for iterating, validation, or displaying available components to users.\n */\nexport const STANDARD_COMPONENTS = [\n 'columns',\n 'heading',\n 'highcharts',\n 'image',\n 'list',\n 'paragraph',\n 'docx',\n 'section',\n 'statistic',\n 'table',\n 'text-box',\n 'toc',\n] as const satisfies readonly StandardComponentDefinition['name'][];\n\n/**\n * Set of all standard component names for O(1) lookup.\n */\nexport const STANDARD_COMPONENTS_SET: ReadonlySet<\n (typeof STANDARD_COMPONENTS)[number]\n> = new Set(STANDARD_COMPONENTS);\n\n// Compile-time completeness check: produces TS2344 listing the missing name(s)\n// if a standard component is added to the union but not to the array above.\ntype AssertNever<T extends never> = T;\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype _AssertAllIncluded = AssertNever<\n Exclude<\n StandardComponentDefinition['name'],\n (typeof STANDARD_COMPONENTS)[number]\n >\n>;\n\n/**\n * Complete discriminated union of all component types.\n * TypeScript will automatically narrow the type based on the 'name' field.\n *\n * @example\n * ```typescript\n * const components: ComponentDefinition[] = [\n * {\n * name: 'heading', // TypeScript knows this is HeadingComponent\n * props: {\n * level: 2, // Autocomplete works!\n * text: 'Title'\n * }\n * },\n * {\n * name: 'paragraph', // TypeScript knows this is ParagraphComponent\n * props: {\n * content: 'Hello World',\n * bold: true // Autocomplete works!\n * }\n * }\n * ];\n * ```\n */\nexport type ComponentDefinition =\n | StandardComponentDefinition\n | TextSpaceAfterComponent;\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\nexport function isReportComponent(\n component: ComponentDefinition\n): component is ReportComponent {\n return component.name === 'docx';\n}\n\nexport function isSectionComponent(\n component: ComponentDefinition\n): component is SectionComponent {\n return component.name === 'section';\n}\n\nexport function isColumnsComponent(\n component: ComponentDefinition\n): component is ColumnsComponent {\n return component.name === 'columns';\n}\n\nexport function isHeadingComponent(\n component: ComponentDefinition\n): component is HeadingComponent {\n return component.name === 'heading';\n}\n\nexport function isParagraphComponent(\n component: ComponentDefinition\n): component is ParagraphComponent {\n return component.name === 'paragraph';\n}\n\nexport function isImageComponent(\n component: ComponentDefinition\n): component is ImageComponent {\n return component.name === 'image';\n}\n\nexport function isTextBoxComponent(\n component: ComponentDefinition\n): component is TextBoxComponent {\n return component.name === 'text-box';\n}\n\nexport function isStatisticComponent(\n component: ComponentDefinition\n): component is StatisticComponent {\n return component.name === 'statistic';\n}\n\nexport function isTableComponent(\n component: ComponentDefinition\n): component is TableComponent {\n return component.name === 'table';\n}\n\nexport function isListComponent(\n component: ComponentDefinition\n): component is ListComponent {\n return component.name === 'list';\n}\n\nexport function isTocComponent(\n component: ComponentDefinition\n): component is TocComponent {\n return component.name === 'toc';\n}\n\nexport function isHighchartsComponent(\n component: ComponentDefinition\n): component is HighchartsComponent {\n return component.name === 'highcharts';\n}\n\nexport function isTextSpaceAfterComponent(\n component: ComponentDefinition\n): component is TextSpaceAfterComponent {\n return component.name === 'text-space-after';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAS,mBACd,WAC+B;AAC/B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,qBACd,WACiC;AACjC,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,iBACd,WAC6B;AAC7B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,mBACd,WAC+B;AAC/B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,qBACd,WACiC;AACjC,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,iBACd,WAC6B;AAC7B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,gBACd,WAC4B;AAC5B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,eACd,WAC2B;AAC3B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,sBACd,WACkC;AAClC,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,0BACd,WACsC;AACtC,SAAO,UAAU,SAAS;AAC5B;;;AN3VO,IAAM,sBAAsB;","names":["fixSchemaReferences","convertToJsonSchema","createComponentSchema","exportSchemaToFile","transformValueError","transformValueErrors","Value","validateComponent","Value","errors","formattedErrors","validateComponentDefinition","validateComponents"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/validation/parsers/json.ts","../src/validation/validators/theme.ts","../src/validation/validators/component.ts","../src/validation/core/validator.ts","../src/validation/core/errors.ts","../src/types/components.ts"],"sourcesContent":["// Version information\nexport const SHARED_DOCX_VERSION = '1.0.0';\n\n// ============================================================================\n// Format-agnostic re-exports from @json-to-office/shared\n// ============================================================================\n\n// Types\nexport type { ComponentDefinition as SharedComponentDefinition } from '@json-to-office/shared';\nexport type {\n GenerationWarning,\n AddWarningFunction,\n} from '@json-to-office/shared';\n\n// Schema utilities\nexport {\n fixSchemaReferences,\n convertToJsonSchema,\n createComponentSchema,\n createComponentSchemaObject as sharedCreateComponentSchemaObject,\n exportSchemaToFile,\n} from '@json-to-office/shared';\nexport type { ComponentSchemaConfig } from '@json-to-office/shared';\n\n// Validation - format-agnostic from shared\nexport {\n transformValueError,\n transformValueErrors,\n formatErrorSummary,\n groupErrorsByPath,\n createJsonParseError,\n calculatePosition,\n} from '@json-to-office/shared';\nexport type { ValidationError, ValidationResult } from '@json-to-office/shared';\nexport {\n type ErrorFormatterConfig,\n DEFAULT_ERROR_CONFIG,\n createErrorConfig,\n ERROR_EMOJIS,\n formatErrorMessage,\n} from '@json-to-office/shared';\nexport {\n isUnionSchema,\n isObjectSchema,\n isLiteralSchema,\n getObjectSchemaPropertyNames,\n getLiteralValue,\n extractStandardComponentNames,\n clearComponentNamesCache,\n getSchemaMetadata,\n} from '@json-to-office/shared';\n\n// Semver utilities\nexport {\n isValidSemver,\n parseSemver,\n compareSemver,\n latestVersion,\n type ParsedSemver,\n} from '@json-to-office/shared';\n\n// ============================================================================\n// Docx-specific: Document schemas\n// ============================================================================\n\nexport {\n JsonComponentDefinitionSchema,\n JSON_SCHEMA_URLS,\n validateDocumentWithSchema,\n validateJsonComponent as validateJsonComponentDoc,\n} from './schemas/document';\n\nexport type {\n DocumentValidationResult,\n ValidationError as DocumentValidationError,\n} from './schemas/document';\n\n// ============================================================================\n// Docx-specific: Theme schemas\n// ============================================================================\n\nexport { ThemeConfigSchema, isValidThemeConfig } from './schemas/theme';\n\nexport type {\n ThemeConfigJson,\n StyleDefinitions,\n DocumentMargins,\n PageDimensions,\n Page,\n FontDefinition,\n Fonts,\n ComponentDefaults,\n HeadingComponentDefaults,\n ParagraphComponentDefaults,\n ImageComponentDefaults,\n StatisticComponentDefaults,\n TableComponentDefaults,\n SectionComponentDefaults,\n ColumnsComponentDefaults,\n ListComponentDefaults,\n HeadingDefinition,\n} from './schemas/theme';\n\n// ============================================================================\n// Docx-specific: API schemas\n// ============================================================================\n\nexport * from './schemas/api';\n\n// ============================================================================\n// Docx-specific: Validation utilities\n// ============================================================================\n\n// Parser utilities\nexport {\n JsonDocumentParser,\n JsonParsingError,\n JsonValidationError,\n parseJsonComponent,\n validateJsonComponent,\n parseJsonWithLineNumbers,\n} from './validation/parsers/json';\n\n// Theme validators\nexport {\n validateThemeJson,\n isValidThemeJson,\n getValidationSummary,\n} from './validation/validators/theme';\n\n// Component validators\nexport {\n validateComponentProps,\n safeValidateComponentProps,\n safeValidateComponentDefinition,\n isReportProps,\n isSectionProps,\n isHeadingProps,\n isParagraphProps,\n isColumnsProps,\n isImageProps,\n isStatisticProps,\n isTableProps,\n isListProps,\n isCustomComponentProps,\n getValidationErrors,\n} from './validation/validators/component';\n\n// Export formatValidationErrors from theme validator (works for both)\nexport { formatValidationErrors } from './validation/validators/theme';\n\n// New comprehensive validation exports\nexport {\n // Core validators\n validateComponent,\n validateComponentDefinition,\n validateComponents,\n transformAndValidate,\n createValidatedComponent,\n isValidComponent,\n // Error formatting\n formatValidationError,\n formatValidationErrorStrings,\n formatErrorReport,\n getErrorSummary,\n hasCriticalErrors,\n getValidationContext,\n} from './validation';\n\n// Export types from validation\nexport type { ThemeValidationResult } from './validation/validators/theme';\n\nexport type {\n CoreValidationResult,\n StandardComponentName,\n FormattedError,\n} from './validation';\n\n// ============================================================================\n// Docx-specific: Unified Validation System\n// ============================================================================\n\nexport * from './validation/unified';\n\n// Re-export the simple validation API as the main validation interface\nexport { validate, validateStrict } from './validation/unified';\n\n// ============================================================================\n// Docx-specific: Component schemas (JavaScript values)\n// ============================================================================\n\nexport {\n AlignmentSchema,\n JustifiedAlignmentSchema,\n HeadingLevelSchema,\n SpacingSchema,\n LineSpacingSchema,\n IndentSchema,\n NumberingSchema,\n BorderSchema,\n MarginsSchema,\n BaseComponentPropsSchema,\n ReportPropsSchema,\n SectionPropsSchema,\n ColumnsPropsSchema,\n HeadingPropsSchema,\n ParagraphPropsSchema,\n ImagePropsSchema,\n TextBoxPropsSchema,\n StatisticPropsSchema,\n TablePropsSchema,\n ListPropsSchema,\n TocPropsSchema,\n StandardComponentDefinitionSchema,\n ComponentDefinitionSchema,\n} from './schemas/components';\n\n// Component types - export as types only\nexport type {\n BaseComponentProps,\n ReportProps,\n SectionProps,\n ColumnsProps,\n HeadingProps,\n ParagraphProps,\n ImageProps,\n TextBoxProps,\n StatisticProps,\n TableProps,\n ListProps,\n TocProps,\n Alignment,\n JustifiedAlignment,\n HeadingLevel,\n Spacing,\n LineSpacing,\n Indent,\n Numbering,\n} from './schemas/components';\n\n// Export ComponentDefinition from types/components.ts (better type inference)\nexport type {\n ComponentDefinition,\n StandardComponentDefinition,\n} from './types/components';\n\nexport {\n STANDARD_COMPONENTS,\n STANDARD_COMPONENTS_SET,\n} from './types/components';\n\n// Highcharts component schema (standard component)\nexport { HighchartsPropsSchema } from './schemas/components/highcharts';\nexport type { HighchartsProps } from './schemas/components/highcharts';\n\n// Custom component schemas\nexport {\n TextSpaceAfterPropsSchema,\n TextSpaceAfterComponentSchema,\n CustomComponentDefinitionSchema,\n} from './schemas/custom-components';\n\nexport type { TextSpaceAfterProps } from './schemas/custom-components';\n\n// Legacy support - re-export common types from schemas\nexport type { ThemeName } from './types/common';\n\n// ============================================================================\n// Docx-specific: Schema Export Utilities\n// ============================================================================\n\nexport {\n fixSchemaReferences as fixDocxSchemaReferences,\n convertToJsonSchema as convertDocxToJsonSchema,\n createComponentSchema as createDocxComponentSchema,\n exportSchemaToFile as exportDocxSchemaToFile,\n COMPONENT_METADATA,\n BASE_SCHEMA_METADATA,\n THEME_SCHEMA_METADATA,\n} from './schemas/export';\n\nexport type { ComponentSchemaConfig as DocxComponentSchemaConfig } from './schemas/export';\n\n// ============================================================================\n// Docx-specific: Unified Schema Generation\n// ============================================================================\n\nexport { generateUnifiedDocumentSchema } from './schemas/generator';\n\nexport type {\n CustomComponentInfo,\n GenerateDocumentSchemaOptions,\n} from './schemas/generator';\n\n// ============================================================================\n// Docx-specific: Plugin System Type Support\n// ============================================================================\n\nexport {\n type ReportComponent,\n type SectionComponent,\n type ColumnsComponent,\n type HeadingComponent,\n type ParagraphComponent,\n type TextBoxComponent,\n type ImageComponent,\n type HighchartsComponent,\n type StatisticComponent,\n type TableComponent,\n type ListComponent,\n type TocComponent,\n type TextSpaceAfterComponent,\n isReportComponent,\n isSectionComponent,\n isColumnsComponent,\n isHeadingComponent,\n isParagraphComponent,\n isTextBoxComponent,\n isImageComponent,\n isHighchartsComponent,\n isStatisticComponent,\n isTableComponent,\n isListComponent,\n isTocComponent,\n isTextSpaceAfterComponent,\n} from './types/components';\n","import { Value, ValueError } from '@sinclair/typebox/value';\nimport { FormatRegistry } from '@sinclair/typebox';\nimport {\n DocumentValidationResult,\n ValidationError,\n} from '../../schemas/document';\nimport {\n ComponentDefinitionSchema,\n ComponentDefinition,\n} from '../../schemas/components';\n\n// Register format validators with TypeBox\nFormatRegistry.Set('uri', (value: string) => {\n // Accept URLs, relative paths, and file paths\n try {\n new URL(value);\n return true;\n } catch {\n // Check if it's a relative path (common for JSON schemas)\n if (\n value.includes('.json') ||\n value.includes('/') ||\n value.includes('\\\\')\n ) {\n return true;\n }\n // Check if it's an HTTP/HTTPS URL\n return /^https?:\\/\\/.+/.test(value);\n }\n});\n\nFormatRegistry.Set('date-time', (value: string) => {\n // ISO 8601 date-time format validation\n const dateTimeRegex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z?$/;\n return dateTimeRegex.test(value) && !isNaN(Date.parse(value));\n});\n\n/**\n * JSON parser\n * @module validation/parsers/json\n * @description\n * Advanced JSON parsing with line number tracking and detailed error reporting.\n * Provides enhanced error messages for JSON syntax and validation errors.\n */\n\n/**\n * JSON Document Parser - Handles parsing and validation of JSON report definitions\n */\nexport class JsonDocumentParser {\n private schema = ComponentDefinitionSchema;\n\n constructor() {\n // Schema is assigned above\n }\n\n /**\n * Parse JSON input (string or object) and validate against schema\n * Only supports unified ComponentDefinition structure where document IS a report component\n */\n public parse(jsonInput: string | object): ComponentDefinition {\n let parsedObject: unknown;\n\n // Step 1: Parse JSON if it's a string\n if (typeof jsonInput === 'string') {\n try {\n parsedObject = JSON.parse(jsonInput);\n } catch (error) {\n throw new JsonParsingError(\n 'Invalid JSON syntax',\n this.extractJSONSyntaxError(error as Error, jsonInput)\n );\n }\n } else {\n parsedObject = jsonInput;\n }\n\n // Step 2: Validate it's a report component\n if (\n typeof parsedObject !== 'object' ||\n parsedObject === null ||\n !('name' in parsedObject) ||\n (parsedObject as any).name !== 'docx'\n ) {\n throw new JsonValidationError(\n 'Invalid document structure: Document must be a docx component with name=\"docx\"',\n [\n {\n path: 'name',\n message: 'Document must be a docx component with name=\"docx\"',\n code: 'INVALID_STRUCTURE',\n },\n ]\n );\n }\n\n // Step 3: Validate against schema\n if (!Value.Check(this.schema, parsedObject)) {\n const errors = [...Value.Errors(this.schema, parsedObject)];\n\n throw new JsonValidationError(\n 'JSON validation failed',\n this.formatTypeBoxErrors(\n errors,\n typeof jsonInput === 'string'\n ? jsonInput\n : JSON.stringify(jsonInput, null, 2)\n )\n );\n }\n\n return parsedObject as ComponentDefinition;\n }\n\n /**\n * Validate JSON without throwing errors - returns ValidationResult\n */\n public validate(jsonInput: string | object): DocumentValidationResult {\n try {\n this.parse(jsonInput);\n return {\n valid: true,\n errors: [],\n warnings: [],\n };\n } catch (error) {\n if (\n error instanceof JsonParsingError ||\n error instanceof JsonValidationError\n ) {\n return {\n valid: false,\n errors: error.validationErrors,\n warnings: [],\n };\n }\n\n // Unexpected error\n return {\n valid: false,\n errors: [\n {\n path: '',\n message:\n error instanceof Error\n ? error.message\n : 'Unknown validation error',\n code: 'UNEXPECTED_ERROR',\n },\n ],\n warnings: [],\n };\n }\n }\n\n /**\n * Parse JSON file content with line number tracking\n */\n public parseWithLineNumbers(jsonString: string): ComponentDefinition {\n const lines = jsonString.split('\\n');\n\n try {\n return this.parse(jsonString);\n } catch (error) {\n if (\n error instanceof JsonParsingError ||\n error instanceof JsonValidationError\n ) {\n // Enhance errors with line numbers\n const enhancedErrors = error.validationErrors.map((err) => ({\n ...err,\n ...this.findLineNumber(err.path, jsonString, lines),\n }));\n\n if (error instanceof JsonParsingError) {\n throw new JsonParsingError(error.message, enhancedErrors);\n } else {\n throw new JsonValidationError(error.message, enhancedErrors);\n }\n }\n throw error;\n }\n }\n\n /**\n * Extract JSON syntax error information\n */\n private extractJSONSyntaxError(\n error: Error,\n jsonString: string\n ): ValidationError[] {\n const message = error.message;\n\n // Try to extract position from error message\n const positionMatch =\n message.match(/position\\s+(\\d+)/i) ||\n message.match(/at\\s+(\\d+)/i) ||\n message.match(/character\\s+(\\d+)/i);\n\n let line = 0;\n let column = 0;\n\n if (positionMatch) {\n const position = parseInt(positionMatch[1], 10);\n const lines = jsonString.substring(0, position).split('\\n');\n line = lines.length;\n column = lines[lines.length - 1].length + 1;\n }\n\n return [\n {\n path: '',\n message: `JSON syntax error: ${message}`,\n code: 'JSON_SYNTAX_ERROR',\n line: line || undefined,\n column: column || undefined,\n suggestions: [\n 'Check for missing commas, brackets, or quotes',\n 'Validate JSON syntax using a JSON validator',\n 'Ensure all strings are properly quoted',\n ],\n },\n ];\n }\n\n /**\n * Format TypeBox validation errors into ValidationError format\n */\n private formatTypeBoxErrors(\n errors: ValueError[],\n originalJson: string\n ): ValidationError[] {\n return errors.map((error) => {\n const path = error.path || '';\n const lineInfo = this.findLineNumber(path, originalJson);\n\n return {\n path,\n message: this.formatTypeBoxErrorMessage(error),\n code: this.getErrorCode(error),\n line: lineInfo.line,\n column: lineInfo.column,\n suggestions: this.generateSuggestions(error),\n };\n });\n }\n\n /**\n * Format individual TypeBox error message\n */\n private formatTypeBoxErrorMessage(error: ValueError): string {\n const path = error.path ? `at \"${error.path}\"` : '';\n const message = error.message;\n\n // TypeBox provides descriptive messages, so we can use them directly\n // but enhance common patterns\n if (message.includes('Expected')) {\n return `${message} ${path}`;\n } else if (message.includes('Required property')) {\n return `${message} ${path}`;\n } else if (message.includes('Unexpected property')) {\n return `${message} ${path}`;\n } else if (message.includes('minimum')) {\n return `Value is too small ${path}. ${message}`;\n } else if (message.includes('maximum')) {\n return `Value is too big ${path}. ${message}`;\n } else {\n return `${message} ${path}`;\n }\n }\n\n /**\n * Get error code from TypeBox error\n */\n private getErrorCode(error: ValueError): string {\n const baseCode = String(error.type || 'VALIDATION_ERROR').toUpperCase();\n const path = error.path ? error.path.replace(/\\//g, '_').toUpperCase() : '';\n return path ? `${baseCode}_${path}` : baseCode;\n }\n\n /**\n * Generate helpful suggestions based on error type\n */\n private generateSuggestions(error: ValueError): string[] {\n const suggestions: string[] = [];\n const message = error.message;\n\n // Parse TypeBox error messages to provide suggestions\n if (message.includes('Expected string')) {\n suggestions.push('Ensure the value is wrapped in quotes');\n } else if (message.includes('Expected number')) {\n suggestions.push('Remove quotes around numeric values');\n } else if (message.includes('Expected array')) {\n suggestions.push('Use square brackets [] for arrays');\n } else if (message.includes('Expected object')) {\n suggestions.push('Use curly braces {} for objects');\n } else if (message.includes('Expected literal')) {\n const match = message.match(/Expected literal (.+)/);\n if (match) {\n suggestions.push(`Use the exact value: ${match[1]}`);\n }\n } else if (message.includes('Unexpected property')) {\n suggestions.push('Remove unknown properties or check spelling');\n suggestions.push(\n 'Refer to the JSON schema documentation for valid properties'\n );\n } else if (message.includes('Expected union')) {\n suggestions.push(\n 'Check that the value matches one of the allowed formats'\n );\n suggestions.push('Verify the module type is spelled correctly');\n } else if (message.includes('minimum')) {\n const match = message.match(/minimum.*?(\\d+)/);\n if (match) {\n if (message.includes('Array')) {\n suggestions.push(`Array must have at least ${match[1]} items`);\n } else {\n suggestions.push(`Value must be at least ${match[1]}`);\n }\n }\n } else if (message.includes('format') && message.includes('uri')) {\n suggestions.push(\n 'Ensure the URL is valid and starts with http:// or https://'\n );\n }\n\n // Generic suggestions\n if (suggestions.length === 0) {\n suggestions.push('Check the JSON schema documentation for valid values');\n suggestions.push('Verify the property name and value format');\n }\n\n return suggestions;\n }\n\n /**\n * Find line and column number for a given JSON path\n */\n private findLineNumber(\n path: string,\n jsonString: string,\n lines?: string[]\n ): { line?: number; column?: number } {\n if (!path) {\n return {};\n }\n\n const jsonLines = lines || jsonString.split('\\n');\n const pathParts = path.split('.');\n\n // Simple heuristic: find the line containing the property name\n for (let i = 0; i < jsonLines.length; i++) {\n const line = jsonLines[i];\n const lastPathPart = pathParts[pathParts.length - 1];\n\n // Look for property name in quotes\n if (line.includes(`\"${lastPathPart}\"`)) {\n const column = line.indexOf(`\"${lastPathPart}\"`) + 1;\n return {\n line: i + 1,\n column,\n };\n }\n }\n\n return {};\n }\n}\n\n/**\n * Custom error classes for better error handling\n */\nexport class JsonParsingError extends Error {\n public readonly validationErrors: ValidationError[];\n\n constructor(message: string, errors: ValidationError[]) {\n super(message);\n this.name = 'JsonParsingError';\n this.validationErrors = errors;\n }\n}\n\nexport class JsonValidationError extends Error {\n public readonly validationErrors: ValidationError[];\n\n constructor(message: string, errors: ValidationError[]) {\n super(message);\n this.name = 'JsonValidationError';\n this.validationErrors = errors;\n }\n}\n\n/**\n * Utility functions for external use\n */\n\n/**\n * Parse and validate JSON component definition\n * Only supports report components (documents)\n */\nexport function parseJsonComponent(\n jsonInput: string | object\n): ComponentDefinition {\n const parser = new JsonDocumentParser();\n return parser.parse(jsonInput);\n}\n\n/**\n * Validate JSON component definition without throwing\n * Now uses unified validation\n */\nexport { validateJsonDocument as validateJsonComponent } from '../unified/document-validator';\n\n/**\n * Parse JSON with enhanced line number error reporting\n * Only supports unified ComponentDefinition structure where document IS a report component\n */\nexport function parseJsonWithLineNumbers(\n jsonString: string\n): ComponentDefinition {\n const parser = new JsonDocumentParser();\n return parser.parseWithLineNumbers(jsonString);\n}\n","/**\n * Theme validators\n * @module validation/validators/theme\n * @description\n * Now uses unified validation system\n */\n\n// Re-export everything from unified theme validator\nexport {\n validateThemeJson,\n isValidTheme as isValidThemeJson,\n getThemeName,\n isThemeConfig,\n type ThemeValidationResult,\n} from '../unified/theme-validator';\n\n// Re-export utility for getting validation summary\nexport { getValidationSummary } from '../unified/base-validator';\n\n// For backward compatibility, provide formatValidationErrors\nexport function formatValidationErrors(errors: any[]): string[] {\n if (!Array.isArray(errors)) return [];\n\n return errors.map((error) => {\n if (typeof error === 'string') return error;\n\n const path = error.path ? `${error.path}: ` : '';\n const message = error.message || 'Validation error';\n return `${path}${message}`;\n });\n}\n","/**\n * Component validators\n * @module validation/validators/component\n * @description\n * Now uses unified validation system\n */\n\nimport {\n validateComponent as unifiedValidateComponent,\n validateComponentDefinition as unifiedValidateComponentDefinition,\n isStandardComponentName,\n} from '../unified/component-validator';\n\n// Re-export everything from unified component validator\nexport {\n validateComponent as validateComponentProps,\n validateComponentDefinition,\n validateComponents,\n validateCustomComponentProps,\n isStandardComponentName,\n // Type guards\n isReportProps,\n isSectionProps,\n isHeadingProps,\n isParagraphProps,\n isColumnsProps,\n isImageProps,\n isStatisticProps,\n isTableProps,\n isListProps,\n isCustomComponentProps,\n type StandardComponentName,\n} from '../unified/component-validator';\n\n// For backward compatibility, provide safeValidateComponentProps\nexport function safeValidateComponentProps<T>(\n name: string,\n props: unknown\n): { success: true; data: T } | { success: false; error: any[] } {\n // For non-standard types, use 'custom'\n const componentName = isStandardComponentName(name) ? name : 'custom';\n const result = unifiedValidateComponent(componentName, props);\n\n if (result.valid) {\n return { success: true, data: result.data as T };\n }\n\n return { success: false, error: result.errors || [] };\n}\n\n// For backward compatibility, provide safeValidateComponentDefinition\nexport function safeValidateComponentDefinition(\n component: unknown\n): { success: true; data: any } | { success: false; error: any[] } {\n const result = unifiedValidateComponentDefinition(component);\n\n if (result.valid) {\n return { success: true, data: result.data };\n }\n\n return { success: false, error: result.errors || [] };\n}\n\n// For backward compatibility, provide error formatting\nexport function getValidationErrors(props: unknown, name?: string): string[] {\n // For non-standard types, use 'custom'\n const componentName = name && isStandardComponentName(name) ? name : 'custom';\n const result = unifiedValidateComponent(componentName, props);\n\n if (result.valid) return [];\n\n return (result.errors || []).map((e: any) =>\n e.path ? `${e.path}: ${e.message}` : e.message\n );\n}\n","import { Value } from '@sinclair/typebox/value';\nimport { Static } from '@sinclair/typebox';\nimport {\n ComponentDefinitionSchema,\n ReportPropsSchema,\n SectionPropsSchema,\n HeadingPropsSchema,\n ParagraphPropsSchema,\n ColumnsPropsSchema,\n ImagePropsSchema,\n StatisticPropsSchema,\n TablePropsSchema,\n ListPropsSchema,\n} from '../../schemas/components';\nimport { CustomComponentDefinitionSchema } from '../../schemas/custom-components';\nimport {\n formatTypeBoxError,\n formatTypeBoxErrorStrings,\n formatErrorReport,\n hasCriticalErrors,\n} from './errors';\nimport type {\n CoreValidationResult,\n ValidationOptions,\n BatchValidationResult,\n ComponentValidationConfig,\n DataTransformer,\n} from './types';\n\n/**\n * Core validation engine\n * @module validation/core/validator\n * @description\n * Main validation utilities using TypeBox for runtime validation.\n * Provides comprehensive validation with error handling and data transformation.\n */\n\n/**\n * Component name to schema mapping\n */\nconst COMPONENT_SCHEMA_MAP = {\n report: ReportPropsSchema,\n section: SectionPropsSchema,\n heading: HeadingPropsSchema,\n paragraph: ParagraphPropsSchema,\n columns: ColumnsPropsSchema,\n image: ImagePropsSchema,\n statistic: StatisticPropsSchema,\n table: TablePropsSchema,\n list: ListPropsSchema,\n} as const;\n\nexport type StandardComponentName = keyof typeof COMPONENT_SCHEMA_MAP;\n\n/**\n * Validate any component configuration with comprehensive error handling\n */\nexport function validateComponent<T extends StandardComponentName>(\n name: T,\n props: unknown,\n options?: ValidationOptions\n): CoreValidationResult<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>> {\n const schema = COMPONENT_SCHEMA_MAP[name];\n\n if (!schema) {\n // Handle custom components\n if (Value.Check(CustomComponentDefinitionSchema, props)) {\n return {\n success: true,\n data: props as Static<(typeof COMPONENT_SCHEMA_MAP)[T]>,\n };\n }\n\n const errors = [...Value.Errors(CustomComponentDefinitionSchema, props)];\n const formattedErrors = formatTypeBoxError(errors);\n return {\n success: false,\n errors: formattedErrors,\n errorStrings: formatTypeBoxErrorStrings(errors),\n report: options?.includeReport ? formatErrorReport(errors) : undefined,\n hasCriticalErrors: options?.checkCritical\n ? hasCriticalErrors(errors)\n : undefined,\n };\n }\n\n // Validate with the schema\n if (Value.Check(schema, props)) {\n return {\n success: true,\n data: props as Static<(typeof COMPONENT_SCHEMA_MAP)[T]>,\n };\n }\n\n const errors = [...Value.Errors(schema, props)];\n const formattedErrors = formatTypeBoxError(errors);\n return {\n success: false,\n errors: formattedErrors,\n errorStrings: formatTypeBoxErrorStrings(errors),\n report: options?.includeReport ? formatErrorReport(errors) : undefined,\n hasCriticalErrors: options?.checkCritical\n ? hasCriticalErrors(errors)\n : undefined,\n };\n}\n\n/**\n * Validate a complete component definition (with nested children)\n */\nexport function validateComponentDefinition(\n component: unknown,\n options?: ValidationOptions\n): CoreValidationResult<Static<typeof ComponentDefinitionSchema>> {\n // Check for circular references or excessive nesting\n const maxDepth = options?.maxDepth ?? 10;\n const currentDepth = options?.currentDepth ?? 0;\n\n if (currentDepth > maxDepth) {\n return {\n success: false,\n errors: [\n {\n path: 'children',\n message: `Maximum nesting depth (${maxDepth}) exceeded`,\n code: 'custom',\n suggestion: 'Reduce the nesting level of components',\n },\n ],\n errorStrings: [`Maximum nesting depth (${maxDepth}) exceeded`],\n hasCriticalErrors: true,\n };\n }\n\n if (Value.Check(ComponentDefinitionSchema, component)) {\n // Validate nested children recursively\n const data = component as any;\n const warnings: string[] = [];\n\n if (data.children && Array.isArray(data.children)) {\n for (let i = 0; i < data.children.length; i++) {\n const nestedResult = validateComponentDefinition(data.children[i], {\n ...options,\n currentDepth: currentDepth + 1,\n });\n\n if (!nestedResult.success) {\n // Add context to nested errors\n const nestedErrors = nestedResult.errors?.map((err) => ({\n ...err,\n path: `children[${i}].${err.path}`,\n }));\n\n return {\n success: false,\n errors: nestedErrors,\n errorStrings: nestedErrors?.map(\n (err) => `${err.path}: ${err.message}`\n ),\n report: options?.includeReport\n ? `Validation failed in nested component at index ${i}:\\n${nestedResult.report}`\n : undefined,\n hasCriticalErrors: nestedResult.hasCriticalErrors,\n };\n }\n\n if (nestedResult.warnings) {\n warnings.push(\n ...nestedResult.warnings.map((w) => `children[${i}]: ${w}`)\n );\n }\n }\n }\n\n return {\n success: true,\n data: component as Static<typeof ComponentDefinitionSchema>,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n }\n\n const errors = [...Value.Errors(ComponentDefinitionSchema, component)];\n const formattedErrors = formatTypeBoxError(errors);\n return {\n success: false,\n errors: formattedErrors,\n errorStrings: formatTypeBoxErrorStrings(errors),\n report: options?.includeReport ? formatErrorReport(errors) : undefined,\n hasCriticalErrors: options?.checkCritical\n ? hasCriticalErrors(errors)\n : undefined,\n };\n}\n\n/**\n * Batch validate multiple components\n */\nexport function validateComponents(\n components: ComponentValidationConfig[],\n options?: ValidationOptions\n): BatchValidationResult {\n const results: CoreValidationResult<any>[] = [];\n let criticalCount = 0;\n\n for (const { name, props } of components) {\n const result =\n name in COMPONENT_SCHEMA_MAP\n ? validateComponent(name as StandardComponentName, props, options)\n : validateComponentDefinition(props, options);\n\n results.push(result);\n\n if (result.hasCriticalErrors) {\n criticalCount++;\n }\n\n if (!result.success && options?.stopOnFirst) {\n break;\n }\n }\n\n const valid = results.filter((r) => r.success).length;\n const invalid = results.length - valid;\n\n return {\n success: invalid === 0,\n results,\n summary: {\n total: results.length,\n valid,\n invalid,\n criticalErrors: criticalCount,\n },\n };\n}\n\n/**\n * Transform and validate data (for migration scenarios)\n */\nexport function transformAndValidate<T extends StandardComponentName>(\n name: T,\n data: unknown,\n transformer?: DataTransformer\n): CoreValidationResult<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>> {\n try {\n // Apply custom transformation if provided\n const transformed = transformer ? transformer(data) : data;\n\n // Validate the transformed data\n return validateComponent(name, transformed, {\n includeReport: true,\n checkCritical: true,\n });\n } catch (error) {\n return {\n success: false,\n errors: [\n {\n path: 'root',\n message: `Transformation failed: ${error instanceof Error ? error.message : String(error)}`,\n code: 'custom',\n },\n ],\n errorStrings: [\n `Transformation failed: ${error instanceof Error ? error.message : String(error)}`,\n ],\n hasCriticalErrors: true,\n };\n }\n}\n\n/**\n * Create a validated component with defaults\n */\nexport function createValidatedComponent<T extends StandardComponentName>(\n name: T,\n partialConfig: Partial<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>>\n): CoreValidationResult<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>> {\n const schema = COMPONENT_SCHEMA_MAP[name];\n\n if (!schema) {\n return {\n success: false,\n errors: [\n {\n path: 'name',\n message: `Unknown component name: ${name}`,\n code: 'custom',\n suggestion: `Use one of: ${Object.keys(COMPONENT_SCHEMA_MAP).join(', ')}`,\n },\n ],\n errorStrings: [`Unknown component name: ${name}`],\n hasCriticalErrors: true,\n };\n }\n\n // Validate with TypeBox\n if (Value.Check(schema, partialConfig)) {\n return {\n success: true,\n data: partialConfig as Static<(typeof COMPONENT_SCHEMA_MAP)[T]>,\n };\n }\n\n const errors = [...Value.Errors(schema, partialConfig)];\n const formattedErrors = formatTypeBoxError(errors);\n return {\n success: false,\n errors: formattedErrors,\n errorStrings: formatTypeBoxErrorStrings(errors),\n report: formatErrorReport(errors),\n hasCriticalErrors: hasCriticalErrors(errors),\n };\n}\n\n/**\n * Type guard functions with proper error context\n */\nexport function isValidComponent<T extends StandardComponentName>(\n name: T,\n props: unknown\n): props is Static<(typeof COMPONENT_SCHEMA_MAP)[T]> {\n const result = validateComponent(name, props);\n return result.success;\n}\n\n/**\n * Validate JSON string input\n */\nexport function validateJsonComponent<T extends StandardComponentName>(\n name: T,\n jsonString: string\n): CoreValidationResult<Static<(typeof COMPONENT_SCHEMA_MAP)[T]>> {\n try {\n const parsed = JSON.parse(jsonString);\n return validateComponent(name, parsed, {\n includeReport: true,\n checkCritical: true,\n });\n } catch (error) {\n return {\n success: false,\n errors: [\n {\n path: 'root',\n message: `Invalid JSON: ${error instanceof Error ? error.message : String(error)}`,\n code: 'custom',\n suggestion: 'Check for syntax errors in your JSON',\n },\n ],\n errorStrings: [\n `Invalid JSON: ${error instanceof Error ? error.message : String(error)}`,\n ],\n hasCriticalErrors: true,\n };\n }\n}\n","import { ValueError } from '@sinclair/typebox/value';\nimport type { FormattedError } from './types';\n\n/**\n * Error formatting utilities\n * @module validation/core/errors\n * @description\n * Enhanced error formatting for TypeBox validation errors.\n * Provides detailed, user-friendly error messages with context and suggestions.\n */\n\n/**\n * Format a single TypeBox error into a user-friendly error message\n */\nfunction formatSingleIssue(issue: ValueError): FormattedError {\n const path = issue.path || 'root';\n let message = issue.message;\n let suggestion: string | undefined;\n let expected: string | undefined;\n let received: string | undefined;\n let options: string[] | undefined;\n\n // Enhance error messages based on error type\n if (message.includes('Expected')) {\n const match = message.match(/Expected (.+) but received (.+)/);\n if (match) {\n expected = match[1];\n received = match[2];\n suggestion = getSuggestionForType(expected, received);\n }\n }\n\n // Handle required property errors\n if (message.includes('Required property')) {\n const match = message.match(/Required property '(.+)'/);\n if (match) {\n message = `Missing required field: ${match[1]}`;\n suggestion = `Add the required field: ${match[1]}`;\n }\n }\n\n // Handle unexpected property errors\n if (message.includes('Unexpected property')) {\n const match = message.match(/Unexpected property '(.+)'/);\n if (match) {\n message = `Unknown property: ${match[1]}`;\n suggestion = `Remove the unknown property: ${match[1]}`;\n }\n }\n\n // Handle union type errors\n if (message.includes('Expected union')) {\n message = 'Value does not match any of the expected types';\n suggestion = 'Check the documentation for valid format options';\n }\n\n // Handle literal value errors\n if (message.includes('Expected literal')) {\n const match = message.match(/Expected literal (.+)/);\n if (match) {\n expected = match[1];\n message = `Expected value: ${expected}`;\n suggestion = `Use the exact value: ${expected}`;\n }\n }\n\n // Handle string length errors\n if (message.includes('String length')) {\n const minMatch = message.match(/minimum length of (\\d+)/);\n const maxMatch = message.match(/maximum length of (\\d+)/);\n if (minMatch) {\n message = `String must be at least ${minMatch[1]} characters long`;\n suggestion = `Add more characters to meet the minimum length of ${minMatch[1]}`;\n } else if (maxMatch) {\n message = `String must be at most ${maxMatch[1]} characters long`;\n suggestion = `Reduce to ${maxMatch[1]} characters or less`;\n }\n }\n\n // Handle number range errors\n if (message.includes('Expected number')) {\n const minMatch = message.match(/minimum value of ([\\d.]+)/);\n const maxMatch = message.match(/maximum value of ([\\d.]+)/);\n if (minMatch) {\n message = `Number must be greater than or equal to ${minMatch[1]}`;\n suggestion = `Use a value of ${minMatch[1]} or higher`;\n } else if (maxMatch) {\n message = `Number must be less than or equal to ${maxMatch[1]}`;\n suggestion = `Use a value of ${maxMatch[1]} or lower`;\n }\n }\n\n // Handle array length errors\n if (message.includes('Array length')) {\n const minMatch = message.match(/minimum length of (\\d+)/);\n const maxMatch = message.match(/maximum length of (\\d+)/);\n if (minMatch) {\n message = `Array must have at least ${minMatch[1]} items`;\n suggestion = `Add more items to meet the minimum of ${minMatch[1]}`;\n } else if (maxMatch) {\n message = `Array must have at most ${maxMatch[1]} items`;\n suggestion = `Remove items to meet the maximum of ${maxMatch[1]}`;\n }\n }\n\n // Handle format errors\n if (message.includes('format')) {\n if (message.includes('email')) {\n message = 'Invalid email address format';\n suggestion = 'Use a valid email format like user@example.com';\n } else if (message.includes('uri') || message.includes('url')) {\n message = 'Invalid URL format';\n suggestion = 'Use a valid URL format like https://example.com';\n } else if (message.includes('date-time')) {\n message = 'Invalid date-time format';\n suggestion = 'Use ISO 8601 format like 2024-01-01T00:00:00Z';\n }\n }\n\n // Handle pattern errors\n if (message.includes('pattern')) {\n message = 'String does not match the required pattern';\n suggestion = 'Check the format requirements for this field';\n }\n\n return {\n path,\n message,\n code: String(issue.type || 'validation_error'),\n suggestion,\n expected,\n received,\n options,\n };\n}\n\n/**\n * Get type-specific suggestions for common type mismatches\n */\nfunction getSuggestionForType(\n expected: string,\n received: string\n): string | undefined {\n // Number/String confusion\n if (expected === 'number' && received === 'string') {\n return 'Remove quotes or convert the string to a number';\n }\n if (expected === 'string' && received === 'number') {\n return 'Add quotes or convert the number to a string';\n }\n\n // Boolean confusion\n if (expected === 'boolean') {\n return 'Use true or false (without quotes)';\n }\n\n // Array/Object confusion\n if (expected === 'array' && received === 'object') {\n return 'Use square brackets [] for arrays instead of curly braces {}';\n }\n if (expected === 'object' && received === 'array') {\n return 'Use curly braces {} for objects instead of square brackets []';\n }\n\n // Null/undefined handling\n if (received === 'null' || received === 'undefined') {\n return `Provide a valid ${expected} value or mark the field as optional`;\n }\n\n return undefined;\n}\n\n/**\n * Format TypeBox validation errors into detailed, user-friendly messages\n */\nexport function formatTypeBoxError(errors: ValueError[]): FormattedError[] {\n return errors.map(formatSingleIssue);\n}\n\n/**\n * Format errors as simple string array (backward compatible)\n */\nexport function formatTypeBoxErrorStrings(errors: ValueError[]): string[] {\n return formatTypeBoxError(errors).map((err) => {\n let msg = `${err.path}: ${err.message}`;\n if (err.suggestion) {\n msg += ` (Suggestion: ${err.suggestion})`;\n }\n return msg;\n });\n}\n\n/**\n * Get a summary of validation errors grouped by path\n */\nexport function getErrorSummary(\n errors: ValueError[]\n): Map<string, FormattedError[]> {\n const summary = new Map<string, FormattedError[]>();\n\n for (const formattedError of formatTypeBoxError(errors)) {\n const existing = summary.get(formattedError.path) || [];\n existing.push(formattedError);\n summary.set(formattedError.path, existing);\n }\n\n return summary;\n}\n\n/**\n * Format validation errors as a detailed report\n */\nexport function formatErrorReport(errors: ValueError[]): string {\n const formattedErrors = formatTypeBoxError(errors);\n const summary = getErrorSummary(errors);\n\n let report = `Validation failed with ${formattedErrors.length} error${formattedErrors.length > 1 ? 's' : ''}:\\n\\n`;\n\n for (const [path, pathErrors] of summary) {\n report += `📍 ${path}:\\n`;\n for (const err of pathErrors) {\n report += ` ❌ ${err.message}\\n`;\n if (err.suggestion) {\n report += ` 💡 ${err.suggestion}\\n`;\n }\n if (err.expected && err.received) {\n report += ` 📋 Expected: ${err.expected}, Received: ${err.received}\\n`;\n }\n if (err.options) {\n report += ` 📋 Valid options: ${err.options.join(', ')}\\n`;\n }\n }\n report += '\\n';\n }\n\n return report;\n}\n\n/**\n * Check if an error is critical (affects core functionality)\n */\nexport function hasCriticalErrors(errors: ValueError[]): boolean {\n return errors.some((issue) => {\n // Missing required fields are critical\n if (issue.message.includes('Required property')) {\n return true;\n }\n\n // Invalid component names are critical\n if (\n issue.path.includes('name') &&\n issue.message.includes('Expected literal')\n ) {\n return true;\n }\n\n // Schema structure errors are critical\n if (\n issue.message.includes('Expected union') ||\n issue.message.includes('Never')\n ) {\n return true;\n }\n\n return false;\n });\n}\n\n/**\n * Get validation context for better error messages\n */\nexport function getValidationContext(path: string): string {\n if (!path || path === 'root') return 'document root';\n\n const pathParts = path.split('.');\n\n // Identify component context\n if (pathParts.includes('children')) {\n const childIndex = pathParts.indexOf('children');\n if (pathParts.length > childIndex + 1) {\n const index = pathParts[childIndex + 1];\n return `component at index ${index}`;\n }\n }\n\n // Identify props context\n if (pathParts.includes('props')) {\n return 'props section';\n }\n\n // Identify theme context\n if (pathParts.includes('theme')) {\n return 'theme configuration';\n }\n\n return pathParts.join(' > ');\n}\n\n// ============================================================================\n// Legacy Compatibility Exports (for API backward compatibility)\n// ============================================================================\n\n// Primary exports - use formatTypeBoxError and formatTypeBoxErrorStrings directly\nexport const formatValidationError = formatTypeBoxError;\nexport const formatValidationErrorStrings = formatTypeBoxErrorStrings;\n","/**\n * Component Type Definitions for Plugin System\n *\n * This file provides properly typed discriminated union interfaces for all component types.\n * These types enable TypeScript to automatically infer component props based on\n * the 'name' field when building component arrays in render functions.\n */\n\nimport type { Static } from '@sinclair/typebox';\nimport type {\n ReportPropsSchema,\n SectionPropsSchema,\n HeadingPropsSchema,\n ParagraphPropsSchema,\n ColumnsPropsSchema,\n ImagePropsSchema,\n HighchartsPropsSchema,\n StatisticPropsSchema,\n TablePropsSchema,\n ListPropsSchema,\n TocPropsSchema,\n} from '../schemas/components';\n\nimport type { TextSpaceAfterPropsSchema } from '../schemas/custom-components';\nimport type { TextBoxPropsSchema } from '../schemas/components/text-box';\n\n// ============================================================================\n// Standard Component Types with Discriminated Union Support\n// ============================================================================\n\n/**\n * Report component with literal name discriminator\n */\nexport interface ReportComponent {\n name: 'docx';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ReportPropsSchema>;\n children?: ComponentDefinition[];\n}\n\n/**\n * Section component with literal name discriminator\n */\nexport interface SectionComponent {\n name: 'section';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof SectionPropsSchema>;\n children?: ComponentDefinition[];\n}\n\n/**\n * Columns component with literal name discriminator\n */\nexport interface ColumnsComponent {\n name: 'columns';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ColumnsPropsSchema>;\n children?: ComponentDefinition[];\n}\n\n/**\n * Heading component with literal name discriminator\n */\nexport interface HeadingComponent {\n name: 'heading';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof HeadingPropsSchema>;\n}\n\n/**\n * Paragraph component with literal name discriminator\n */\nexport interface ParagraphComponent {\n name: 'paragraph';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ParagraphPropsSchema>;\n}\n\n/**\n * Image component with literal name discriminator\n */\nexport interface ImageComponent {\n name: 'image';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ImagePropsSchema>;\n}\n\n/**\n * Statistic component with literal name discriminator\n */\nexport interface StatisticComponent {\n name: 'statistic';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof StatisticPropsSchema>;\n}\n\n/**\n * Table component with literal name discriminator\n */\nexport interface TableComponent {\n name: 'table';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof TablePropsSchema>;\n}\n\n/**\n * Highcharts component with literal name discriminator\n */\nexport interface HighchartsComponent {\n name: 'highcharts';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof HighchartsPropsSchema>;\n}\n\n/**\n * Text Box component with literal name discriminator\n * Container for child components with floating positioning\n */\nexport interface TextBoxComponent {\n name: 'text-box';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof TextBoxPropsSchema>;\n children?: ComponentDefinition[];\n}\n\n/**\n * List component with literal name discriminator\n */\nexport interface ListComponent {\n name: 'list';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof ListPropsSchema>;\n}\n\n/**\n * Table of Contents component with literal name discriminator\n */\nexport interface TocComponent {\n name: 'toc';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof TocPropsSchema>;\n}\n\n// ============================================================================\n// Specific Custom Component Types\n// ============================================================================\n\n/**\n * Text Space After component with literal name discriminator\n */\nexport interface TextSpaceAfterComponent {\n name: 'text-space-after';\n id?: string;\n /** When false, this component is filtered out and not rendered. Defaults to true */\n enabled?: boolean;\n props: Static<typeof TextSpaceAfterPropsSchema>;\n}\n\n// ============================================================================\n// Discriminated Union Types\n// ============================================================================\n\n/**\n * Union of all standard component types\n */\nexport type StandardComponentDefinition =\n | ReportComponent\n | SectionComponent\n | ColumnsComponent\n | HeadingComponent\n | ParagraphComponent\n | TextBoxComponent\n | ImageComponent\n | HighchartsComponent\n | StatisticComponent\n | TableComponent\n | ListComponent\n | TocComponent;\n\n/**\n * Array of all standard component names.\n * Useful for iterating, validation, or displaying available components to users.\n */\nexport const STANDARD_COMPONENTS = [\n 'columns',\n 'heading',\n 'highcharts',\n 'image',\n 'list',\n 'paragraph',\n 'docx',\n 'section',\n 'statistic',\n 'table',\n 'text-box',\n 'toc',\n] as const satisfies readonly StandardComponentDefinition['name'][];\n\n/**\n * Set of all standard component names for O(1) lookup.\n */\nexport const STANDARD_COMPONENTS_SET: ReadonlySet<\n (typeof STANDARD_COMPONENTS)[number]\n> = new Set(STANDARD_COMPONENTS);\n\n// Compile-time completeness check: produces TS2344 listing the missing name(s)\n// if a standard component is added to the union but not to the array above.\ntype AssertNever<T extends never> = T;\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype _AssertAllIncluded = AssertNever<\n Exclude<\n StandardComponentDefinition['name'],\n (typeof STANDARD_COMPONENTS)[number]\n >\n>;\n\n/**\n * Complete discriminated union of all component types.\n * TypeScript will automatically narrow the type based on the 'name' field.\n *\n * @example\n * ```typescript\n * const components: ComponentDefinition[] = [\n * {\n * name: 'heading', // TypeScript knows this is HeadingComponent\n * props: {\n * level: 2, // Autocomplete works!\n * text: 'Title'\n * }\n * },\n * {\n * name: 'paragraph', // TypeScript knows this is ParagraphComponent\n * props: {\n * content: 'Hello World',\n * bold: true // Autocomplete works!\n * }\n * }\n * ];\n * ```\n */\nexport type ComponentDefinition =\n | StandardComponentDefinition\n | TextSpaceAfterComponent;\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\nexport function isReportComponent(\n component: ComponentDefinition\n): component is ReportComponent {\n return component.name === 'docx';\n}\n\nexport function isSectionComponent(\n component: ComponentDefinition\n): component is SectionComponent {\n return component.name === 'section';\n}\n\nexport function isColumnsComponent(\n component: ComponentDefinition\n): component is ColumnsComponent {\n return component.name === 'columns';\n}\n\nexport function isHeadingComponent(\n component: ComponentDefinition\n): component is HeadingComponent {\n return component.name === 'heading';\n}\n\nexport function isParagraphComponent(\n component: ComponentDefinition\n): component is ParagraphComponent {\n return component.name === 'paragraph';\n}\n\nexport function isImageComponent(\n component: ComponentDefinition\n): component is ImageComponent {\n return component.name === 'image';\n}\n\nexport function isTextBoxComponent(\n component: ComponentDefinition\n): component is TextBoxComponent {\n return component.name === 'text-box';\n}\n\nexport function isStatisticComponent(\n component: ComponentDefinition\n): component is StatisticComponent {\n return component.name === 'statistic';\n}\n\nexport function isTableComponent(\n component: ComponentDefinition\n): component is TableComponent {\n return component.name === 'table';\n}\n\nexport function isListComponent(\n component: ComponentDefinition\n): component is ListComponent {\n return component.name === 'list';\n}\n\nexport function isTocComponent(\n component: ComponentDefinition\n): component is TocComponent {\n return component.name === 'toc';\n}\n\nexport function isHighchartsComponent(\n component: ComponentDefinition\n): component is HighchartsComponent {\n return component.name === 'highcharts';\n}\n\nexport function isTextSpaceAfterComponent(\n component: ComponentDefinition\n): component is TextSpaceAfterComponent {\n return component.name === 'text-space-after';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA;AAAA,EACE,uBAAAA;AAAA,EACA,uBAAAC;AAAA,EACA,yBAAAC;AAAA,EAC+B;AAAA,EAC/B,sBAAAC;AAAA,OACK;AAIP;AAAA,EACE,uBAAAC;AAAA,EACA,wBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;;;AC3DP,SAAS,aAAyB;AAClC,SAAS,sBAAsB;AAW/B,eAAe,IAAI,OAAO,CAAC,UAAkB;AAE3C,MAAI;AACF,QAAI,IAAI,KAAK;AACb,WAAO;AAAA,EACT,QAAQ;AAEN,QACE,MAAM,SAAS,OAAO,KACtB,MAAM,SAAS,GAAG,KAClB,MAAM,SAAS,IAAI,GACnB;AACA,aAAO;AAAA,IACT;AAEA,WAAO,iBAAiB,KAAK,KAAK;AAAA,EACpC;AACF,CAAC;AAED,eAAe,IAAI,aAAa,CAAC,UAAkB;AAEjD,QAAM,gBAAgB;AACtB,SAAO,cAAc,KAAK,KAAK,KAAK,CAAC,MAAM,KAAK,MAAM,KAAK,CAAC;AAC9D,CAAC;AAaM,IAAM,qBAAN,MAAyB;AAAA,EACtB,SAAS;AAAA,EAEjB,cAAc;AAAA,EAEd;AAAA;AAAA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,WAC8B;AAC9B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,mBACd,WAC+B;AAC/B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,mBACd,WAC+B;AAC/B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,mBACd,WAC+B;AAC/B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,qBACd,WACiC;AACjC,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,iBACd,WAC6B;AAC7B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,mBACd,WAC+B;AAC/B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,qBACd,WACiC;AACjC,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,iBACd,WAC6B;AAC7B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,gBACd,WAC4B;AAC5B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,eACd,WAC2B;AAC3B,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,sBACd,WACkC;AAClC,SAAO,UAAU,SAAS;AAC5B;AAEO,SAAS,0BACd,WACsC;AACtC,SAAO,UAAU,SAAS;AAC5B;;;AN3VO,IAAM,sBAAsB;","names":["fixSchemaReferences","convertToJsonSchema","createComponentSchema","exportSchemaToFile","transformValueError","transformValueErrors","Value","validateComponent","Value","errors","formattedErrors","validateComponentDefinition","validateComponents"]}
@@ -3,9 +3,10 @@ import {
3
3
  GenerateDocumentResponseSchema,
4
4
  ValidateDocumentRequestSchema,
5
5
  ValidateDocumentResponseSchema
6
- } from "../chunk-ABVYMFDA.js";
7
- import "../chunk-YQECZGRR.js";
8
- import "../chunk-PN6JT3KF.js";
6
+ } from "../chunk-VQXTI6WF.js";
7
+ import "../chunk-7PK36JXG.js";
8
+ import "../chunk-S5KMAUDZ.js";
9
+ import "../chunk-F5IGGVWN.js";
9
10
  import "../chunk-JOXJOD2C.js";
10
11
  export {
11
12
  GenerateDocumentRequestSchema,