Skip to content

Commit

Permalink
Merge pull request #1270 from absinthe-graphql/initial-phases-mfa
Browse files Browse the repository at this point in the history
Initial phases mfa
  • Loading branch information
benwilson512 authored Aug 16, 2023
2 parents 8a5c293 + 173d6d1 commit 4c1d692
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/absinthe/blueprint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ defmodule Absinthe.Blueprint do
source: nil | String.t() | Absinthe.Language.Source.t(),
execution: Blueprint.Execution.t(),
result: result_t,
initial_phases: [Absinthe.Phase.t()]
initial_phases: [Absinthe.Phase.t()] | {module(), atom, list()}
}

@type result_t :: %{
Expand Down
11 changes: 10 additions & 1 deletion lib/absinthe/subscription/pipeline_serializer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ defmodule Absinthe.Subscription.PipelineSerializer do

@type packed_pipeline :: {:packed, [packed_phase_config()], options_map()}

@spec pack(Pipeline.t()) :: packed_pipeline()
@spec pack(Pipeline.t() | {module(), atom, list()}) :: packed_pipeline()
def pack({module, function, args})
when is_atom(module) and is_atom(function) and is_list(args) do
{module, function, args}
end

def pack(pipeline) do
{packed_pipeline, reverse_map} =
pipeline
Expand All @@ -41,6 +46,10 @@ defmodule Absinthe.Subscription.PipelineSerializer do
end)
end

def unpack({module, function, args}) do
apply(module, function, args)
end

def unpack([_ | _] = pipeline) do
pipeline
end
Expand Down

0 comments on commit 4c1d692

Please sign in to comment.