Behaviour for hooking into the response-type generation pipeline.
Generation runs as four named steps — normalize, resolve, lower,
create. Plugins observe/transform the output of the first three via
after_normalize, after_resolve, and after_lower (plus
before_normalize for the raw entry). Adjacent before_X equals
after_prev, so only the after_* family and before_normalize are
exposed. The terminal create step compiles modules and is not hookable.
All callbacks are optional. use TypedGql.Generation.Plugin provides
identity defaults and defoverridable, so a plugin only implements the
hooks it cares about (the built-in @include/@skip plugin implements
only after_resolve).
TypedGql always runs its built-in plugins before user plugins, in order, at each juncture.
Summary
Callbacks
Runs on the {module, quoted_ast} pairs produced by lowering.
Runs on the canonical selections produced by normalization (fragment spreads expanded, inline fragments flattened, ancestor directives propagated onto each field).
Runs on the generated-schema tree produced by resolution.
Runs on the raw selections before normalization.
Types
Callbacks
@callback after_lower([{module(), Macro.t()}], TypedGql.Generation.Context.t()) :: [ {module(), Macro.t()} ]
Runs on the {module, quoted_ast} pairs produced by lowering.
@callback after_normalize([selection()], TypedGql.Generation.Context.t()) :: [selection()]
Runs on the canonical selections produced by normalization (fragment spreads expanded, inline fragments flattened, ancestor directives propagated onto each field).
@callback after_resolve(TypedGql.Generation.Schema.t(), TypedGql.Generation.Context.t()) :: TypedGql.Generation.Schema.t()
Runs on the generated-schema tree produced by resolution.
This is where directive plugins like @include/@skip operate, since
it is the last juncture before field types are lowered.
@callback before_normalize([selection()], TypedGql.Generation.Context.t()) :: [ selection() ]
Runs on the raw selections before normalization.