@graphql-inspector/action
Version:
GraphQL Inspector functionality for GitHub Actions
31 lines (30 loc) • 1.41 kB
TypeScript
import type { Change, TypeOfChangeType } from '@graphql-inspector/core';
/**
* One case that stands out is if the change is to add a repeatable directive, but the
* comparison first adds a directive, and then adds repeatable.
*
* To solve this, eat distinct change to a schema must be tracked separately. This is already
* happening, but DIRECTIVE_ADDED does include metadata for repeatability... This should
* likely be deprecated from that change type to keep these changes discrete. Same goes for
* directive locations.
*
* WARNING -- This list should be append only and the arrays should never change or else the
* hash algorithm will produce different results.
*/
export declare const requiredMatchMetaMap: {
[ChangeType in TypeOfChangeType]: Array<keyof Change<ChangeType>['meta']>;
};
/**
* @throws {Error} if there is no matching change type.
*/
export declare function isChangeEqual<T extends TypeOfChangeType, Y extends TypeOfChangeType>(a: Change<T>, b: Change<Y>): boolean;
/**
* Computes a hash from the type, path, and metadata so that changes
* can be quickly looked up (i.e. in a database). Hashes are not
* guaranteed to be unique so use `isChangeEqual` on match.
*/
export declare function generateChangeHash<ChangeType extends TypeOfChangeType>(change: {
type: ChangeType;
meta: Change<ChangeType>['meta'];
path?: string | null | undefined;
}): string;