{"version":3,"file":"validation.cjs","sources":["../../../../../src/lib/validation.ts"],"sourcesContent":["/**\r\n * Schema Validation\r\n * \r\n * Functions for validating JSON syntax and UI Schema structure.\r\n * Provides detailed error information including position and path.\r\n */\r\n\r\nimport type { UISchema, ValidationResult, ValidationError } from '../types';\r\n\r\n/**\r\n * JSON validation result with detailed error information\r\n */\r\nexport interface JSONValidationResult {\r\n  /** Whether the JSON is valid */\r\n  valid: boolean;\r\n  /** Parsed value if valid */\r\n  value?: unknown;\r\n  /** Error details if invalid */\r\n  error?: JSONValidationError;\r\n}\r\n\r\n/**\r\n * Detailed JSON validation error\r\n */\r\nexport interface JSONValidationError {\r\n  /** Error message */\r\n  message: string;\r\n  /** Character position in the input string (0-based) */\r\n  position?: number;\r\n  /** Line number (1-based) */\r\n  line?: number;\r\n  /** Column number (1-based) */\r\n  column?: number;\r\n}\r\n\r\n/**\r\n * Calculate line and column from position in a string\r\n */\r\nfunction getLineAndColumn(input: string, position: number): { line: number; column: number } {\r\n  const lines = input.substring(0, position).split('\\n');\r\n  const line = lines.length;\r\n  const column = lines[lines.length - 1].length + 1;\r\n  return { line, column };\r\n}\r\n\r\n/**\r\n * Extract position from JSON parse error message\r\n */\r\nfunction extractPositionFromError(errorMessage: string): number | undefined {\r\n  // Different JS engines format the error differently\r\n  // V8: \"... at position 5\"\r\n  // SpiderMonkey: \"... at line 1 column 6\"\r\n  const positionMatch = errorMessage.match(/position\\s+(\\d+)/i);\r\n  if (positionMatch) {\r\n    return parseInt(positionMatch[1], 10);\r\n  }\r\n  return undefined;\r\n}\r\n\r\n/**\r\n * Validate JSON syntax\r\n * \r\n * @param input - The JSON string to validate\r\n * @returns JSONValidationResult with parsed value or detailed error\r\n */\r\nexport function validateJSON(input: string): JSONValidationResult {\r\n  // Handle empty or whitespace-only input\r\n  if (!input || input.trim() === '') {\r\n    return {\r\n      valid: false,\r\n      error: {\r\n        message: 'Empty input: JSON string is empty or contains only whitespace',\r\n        position: 0,\r\n        line: 1,\r\n        column: 1,\r\n      },\r\n    };\r\n  }\r\n\r\n  try {\r\n    const value = JSON.parse(input);\r\n    return {\r\n      valid: true,\r\n      value,\r\n    };\r\n  } catch (e) {\r\n    const syntaxError = e as SyntaxError;\r\n    const position = extractPositionFromError(syntaxError.message);\r\n    \r\n    let line: number | undefined;\r\n    let column: number | undefined;\r\n    \r\n    if (position !== undefined) {\r\n      const lineCol = getLineAndColumn(input, position);\r\n      line = lineCol.line;\r\n      column = lineCol.column;\r\n    }\r\n\r\n    return {\r\n      valid: false,\r\n      error: {\r\n        message: syntaxError.message,\r\n        position,\r\n        line,\r\n        column,\r\n      },\r\n    };\r\n  }\r\n}\r\n\r\n\r\n/**\r\n * UI Schema validation result\r\n */\r\nexport interface UISchemaValidationResult extends ValidationResult {\r\n  /** The validated schema if valid */\r\n  schema?: UISchema;\r\n}\r\n\r\n/**\r\n * Validate UI Schema structure\r\n * \r\n * Validates that a parsed object conforms to the UISchema structure:\r\n * - Required fields (version, root)\r\n * - Component structure (id, type required for each component)\r\n * - Component reference integrity (all children are valid components)\r\n * \r\n * @param input - The object to validate (typically from JSON.parse)\r\n * @returns UISchemaValidationResult with validation errors or validated schema\r\n */\r\nexport function validateUISchema(input: unknown): UISchemaValidationResult {\r\n  const errors: ValidationError[] = [];\r\n\r\n  // Check if input is an object\r\n  if (typeof input !== 'object' || input === null) {\r\n    errors.push({\r\n      path: '',\r\n      message: 'Schema must be an object',\r\n      code: 'INVALID_TYPE',\r\n    });\r\n    return { valid: false, errors };\r\n  }\r\n\r\n  const obj = input as Record<string, unknown>;\r\n\r\n  // Validate version field\r\n  if (!('version' in obj)) {\r\n    errors.push({\r\n      path: 'version',\r\n      message: 'Missing required field: version',\r\n      code: 'MISSING_FIELD',\r\n    });\r\n  } else if (typeof obj.version !== 'string') {\r\n    errors.push({\r\n      path: 'version',\r\n      message: 'Field \"version\" must be a string',\r\n      code: 'INVALID_TYPE',\r\n    });\r\n  } else if (obj.version.trim() === '') {\r\n    errors.push({\r\n      path: 'version',\r\n      message: 'Field \"version\" cannot be empty',\r\n      code: 'INVALID_VALUE',\r\n    });\r\n  }\r\n\r\n  // Validate root field\r\n  if (!('root' in obj)) {\r\n    errors.push({\r\n      path: 'root',\r\n      message: 'Missing required field: root',\r\n      code: 'MISSING_FIELD',\r\n    });\r\n  } else {\r\n    const componentErrors = validateComponentRecursive(obj.root, 'root', new Set<string>());\r\n    errors.push(...componentErrors);\r\n  }\r\n\r\n  // Validate data field if present\r\n  if ('data' in obj && obj.data !== undefined && obj.data !== null) {\r\n    if (typeof obj.data !== 'object') {\r\n      errors.push({\r\n        path: 'data',\r\n        message: 'Field \"data\" must be an object',\r\n        code: 'INVALID_TYPE',\r\n      });\r\n    }\r\n  }\r\n\r\n  // Validate meta field if present\r\n  if ('meta' in obj && obj.meta !== undefined && obj.meta !== null) {\r\n    if (typeof obj.meta !== 'object') {\r\n      errors.push({\r\n        path: 'meta',\r\n        message: 'Field \"meta\" must be an object',\r\n        code: 'INVALID_TYPE',\r\n      });\r\n    }\r\n  }\r\n\r\n  if (errors.length === 0) {\r\n    return {\r\n      valid: true,\r\n      errors: [],\r\n      schema: input as UISchema,\r\n    };\r\n  }\r\n\r\n  return { valid: false, errors };\r\n}\r\n\r\n/**\r\n * Validate a UIComponent structure recursively\r\n * Also checks for duplicate component IDs\r\n */\r\nfunction validateComponentRecursive(\r\n  obj: unknown,\r\n  path: string,\r\n  seenIds: Set<string>\r\n): ValidationError[] {\r\n  const errors: ValidationError[] = [];\r\n\r\n  // Check if component is an object\r\n  if (typeof obj !== 'object' || obj === null) {\r\n    errors.push({\r\n      path,\r\n      message: `Component at \"${path}\" must be an object`,\r\n      code: 'INVALID_TYPE',\r\n    });\r\n    return errors;\r\n  }\r\n\r\n  const component = obj as Record<string, unknown>;\r\n\r\n  // Validate id field\r\n  if (!('id' in component)) {\r\n    errors.push({\r\n      path: `${path}.id`,\r\n      message: `Missing required field: id at \"${path}\"`,\r\n      code: 'MISSING_FIELD',\r\n    });\r\n  } else if (typeof component.id !== 'string') {\r\n    errors.push({\r\n      path: `${path}.id`,\r\n      message: `Field \"id\" must be a string at \"${path}\"`,\r\n      code: 'INVALID_TYPE',\r\n    });\r\n  } else if (component.id.trim() === '') {\r\n    errors.push({\r\n      path: `${path}.id`,\r\n      message: `Field \"id\" cannot be empty at \"${path}\"`,\r\n      code: 'INVALID_VALUE',\r\n    });\r\n  } else {\r\n    // Check for duplicate IDs\r\n    if (seenIds.has(component.id)) {\r\n      errors.push({\r\n        path: `${path}.id`,\r\n        message: `Duplicate component id \"${component.id}\" at \"${path}\"`,\r\n        code: 'DUPLICATE_ID',\r\n      });\r\n    } else {\r\n      seenIds.add(component.id);\r\n    }\r\n  }\r\n\r\n  // Validate type field\r\n  if (!('type' in component)) {\r\n    errors.push({\r\n      path: `${path}.type`,\r\n      message: `Missing required field: type at \"${path}\"`,\r\n      code: 'MISSING_FIELD',\r\n    });\r\n  } else if (typeof component.type !== 'string') {\r\n    errors.push({\r\n      path: `${path}.type`,\r\n      message: `Field \"type\" must be a string at \"${path}\"`,\r\n      code: 'INVALID_TYPE',\r\n    });\r\n  } else if (component.type.trim() === '') {\r\n    errors.push({\r\n      path: `${path}.type`,\r\n      message: `Field \"type\" cannot be empty at \"${path}\"`,\r\n      code: 'INVALID_VALUE',\r\n    });\r\n  }\r\n\r\n  // Validate props field if present\r\n  if ('props' in component && component.props !== undefined && component.props !== null) {\r\n    if (typeof component.props !== 'object' || Array.isArray(component.props)) {\r\n      errors.push({\r\n        path: `${path}.props`,\r\n        message: `Field \"props\" must be an object at \"${path}\"`,\r\n        code: 'INVALID_TYPE',\r\n      });\r\n    }\r\n  }\r\n\r\n  // Validate style field if present\r\n  if ('style' in component && component.style !== undefined && component.style !== null) {\r\n    if (typeof component.style !== 'object' || Array.isArray(component.style)) {\r\n      errors.push({\r\n        path: `${path}.style`,\r\n        message: `Field \"style\" must be an object at \"${path}\"`,\r\n        code: 'INVALID_TYPE',\r\n      });\r\n    }\r\n  }\r\n\r\n  // Validate events field if present\r\n  if ('events' in component && component.events !== undefined && component.events !== null) {\r\n    if (!Array.isArray(component.events)) {\r\n      errors.push({\r\n        path: `${path}.events`,\r\n        message: `Field \"events\" must be an array at \"${path}\"`,\r\n        code: 'INVALID_TYPE',\r\n      });\r\n    } else {\r\n      component.events.forEach((event, index) => {\r\n        const eventErrors = validateEventBinding(event, `${path}.events[${index}]`);\r\n        errors.push(...eventErrors);\r\n      });\r\n    }\r\n  }\r\n\r\n  // Validate loop field if present\r\n  if ('loop' in component && component.loop !== undefined && component.loop !== null) {\r\n    const loopErrors = validateLoopConfig(component.loop, `${path}.loop`);\r\n    errors.push(...loopErrors);\r\n  }\r\n\r\n  // Recursively validate children\r\n  if ('children' in component && component.children !== undefined && component.children !== null) {\r\n    if (!Array.isArray(component.children)) {\r\n      errors.push({\r\n        path: `${path}.children`,\r\n        message: `Field \"children\" must be an array at \"${path}\"`,\r\n        code: 'INVALID_TYPE',\r\n      });\r\n    } else {\r\n      component.children.forEach((child, index) => {\r\n        const childErrors = validateComponentRecursive(\r\n          child,\r\n          `${path}.children[${index}]`,\r\n          seenIds\r\n        );\r\n        errors.push(...childErrors);\r\n      });\r\n    }\r\n  }\r\n\r\n  return errors;\r\n}\r\n\r\n/**\r\n * Validate an EventBinding structure\r\n */\r\nfunction validateEventBinding(obj: unknown, path: string): ValidationError[] {\r\n  const errors: ValidationError[] = [];\r\n\r\n  if (typeof obj !== 'object' || obj === null) {\r\n    errors.push({\r\n      path,\r\n      message: `Event binding at \"${path}\" must be an object`,\r\n      code: 'INVALID_TYPE',\r\n    });\r\n    return errors;\r\n  }\r\n\r\n  const event = obj as Record<string, unknown>;\r\n\r\n  // Validate event field\r\n  if (!('event' in event)) {\r\n    errors.push({\r\n      path: `${path}.event`,\r\n      message: `Missing required field: event at \"${path}\"`,\r\n      code: 'MISSING_FIELD',\r\n    });\r\n  } else if (typeof event.event !== 'string') {\r\n    errors.push({\r\n      path: `${path}.event`,\r\n      message: `Field \"event\" must be a string at \"${path}\"`,\r\n      code: 'INVALID_TYPE',\r\n    });\r\n  }\r\n\r\n  // Validate action field\r\n  if (!('action' in event)) {\r\n    errors.push({\r\n      path: `${path}.action`,\r\n      message: `Missing required field: action at \"${path}\"`,\r\n      code: 'MISSING_FIELD',\r\n    });\r\n  } else if (typeof event.action !== 'object' || event.action === null) {\r\n    errors.push({\r\n      path: `${path}.action`,\r\n      message: `Field \"action\" must be an object at \"${path}\"`,\r\n      code: 'INVALID_TYPE',\r\n    });\r\n  } else {\r\n    const action = event.action as Record<string, unknown>;\r\n    if (!('type' in action)) {\r\n      errors.push({\r\n        path: `${path}.action.type`,\r\n        message: `Missing required field: type in action at \"${path}\"`,\r\n        code: 'MISSING_FIELD',\r\n      });\r\n    } else if (typeof action.type !== 'string') {\r\n      errors.push({\r\n        path: `${path}.action.type`,\r\n        message: `Field \"type\" must be a string in action at \"${path}\"`,\r\n        code: 'INVALID_TYPE',\r\n      });\r\n    }\r\n  }\r\n\r\n  return errors;\r\n}\r\n\r\n/**\r\n * Validate a loop configuration\r\n */\r\nfunction validateLoopConfig(obj: unknown, path: string): ValidationError[] {\r\n  const errors: ValidationError[] = [];\r\n\r\n  if (typeof obj !== 'object' || obj === null) {\r\n    errors.push({\r\n      path,\r\n      message: `Loop config at \"${path}\" must be an object`,\r\n      code: 'INVALID_TYPE',\r\n    });\r\n    return errors;\r\n  }\r\n\r\n  const loop = obj as Record<string, unknown>;\r\n\r\n  // Validate source field (required)\r\n  if (!('source' in loop)) {\r\n    errors.push({\r\n      path: `${path}.source`,\r\n      message: `Missing required field: source at \"${path}\"`,\r\n      code: 'MISSING_FIELD',\r\n    });\r\n  } else if (typeof loop.source !== 'string') {\r\n    errors.push({\r\n      path: `${path}.source`,\r\n      message: `Field \"source\" must be a string at \"${path}\"`,\r\n      code: 'INVALID_TYPE',\r\n    });\r\n  }\r\n\r\n  // Validate itemName if present\r\n  if ('itemName' in loop && loop.itemName !== undefined) {\r\n    if (typeof loop.itemName !== 'string') {\r\n      errors.push({\r\n        path: `${path}.itemName`,\r\n        message: `Field \"itemName\" must be a string at \"${path}\"`,\r\n        code: 'INVALID_TYPE',\r\n      });\r\n    }\r\n  }\r\n\r\n  // Validate indexName if present\r\n  if ('indexName' in loop && loop.indexName !== undefined) {\r\n    if (typeof loop.indexName !== 'string') {\r\n      errors.push({\r\n        path: `${path}.indexName`,\r\n        message: `Field \"indexName\" must be a string at \"${path}\"`,\r\n        code: 'INVALID_TYPE',\r\n      });\r\n    }\r\n  }\r\n\r\n  return errors;\r\n}\r\n"],"names":["getLineAndColumn","input","position","lines","line","column","extractPositionFromError","errorMessage","positionMatch","validateJSON","syntaxError","lineCol","validateUISchema","errors","obj","componentErrors","validateComponentRecursive","path","seenIds","component","event","index","eventErrors","validateEventBinding","loopErrors","validateLoopConfig","child","childErrors","action","loop"],"mappings":"gFAsCA,SAASA,EAAiBC,EAAeC,EAAoD,CAC3F,MAAMC,EAAQF,EAAM,UAAU,EAAGC,CAAQ,EAAE,MAAM;AAAA,CAAI,EAC/CE,EAAOD,EAAM,OACbE,EAASF,EAAMA,EAAM,OAAS,CAAC,EAAE,OAAS,EAChD,MAAO,CAAE,KAAAC,EAAM,OAAAC,CAAA,CACjB,CAKA,SAASC,EAAyBC,EAA0C,CAI1E,MAAMC,EAAgBD,EAAa,MAAM,mBAAmB,EAC5D,GAAIC,EACF,OAAO,SAASA,EAAc,CAAC,EAAG,EAAE,CAGxC,CAQO,SAASC,EAAaR,EAAqC,CAEhE,GAAI,CAACA,GAASA,EAAM,KAAA,IAAW,GAC7B,MAAO,CACL,MAAO,GACP,MAAO,CACL,QAAS,gEACT,SAAU,EACV,KAAM,EACN,OAAQ,CAAA,CACV,EAIJ,GAAI,CAEF,MAAO,CACL,MAAO,GACP,MAHY,KAAK,MAAMA,CAAK,CAG5B,CAEJ,OAAS,EAAG,CACV,MAAMS,EAAc,EACdR,EAAWI,EAAyBI,EAAY,OAAO,EAE7D,IAAIN,EACAC,EAEJ,GA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