import { AsyncAPIDocumentInterface, ChannelInterface } from '@asyncapi/parser'; import { MessageDiffOptions } from './message-diff-options'; /** * Diff results. Each file (asyncapi document or payload) is classified to one of 'skipped', 'same', 'changed' or 'breaking'. */ interface Results { skipped: number; same: number; changed: number; breaking: number; } /** * Finds AsyncAPI documents found in git, and compares them with the current file system. * The following changes are considered breaking: * - Removed / renamed asyncapi document * - Breaking changes in any asyncapi document * - Breaking changes in any message payload * Message payloads are referenced through asyncapi channel definitions. It is safe to rename payload files if * file references in the asyncapi document are updated accordingly. * * @param options (object): * schemaRoot Path to directory to scan. All files required to parse the schema must be inside this dir * & subdirectories. This includes JSON Schema references. * filePattern Regular expression that matches suitable input files. * excludePattern Regular expression that matches suitable input files. * branch Git branch to compare to. * verbose Verbose output includes full diff for all files, not only where breaking changes were found. */ export declare class MessageDiff { private readonly schemaRoot; private readonly filePattern; private readonly excludePattern; private readonly branch; private readonly verbose; readonly results: { skipped: number; same: number; changed: number; breaking: number; }; constructor(options: MessageDiffOptions); run(): Promise; /** * Recursively walks a directory comparing matching files to another directory. * @param dir1 - Root dir to scan for matching files. * @param dir2 - Root dir for comparision. */ walk(dir1: string, dir2: string): Promise; /** * Full comparison of asyncapi documents. Each channel payload is also compared. */ private asyncApiDiff; /** * Compare asyncapi documents using AsyncAPI Diff: https://github.com/asyncapi/diff * Note: non standard rules are defined in file: asyncapi-override.ts */ documentDiff(document1: AsyncAPIDocumentInterface, document2: AsyncAPIDocumentInterface): Promise; /** * Compare payload schemas using JsonSchema Diff: https://www.npmjs.com/package/json-schema-diff * NOTE: It might be possible to define rules for asyncapi-diff to compare properties in message schemas but * it would not have the ability to properly evaluate breaking changes as json-schema-diff does. * e.g. adding an existing property to the list of required properties is a breaking change. * * Only schema version http://json-schema.org/draft-07/schema# is supported. * If any other version is used (in local file or git) then the comparison result will be 'skipped'. */ payloadDiff(channel1: ChannelInterface | undefined, channel2: ChannelInterface | undefined): Promise; } export {};