UNPKG

@metamask/snaps-utils

Version:
35 lines 1.29 kB
import type { SnapManifest } from "./validation.cjs"; import type { Promisable } from "../promise.cjs"; import type { SnapFiles, UnvalidatedSnapFiles } from "../types.cjs"; export type ValidatorFix = (files: { manifest: SnapManifest; }) => Promisable<{ manifest: SnapManifest; }>; export type ValidatorSeverity = 'error' | 'warning'; export type ValidatorContext = { report: (message: string, fix?: ValidatorFix) => void; }; export type ValidatorReport = { severity: ValidatorSeverity; message: string; fix?: ValidatorFix; }; export type ValidatorMeta = { severity: ValidatorSeverity; /** * 1. Run the validator on unverified files to ensure that the files are structurally sound. * * @param files - Files to be verified * @param context - Validator context to report errors */ structureCheck?: (files: UnvalidatedSnapFiles, context: ValidatorContext) => void | Promise<void>; /** * 2. Run the validator after the files were checked to be structurally sound. * * @param files - Files to be verified * @param context - Validator context to report errors */ semanticCheck?: (files: SnapFiles, context: ValidatorContext) => void | Promise<void>; }; //# sourceMappingURL=validator-types.d.cts.map