{"version":3,"file":"validator-types.cjs","sourceRoot":"","sources":["../../src/manifest/validator-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SnapManifest } from './validation';\nimport type { Promisable } from '../promise';\nimport type { SnapFiles, UnvalidatedSnapFiles } from '../types';\n\n// Eslint uses patch based fixing, but it's too complex for our needs.\n// https://eslint.org/docs/latest/extend/custom-rules#applying-fixes\nexport type ValidatorFix = (files: {\n  manifest: SnapManifest;\n}) => Promisable<{ manifest: SnapManifest }>;\n\nexport type ValidatorSeverity = 'error' | 'warning';\n\nexport type ValidatorContext = {\n  report: (message: string, fix?: ValidatorFix) => void;\n};\n\nexport type ValidatorReport = {\n  severity: ValidatorSeverity;\n  message: string;\n  fix?: ValidatorFix;\n};\n\nexport type ValidatorMeta = {\n  severity: ValidatorSeverity;\n\n  /**\n   * 1. Run the validator on unverified files to ensure that the files are structurally sound.\n   *\n   * @param files - Files to be verified\n   * @param context - Validator context to report errors\n   */\n  structureCheck?: (\n    files: UnvalidatedSnapFiles,\n    context: ValidatorContext,\n  ) => void | Promise<void>;\n\n  /**\n   * 2. Run the validator after the files were checked to be structurally sound.\n   *\n   * @param files - Files to be verified\n   * @param context - Validator context to report errors\n   */\n  semanticCheck?: (\n    files: SnapFiles,\n    context: ValidatorContext,\n  ) => void | Promise<void>;\n};\n"]}