grafast
Version:
Cutting edge GraphQL planning and execution engine
51 lines • 2.93 kB
TypeScript
import type { GraphQLInputType, GraphQLSchema } from "graphql";
import type { AnyInputStep, UnbatchedExecutionExtra } from "../interfaces.js";
import type { Step } from "../step.js";
import { UnbatchedStep } from "../step.js";
import { ConstantStep } from "./constant.js";
export declare class ApplyInputStep<TParent extends object = any, TTarget extends object = TParent> extends UnbatchedStep<(arg: TParent) => void> {
private inputType;
private getTargetFromParent;
static $$export: {
moduleName: string;
exportName: string;
};
isSyncAndSafe: boolean;
allowMultipleOptimizations: boolean;
valueDepId: 0;
scopeDepId: 1 | null;
constructor(inputType: GraphQLInputType, $value: AnyInputStep, getTargetFromParent: ((parent: TParent, inputValue: any, info: {
scope: unknown;
}) => TTarget | undefined | (() => TTarget)) | undefined, $scope?: Step | null);
deduplicate(peers: readonly ApplyInputStep[]): ApplyInputStep<any, any>[];
optimize(): this | ConstantStep<(parent: TParent) => void>;
unbatchedExecute(extra: UnbatchedExecutionExtra, value: any, scope: unknown): (parentThing: TParent) => void;
}
export declare function inputArgsApply<TArg extends object, TTarget extends object = TArg>(schema: GraphQLSchema, inputType: GraphQLInputType, parent: TArg, inputValue: unknown, getTargetFromParent: ((parent: TArg, inputValue: any, info: {
scope: unknown;
}) => TTarget | undefined | (() => TTarget)) | undefined, scope: unknown): void;
export declare function applyInput<TParent extends object = any, TTarget extends object = TParent>(inputType: GraphQLInputType, $value: AnyInputStep, getTargetFromParent?: (parent: TParent, inputValue: any, info: {
scope: unknown;
}) => TTarget | undefined): ConstantStep<(parent: TParent) => void> | ApplyInputStep<TParent, TTarget>;
/**
* Modifiers modify their parent (which may be another modifier or anything
* else). First they gather all the requirements from their children (if any)
* being applied to them, then they apply themselves to their parent. This
* application is done through the `apply()` method.
*/
export declare abstract class Modifier<TParent> {
protected readonly parent: TParent;
static $$export: any;
constructor(parent: TParent);
/**
* In this method, you should apply the changes to your `this.parent` plan
*/
abstract apply(): void;
}
export declare function isModifier<TParent>(plan: any): plan is Modifier<TParent>;
export declare function assertModifier<TParent>(plan: any, pathDescription: string): asserts plan is Modifier<TParent>;
export type ApplyableStep<TArg extends object = any, TData = any> = Step<TData> & {
apply($apply: Step<(arg: TArg) => void>): void;
};
export declare function isApplyableStep<TArg extends object = any, TData = any>(s: Step<TData>): s is ApplyableStep<TArg, TData>;
//# sourceMappingURL=applyInput.d.ts.map