@graphql-inspector/action
Version:
GraphQL Inspector functionality for GitHub Actions
154 lines (153 loc) • 6.54 kB
text/typescript
import { Kind } from 'graphql';
import type { Change } from '@graphql-inspector/core';
import type { ChangesByType, ErrorHandler } from './types.cjs';
/**
* The strictest of the standard error handlers. This checks if the error is a "No-op",
* meaning if the change wouldn't impact the schema at all, and ignores the error
* only in this one case. Otherwise, the error is raised.
*/
export declare const strictErrorHandler: ErrorHandler;
/**
* A convenient, semi-strict error handler. This ignores "no-op" errors -- if
* the change wouldn't impact the patched schema at all. And it ignores
* value mismatches, which are when the change notices that the value captured in
* the change doesn't match the value in the patched schema.
*
* For example, if the change indicates the default value WAS "foo" before being
* changed, but the patch is applied to a schema where the default value is "bar".
* This is useful to avoid overwriting changes unknowingly that may have occurred
* from other sources.
*/
export declare const defaultErrorHandler: ErrorHandler;
/**
* The least strict error handler. This will only log errors and will never
* raise an error. This is potentially useful for getting a patched schema
* rendered, and then handling the conflict/error in a separate step. E.g.
* if creating a merge conflict resolution UI.
*/
export declare const looseErrorHandler: ErrorHandler;
/**
* When the change does not actually modify the resulting schema, then it is
* considered a "no-op". This error can safely be ignored.
*/
export declare class NoopError extends Error {
readonly noop = true;
constructor(message: string);
}
export declare class ValueMismatchError extends Error {
readonly mismatch = true;
constructor(kind: Kind, expected: string | undefined | null, actual: string | undefined | null);
}
/**
* If the requested change would not modify the schema because that change is effectively
* already applied.
*
* If the added coordinate exists but the kind does not match what's expected, then use
* ChangedCoordinateKindMismatchError instead.
*/
export declare class AddedCoordinateAlreadyExistsError extends NoopError {
readonly path: string;
readonly changeType: keyof ChangesByType;
constructor(path: string, changeType: keyof ChangesByType);
}
export declare class AddedAttributeCoordinateNotFoundError extends Error {
readonly path: string;
readonly changeType: keyof ChangesByType;
/**
* The value of what is being changed at the path. E.g. if the description is being changed, then this should
* be the description string.
*/
readonly changeValue: string | number | null;
constructor(path: string, changeType: keyof ChangesByType,
/**
* The value of what is being changed at the path. E.g. if the description is being changed, then this should
* be the description string.
*/
changeValue: string | number | null);
}
/**
* If trying to manipulate a node at a path, but that path no longer exists. E.g. change a description of
* a type, but that type was previously deleted.
*/
export declare class ChangedAncestorCoordinateNotFoundError extends Error {
readonly path: string;
readonly changeType: keyof ChangesByType;
/**
* The value of what is being changed at the path. E.g. if the description is being changed, then this should
* be the description string.
*/
readonly changeValue: string | number | boolean | null;
constructor(path: string, changeType: keyof ChangesByType,
/**
* The value of what is being changed at the path. E.g. if the description is being changed, then this should
* be the description string.
*/
changeValue: string | number | boolean | null);
}
/**
* If trying to remove a node but that node no longer exists. E.g. remove a directive from
* a type, but that type does not exist.
*/
export declare class DeletedAncestorCoordinateNotFoundError extends NoopError {
readonly path: string;
readonly changeType: keyof ChangesByType;
/**
* The value of what is being changed at the path. E.g. if the description is being changed, then this should
* be the description string.
*/
readonly expectedValue: string | number | boolean | null;
constructor(path: string, changeType: keyof ChangesByType,
/**
* The value of what is being changed at the path. E.g. if the description is being changed, then this should
* be the description string.
*/
expectedValue: string | number | boolean | null);
}
/**
* If adding an attribute to a node, but that attribute already exists.
* E.g. adding an interface but that interface is already applied to the type.
*/
export declare class AddedAttributeAlreadyExistsError extends NoopError {
readonly path: string;
readonly changeType: string;
/** The property's path on the node. E.g. defaultValue */
readonly attribute: string;
readonly expectedValue?: string | undefined;
constructor(path: string, changeType: string,
/** The property's path on the node. E.g. defaultValue */
attribute: string, expectedValue?: string | undefined);
}
/**
* If deleting an attribute from a node, but that attribute does not exist.
* E.g. deleting an interface but that interface is not applied to the type.
*/
export declare class DeletedAttributeNotFoundError extends NoopError {
readonly path: string;
readonly changeType: string;
/** The property's path on the node. E.g. defaultValue */
readonly attribute: string;
readonly expectedValue?: string | undefined;
constructor(path: string, changeType: string,
/** The property's path on the node. E.g. defaultValue */
attribute: string, expectedValue?: string | undefined);
}
export declare class ChangedCoordinateNotFoundError extends Error {
constructor(expectedKind: Kind, expectedNameOrValue: string | undefined);
}
export declare class DeletedCoordinateNotFound extends NoopError {
readonly path: string;
readonly changeType: string;
constructor(path: string, changeType: string);
}
export declare class ChangedCoordinateKindMismatchError extends Error {
readonly expectedKind: Kind;
readonly receivedKind: Kind;
constructor(expectedKind: Kind, receivedKind: Kind);
}
/**
* This should not happen unless there's an issue with the diff creation.
*/
export declare class ChangePathMissingError extends Error {
readonly change: Change<any>;
constructor(change: Change<any>);
}