{"version":3,"file":"index.cjs","names":["codeFrameColumns","styleText","styleText","styleText","pointer","styleText","parse","prettify"],"sources":["../src/utils.js","../src/json/utils.js","../src/json/get-meta-from-path.js","../src/json/get-decorated-data-path.js","../src/validation-errors/base.js","../src/validation-errors/required.js","../src/validation-errors/additional-prop.js","../src/validation-errors/enum.js","../src/validation-errors/default.js","../src/helpers.js","../src/index.js"],"sourcesContent":["// Basic\nconst eq = x => y => x === y;\nconst not = fn => x => !fn(x);\n\nconst getValues = o => Object.values(o);\n\nexport const notUndefined = x => x !== undefined;\n\n// Error\nconst isXError = x => error => error.keyword === x;\nexport const isRequiredError = isXError('required');\nexport const isAnyOfError = isXError('anyOf');\nexport const isEnumError = isXError('enum');\nexport const getErrors = node =>\n  node && node.errors\n    ? node.errors.map(e =>\n        e.keyword === 'errorMessage' ? { ...e.params.errors[0], message: e.message } : e\n      )\n    : [];\n\n// Node\nexport const getChildren = node => (node && getValues(node.children)) || [];\n\nexport const getSiblings = parent => node => getChildren(parent).filter(not(eq(node)));\n\nexport const concatAll = xs => ys => ys.reduce((zs, z) => zs.concat(z), xs);\n","// TODO: Better error handling\nexport const getPointers = dataPath => {\n  return dataPath\n    .split('/')\n    .slice(1)\n    .map(pointer => pointer.split('~1').join('/').split('~0').join('~'));\n};\n","import { getPointers } from './utils';\n\nexport default function getMetaFromPath(jsonAst, dataPath, includeIdentifierLocation) {\n  const pointers = getPointers(dataPath);\n  const lastPointerIndex = pointers.length - 1;\n  return pointers.reduce((obj, pointer, idx) => {\n    switch (obj.type) {\n      case 'Object': {\n        // JSON.parse keeps the last of duplicate keys, so that is the one ajv validated.\n        const member = obj.members.findLast(child => child.name.value === pointer);\n        if (!member) {\n          throw new Error(`Couldn't find property ${pointer} of ${dataPath}`);\n        }\n\n        const { name, value } = member;\n        return includeIdentifierLocation && idx === lastPointerIndex ? name : value;\n      }\n      case 'Array': {\n        const element = obj.elements[pointer];\n        return element && element.value;\n      }\n      default:\n        console.log(obj);\n    }\n  }, jsonAst.body);\n}\n","import { getPointers } from './utils';\n\nexport default function getDecoratedDataPath(jsonAst, dataPath) {\n  let decoratedPath = '';\n  getPointers(dataPath).reduce((obj, pointer) => {\n    switch (obj.type) {\n      case 'Object': {\n        decoratedPath += `/${pointer}`;\n        // JSON.parse keeps the last of duplicate keys, so that is the one ajv validated.\n        const member = obj.members.findLast(child => child.name.value === pointer);\n        if (!member) {\n          throw new Error(`Couldn't find property ${pointer} of ${dataPath}`);\n        }\n        return member.value;\n      }\n      case 'Array': {\n        const element = obj.elements[pointer];\n        const value = element && element.value;\n        decoratedPath += `/${pointer}${getTypeName(value)}`;\n        return value;\n      }\n      default:\n        console.log(obj);\n    }\n  }, jsonAst.body);\n  return decoratedPath;\n}\n\nfunction getTypeName(obj) {\n  if (!obj || !obj.elements) {\n    return '';\n  }\n  const type = obj.elements.filter(child => child && child.name && child.name.value === 'type');\n\n  if (!type.length) {\n    return '';\n  }\n\n  return (type[0].value && `:${type[0].value.value}`) || '';\n}\n","import { codeFrameColumns } from '@babel/code-frame';\nimport { getMetaFromPath, getDecoratedDataPath } from '../json/index';\n\nexport default class BaseValidationError {\n  constructor(options = { isIdentifierLocation: false }, { data, schema, jsonAst, jsonRaw }) {\n    this.options = options;\n    this.data = data;\n    this.schema = schema;\n    this.jsonAst = jsonAst;\n    this.jsonRaw = jsonRaw;\n  }\n\n  getLocation(dataPath = this.instancePath) {\n    const { isIdentifierLocation, isSkipEndLocation } = this.options;\n    const { loc } = getMetaFromPath(this.jsonAst, dataPath, isIdentifierLocation);\n    return {\n      start: loc.start,\n      end: isSkipEndLocation ? undefined : loc.end,\n    };\n  }\n\n  getDecoratedPath(dataPath = this.instancePath) {\n    const decoratedPath = getDecoratedDataPath(this.jsonAst, dataPath);\n    return decoratedPath;\n  }\n\n  // The decorated path is empty at the root, where the message stands alone.\n  withDecoratedPath(message, separator = ' ') {\n    const decoratedPath = this.getDecoratedPath();\n    return decoratedPath ? `${decoratedPath}${separator}${message}` : message;\n  }\n\n  getCodeFrame(message, dataPath = this.instancePath) {\n    return codeFrameColumns(this.jsonRaw, this.getLocation(dataPath), {\n      highlightCode: true,\n      message,\n    });\n  }\n\n  /**\n   * @return {string}\n   */\n  get instancePath() {\n    return typeof this.options.instancePath !== 'undefined'\n      ? this.options.instancePath\n      : this.options.dataPath;\n  }\n\n  print() {\n    throw new Error(`Implement the 'print' method inside ${this.constructor.name}!`);\n  }\n\n  getError() {\n    throw new Error(`Implement the 'getError' method inside ${this.constructor.name}!`);\n  }\n}\n","import { styleText } from 'node:util';\nimport BaseValidationError from './base';\n\nexport default class RequiredValidationError extends BaseValidationError {\n  getLocation(dataPath = this.instancePath) {\n    const { start } = super.getLocation(dataPath);\n    return { start };\n  }\n\n  print() {\n    const { message, params } = this.options;\n    const output = [styleText('red', styleText('bold', 'REQUIRED') + ' ' + message) + '\\n'];\n\n    return output.concat(\n      this.getCodeFrame(\n        '☹️  ' + styleText('magentaBright', params.missingProperty) + ' is missing here!'\n      )\n    );\n  }\n\n  getError() {\n    const { message } = this.options;\n\n    return {\n      ...this.getLocation(),\n      error: this.withDecoratedPath(message),\n      path: this.instancePath,\n    };\n  }\n}\n","import { styleText } from 'node:util';\nimport BaseValidationError from './base';\n\nexport default class AdditionalPropValidationError extends BaseValidationError {\n  constructor(...args) {\n    super(...args);\n    this.options.isIdentifierLocation = true;\n  }\n\n  print() {\n    const { message, params } = this.options;\n    const output = [\n      styleText('red', styleText('bold', 'ADDITIONAL PROPERTY') + ' ' + message) + '\\n',\n    ];\n\n    return output.concat(\n      this.getCodeFrame(\n        '😲  ' +\n          styleText('magentaBright', params.additionalProperty) +\n          ' is not expected to be here!',\n        `${this.instancePath}/${params.additionalProperty}`\n      )\n    );\n  }\n\n  getError() {\n    const { params } = this.options;\n\n    return {\n      ...this.getLocation(`${this.instancePath}/${params.additionalProperty}`),\n      error: this.withDecoratedPath(\n        `Property ${params.additionalProperty} is not expected to be here`\n      ),\n      path: this.instancePath,\n    };\n  }\n}\n","import { styleText } from 'node:util';\nimport leven from 'leven';\nimport pointer from 'jsonpointer';\nimport BaseValidationError from './base';\n\nexport default class EnumValidationError extends BaseValidationError {\n  print() {\n    const {\n      message,\n      params: { allowedValues },\n    } = this.options;\n    const bestMatch = this.findBestMatch();\n\n    // Needed to handle nullable enums, as joining on null just prints \", \"\n    const [firstValue, ...rest] = allowedValues;\n    const allowedValuesMessage = rest.reduce((acc, value) => `${acc}, ${value}`, firstValue || '');\n\n    const output = [\n      styleText('red', styleText('bold', 'ENUM') + ' ' + message),\n      styleText('red', `(${allowedValuesMessage})\\n`),\n    ];\n\n    return output.concat(\n      this.getCodeFrame(\n        bestMatch !== null\n          ? '👈🏽  Did you mean ' + styleText('magentaBright', String(bestMatch)) + ' here?'\n          : '👈🏽  Unexpected value, should be equal to one of the allowed values'\n      )\n    );\n  }\n\n  getError() {\n    const { message, params } = this.options;\n    const bestMatch = this.findBestMatch();\n    const allowedValues = params.allowedValues.join(', ');\n\n    const output = {\n      ...this.getLocation(),\n      error: this.withDecoratedPath(`${message}: ${allowedValues}`),\n      path: this.instancePath,\n    };\n\n    if (bestMatch !== null) {\n      output.suggestion = `Did you mean ${bestMatch}?`;\n    }\n\n    return output;\n  }\n\n  findBestMatch() {\n    const {\n      params: { allowedValues },\n    } = this.options;\n\n    const currentValue =\n      this.instancePath === '' ? this.data : pointer.get(this.data, this.instancePath);\n\n    if (!currentValue) {\n      return null;\n    }\n\n    const bestMatch = allowedValues\n      .map(value => ({\n        value,\n        // leven compares strings, so other allowed values cannot be a close match.\n        weight: typeof value === 'string' ? leven(value, currentValue.toString()) : Infinity,\n      }))\n      .sort((x, y) => (x.weight > y.weight ? 1 : x.weight < y.weight ? -1 : 0))[0];\n\n    return allowedValues.length === 1 || bestMatch.weight < bestMatch.value.length\n      ? bestMatch.value\n      : null;\n  }\n}\n","import { styleText } from 'node:util';\nimport BaseValidationError from './base';\n\nexport default class DefaultValidationError extends BaseValidationError {\n  print() {\n    const { keyword, message } = this.options;\n    const output = [\n      styleText('red', styleText('bold', keyword.toUpperCase()) + ' ' + message) + '\\n',\n    ];\n\n    return output.concat(\n      this.getCodeFrame('👈🏽  ' + styleText('magentaBright', keyword) + ' ' + message)\n    );\n  }\n\n  getError() {\n    const { keyword, message } = this.options;\n\n    return {\n      ...this.getLocation(),\n      error: this.withDecoratedPath(`${keyword} ${message}`, ': '),\n      path: this.instancePath,\n    };\n  }\n}\n","import {\n  getChildren,\n  getErrors,\n  getSiblings,\n  isAnyOfError,\n  isEnumError,\n  isRequiredError,\n  concatAll,\n  notUndefined,\n} from './utils';\nimport {\n  AdditionalPropValidationError,\n  RequiredValidationError,\n  EnumValidationError,\n  DefaultValidationError,\n} from './validation-errors/index';\n\nconst JSON_POINTERS_REGEX = /\\/[\\w_-]+(\\/\\d+)?/g;\n\n// Make a tree of errors from ajv errors array\nexport function makeTree(ajvErrors = []) {\n  const root = { children: {} };\n  ajvErrors.forEach(ajvError => {\n    const instancePath =\n      typeof ajvError.instancePath !== 'undefined' ? ajvError.instancePath : ajvError.dataPath;\n\n    // `dataPath === ''` is root\n    const paths = instancePath === '' ? [''] : instancePath.match(JSON_POINTERS_REGEX);\n    if (paths) {\n      paths.reduce((obj, path, i) => {\n        obj.children[path] = obj.children[path] || { children: {}, errors: [] };\n        if (i === paths.length - 1) {\n          obj.children[path].errors.push(ajvError);\n        }\n        return obj.children[path];\n      }, root);\n    }\n  });\n  return root;\n}\n\nexport function filterRedundantErrors(root, parent, key) {\n  /**\n   * Partition out the errors by kind for ease of proceessing\n   */\n  const { anyOfErrors, enumErrors, requiredErrors } = getErrors(root).reduce(\n    (acc, error) => {\n      if (isRequiredError(error)) {\n        acc.requiredErrors.push(error);\n\n        return acc;\n      }\n\n      if (isAnyOfError(error)) {\n        acc.anyOfErrors.push(error);\n      }\n\n      if (isEnumError(error)) {\n        acc.enumErrors.push(error);\n      }\n\n      return acc;\n    },\n    { anyOfErrors: [], enumErrors: [], requiredErrors: [] }\n  );\n\n  /**\n   * If there is are `required` errors then we can just drop every non-required error.\n   * And, also `required` should have more priority than `anyOf`. @see #8\n   */\n\n  if (requiredErrors.length > 0) {\n    root.errors = requiredErrors;\n    root.children = {};\n\n    // No need for further processing, as we've emptied out children\n    return;\n  }\n\n  /**\n   * If there is an `anyOf` error that means we have more meaningful errors\n   * inside children. So we will just remove all errors from this level.\n   *\n   * If there are no children, then we don't delete the errors since we should\n   * have at least one error to report.\n   */\n  if (anyOfErrors.length > 0 && Object.keys(root.children).length > 0) {\n    delete root.errors;\n  }\n\n  /**\n   * If all errors are `enum` and siblings have any error then we can safely\n   * ignore the node. As we return early if there's required errors, we only\n   * need to check anyofErrors length\n   *\n   * **CAUTION**\n   * Need explicit `root.errors` check because `[].every(fn) === true`\n   * https://en.wikipedia.org/wiki/Vacuous_truth#Vacuous_truths_in_mathematics\n   */\n  if (enumErrors.length > 0 && anyOfErrors.length === 0) {\n    if (\n      getSiblings(parent)(root)\n        // Remove any reference which becomes `undefined` later\n        .filter(notUndefined)\n        .some(getErrors)\n    ) {\n      delete parent.children[key];\n    }\n  }\n\n  Object.entries(root.children).forEach(([key, child]) => filterRedundantErrors(child, root, key));\n}\n\nexport function createErrorInstances(root, options) {\n  const errors = getErrors(root);\n  if (errors.length && errors.every(isEnumError)) {\n    const uniqueValues = new Set(concatAll([])(errors.map(e => e.params.allowedValues)));\n    const allowedValues = [...uniqueValues];\n    const error = errors[0];\n    return [\n      new EnumValidationError(\n        {\n          ...error,\n          params: { allowedValues },\n        },\n        options\n      ),\n    ];\n  } else {\n    return concatAll(\n      errors.reduce((ret, error) => {\n        switch (error.keyword) {\n          case 'additionalProperties':\n            return ret.concat(new AdditionalPropValidationError(error, options));\n          case 'required':\n            return ret.concat(new RequiredValidationError(error, options));\n          default:\n            return ret.concat(new DefaultValidationError(error, options));\n        }\n      }, [])\n    )(getChildren(root).map(child => createErrorInstances(child, options)));\n  }\n}\n\nexport default (ajvErrors, options) => {\n  const tree = makeTree(ajvErrors || []);\n  filterRedundantErrors(tree);\n  return createErrorInstances(tree, options);\n};\n","import { parse } from '@humanwhocodes/momoa';\nimport prettify from './helpers';\n\nexport default (schema, data, errors, options = {}) => {\n  const { format = 'cli', indent = null, json = null } = options;\n\n  const jsonRaw = json || JSON.stringify(data, null, indent);\n  const jsonAst = parse(jsonRaw);\n\n  const customErrorToText = error => error.print().join('\\n');\n  const customErrorToStructure = error => error.getError();\n  const customErrors = prettify(errors, {\n    data,\n    schema,\n    jsonAst,\n    jsonRaw,\n  });\n\n  if (format === 'cli') {\n    return customErrors.map(customErrorToText).join('\\n\\n');\n  } else {\n    return customErrors.map(customErrorToStructure);\n  }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAM,MAAK,OAAK,MAAK,MAAM;AAC3B,MAAM,OAAM,QAAM,MAAK,CAAC,GAAG,CAAC;AAE5B,MAAM,aAAY,MAAK,OAAO,OAAO,CAAC;AAEtC,MAAa,gBAAe,MAAK,MAAM,KAAA;AAGvC,MAAM,YAAW,OAAK,UAAS,MAAM,YAAY;AACjD,MAAa,kBAAkB,SAAS,UAAU;AAClD,MAAa,eAAe,SAAS,OAAO;AAC5C,MAAa,cAAc,SAAS,MAAM;AAC1C,MAAa,aAAY,SACvB,QAAQ,KAAK,SACT,KAAK,OAAO,KAAI,MACd,EAAE,YAAY,iBAAiB;CAAE,GAAG,EAAE,OAAO,OAAO;CAAI,SAAS,EAAE;AAAQ,IAAI,CACjF,IACA,CAAC;AAGP,MAAa,eAAc,SAAS,QAAQ,UAAU,KAAK,QAAQ,KAAM,CAAC;AAE1E,MAAa,eAAc,YAAU,SAAQ,YAAY,MAAM,CAAC,CAAC,OAAO,IAAI,GAAG,IAAI,CAAC,CAAC;AAErF,MAAa,aAAY,QAAM,OAAM,GAAG,QAAQ,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;;;ACxB1E,MAAa,eAAc,aAAY;CACrC,OAAO,SACJ,MAAM,GAAG,CAAC,CACV,MAAM,CAAC,CA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