Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
erlang 27.0.1
elixir 1.18.4
elixir 1.20
pipx 1.8.0
2 changes: 0 additions & 2 deletions lib/domain/domain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ defmodule AshGraphql.Domain do
The entrypoint for adding GraphQL behavior to an Ash domain
"""

require Ash.Domain.Info

use Spark.Dsl.Extension,
sections: @sections,
transformers: [
Expand Down
2 changes: 1 addition & 1 deletion lib/graphql/errors.ex
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ defmodule AshGraphql.Errors do
{nil, []}

{arg_type, arg_constraints} when arg_type != nil ->
unwrap_type(arg_type, arg_constraints || [])
unwrap_type(arg_type, List.wrap(arg_constraints))

_ ->
{nil, []}
Expand Down
2 changes: 0 additions & 2 deletions lib/graphql/filter_handlers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ defmodule AshGraphql.Graphql.FilterHandlers do

alias AshGraphql.Graphql.Resolver

require Ash.Query

@boolean_keys [:and, :or, :not]

@doc """
Expand Down
6 changes: 3 additions & 3 deletions lib/graphql/phase/inject_metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ defmodule AshGraphql.Phase.InjectMetadata do
end
end

defp build_metadata(false, _info), do: {nil, nil}
defp build_metadata(nil, _info), do: {nil, nil}

defp build_metadata(true, _info) do
Logger.warning(
"AshGraphql response_metadata is set to `true` but requires a key. " <>
Expand Down Expand Up @@ -148,9 +151,6 @@ defmodule AshGraphql.Phase.InjectMetadata do
{key, nil}
end

defp build_metadata(false, _info), do: {nil, nil}
defp build_metadata(nil, _info), do: {nil, nil}

defp build_metadata(invalid_config, _info) do
Logger.warning(
"AshGraphql response_metadata received invalid configuration: #{inspect(invalid_config)}. " <>
Expand Down
1 change: 0 additions & 1 deletion lib/mix/tasks/ash_graphql.install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if Code.ensure_loaded?(Igniter) do
defmodule Mix.Tasks.AshGraphql.Install do
@moduledoc "Installs AshGraphql. Should be run with `mix igniter.install ash_graphql`"
@shortdoc @moduledoc
require Igniter.Code.Common
use Igniter.Mix.Task

@impl true
Expand Down
6 changes: 0 additions & 6 deletions lib/resource/resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3038,9 +3038,6 @@ defmodule AshGraphql.Resource do

defp on_lookup_fields(opts, relationship, schema) do
case ManagedRelationshipHelpers.on_lookup_update_action(opts, relationship) do
{:destination, nil} ->
:none

{:destination, action} ->
action = Ash.Resource.Info.action(relationship.destination, action)

Expand All @@ -3053,9 +3050,6 @@ defmodule AshGraphql.Resource do
field.identifier == relationship.destination_attribute
end)

{:join, nil, _} ->
:none

{:join, action, fields} ->
action = Ash.Resource.Info.action(relationship.through, action)

Expand Down
18 changes: 14 additions & 4 deletions lib/subscription/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,22 @@ defmodule AshGraphql.Subscription.Config do
"""
alias AshGraphql.Resource.Subscription

# sobelow_skip ["DOS.StringToAtom"]
def create_config(%Subscription{} = subscription, _domain, resource, relay_ids?) do
config_module = String.to_atom(Macro.camelize(Atom.to_string(subscription.name)) <> ".Config")
config_module =
Module.concat([
resource,
Macro.camelize(Atom.to_string(subscription.name)),
Config
])

unless Code.ensure_loaded?(config_module) and function_exported?(config_module, :config, 2) do
create_config_module(config_module, subscription, resource, relay_ids?)
end

&config_module.config/2
end

defp create_config_module(config_module, subscription, resource, relay_ids?) do
Module.create(
config_module,
quote generated: true,
Expand Down Expand Up @@ -82,7 +94,5 @@ defmodule AshGraphql.Subscription.Config do
end,
Macro.Env.location(__ENV__)
)

&config_module.config/2
end
end
1 change: 0 additions & 1 deletion lib/subscription/runner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ defmodule AshGraphql.Subscription.Runner do
Mostly a copy of https://github.com/absinthe-graphql/absinthe/blob/3d0823bd71c2ebb94357a5588c723e053de8c66a/lib/absinthe/subscription/local.ex#L40
but this lets us decide if we want to send the data to the client or not in certain error cases
"""
require Logger

def run_docset(pubsub, docs_and_topics, notification) do
for {topic, key_strategy, doc} <- docs_and_topics do
Expand Down
4 changes: 2 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"decimal": {:hex, :decimal, "3.1.1", "430d87b04011ce6cbd4fd205be758311a81f87d552d40904abd00f015935b1d0", [:mix], [], "hexpm", "c5f25f2ced74a0587d03e6023f595db8e924c9d3922c8c8ffd9edfc4498cf1f6"},
"deep_merge": {:hex, :deep_merge, "1.0.2", "476aa7ea61c54de96220051b998d893869069094da65b96101aebf79416f8a1e", [:mix], [], "hexpm", "737a53cdc9758fedbb608bdc213969e65729466c4ef3cd8e8726d0335dff116c"},
"dialyxir": {:hex, :dialyxir, "1.4.7", "dda948fcee52962e4b6c5b4b16b2d8fa7d50d8645bbae8b8685c3f9ecb7f5f4d", [:mix], [{:erlex, ">= 0.2.8", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b34527202e6eb8cee198efec110996c25c5898f43a4094df157f8d28f27d9efe"},
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
"earmark_parser": {:hex, :earmark_parser, "1.4.45", "cba8369ab2a1342e419bc2760eec731b17be828941dcf494045d44766227e1d5", [:mix], [], "hexpm", "d3ec045bf122965db20c0bdb420e19ee1415843135327124918473feb4b328e8"},
"ecto": {:hex, :ecto, "3.14.0", "2fa64521eebfcb2670d907a86e4ad947290e9933706bb315e6fb5c21b172cb26", [:mix], [{:decimal, "~> 3.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "130d69ffb4285f9ce4792b65dfbb994fd13ea4cbc3cbea2524b199aa3de84af3"},
"erlex": {:hex, :erlex, "0.2.8", "cd8116f20f3c0afe376d1e8d1f0ae2452337729f68be016ea544a72f767d9c12", [:mix], [], "hexpm", "9d66ff9fedf69e49dc3fd12831e12a8a37b76f8651dd21cd45fcf5561a8a7590"},
"ets": {:hex, :ets, "0.9.0", "79c6a6c205436780486f72d84230c6cba2f8a9920456750ddd1e47389107d5fd", [:mix], [], "hexpm", "2861fdfb04bcaeff370f1a5904eec864f0a56dcfebe5921ea9aadf2a481c822b"},
Expand All @@ -26,7 +26,7 @@
"igniter": {:hex, :igniter, "0.8.2", "28621d9d2559c86a0249a195d9a7c55e8967b781850feff0bce6c4013b75f1c3", [:mix], [{:ex_ast, "~> 0.5", [hex: :ex_ast, repo: "hexpm", optional: false]}, {:glob_ex, "~> 0.1.7", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:jason, "~> 1.4.5", [hex: :jason, repo: "hexpm", optional: false]}, {:owl, "~> 0.11", [hex: :owl, repo: "hexpm", optional: false]}, {:phx_new, "~> 1.7", [hex: :phx_new, repo: "hexpm", optional: true]}, {:req, "~> 0.5", [hex: :req, repo: "hexpm", optional: false]}, {:rewrite, ">= 1.1.1 and < 2.0.0-0", [hex: :rewrite, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.4", [hex: :sourceror, repo: "hexpm", optional: false]}, {:spitfire, ">= 0.1.3 and < 1.0.0-0", [hex: :spitfire, repo: "hexpm", optional: false]}], "hexpm", "89146ad3fba21f3ea10873ae509fc760618623d4578e4723929a9dd1532aa30f"},
"iterex": {:hex, :iterex, "0.1.2", "58f9b9b9a22a55cbfc7b5234a9c9c63eaac26d276b3db80936c0e1c60355a5a6", [:mix], [], "hexpm", "2e103b8bcc81757a9af121f6dc0df312c9a17220f302b1193ef720460d03029d"},
"jason": {:hex, :jason, "1.4.5", "2e3a008590b0b8d7388c20293e9dcc9cf3e5d642fd2a114e4cbbb52e595d940a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b0c823996102bcd0239b3c2444eb00409b72f6a140c1950bc8b457d836b30684"},
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
"makeup": {:hex, :makeup, "1.2.2", "882d46dc0905e9ff7abf2aab61a7e6b3dcc555533977d8a23b06019e6c89ac94", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "9a1a24e5b343b8ae16abea0822c10a6f75da27af7fa802ada5251f7579bfccfa"},
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
"makeup_erlang": {:hex, :makeup_erlang, "1.1.0", "835f7e60792e08824cda445639555d7bf1bbbddb1b60b306e33cb6f6db24dc74", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "1cd6780fb1dd1a03979abaed0fe82712b0625118fd5257d3ebbf73f960c73c3c"},
"mime": {:hex, :mime, "2.0.7", "b8d739037be7cd402aee1ba0306edfdef982687ee7e9859bee6198c1e7e2f128", [:mix], [], "hexpm", "6171188e399ee16023ffc5b76ce445eb6d9672e2e241d2df6050f3c771e80ccd"},
Expand Down
2 changes: 0 additions & 2 deletions test/alias_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
defmodule AliasTest do
use ExUnit.Case, async: false

require Ash.Query

setup do
on_exit(fn ->
AshGraphql.TestHelpers.stop_ets()
Expand Down
2 changes: 0 additions & 2 deletions test/custom_paginate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
defmodule AshGraphql.CustomPaginateTest do
use ExUnit.Case, async: false

require Ash.Query

setup do
on_exit(fn ->
AshGraphql.TestHelpers.stop_ets()
Expand Down
2 changes: 0 additions & 2 deletions test/lazyinit_post_search_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
defmodule AshGraphql.LazyInitTestPostSearchTest do
use ExUnit.Case, async: false

require Ash.Query

setup do
on_exit(fn ->
AshGraphql.TestHelpers.stop_ets()
Expand Down
2 changes: 0 additions & 2 deletions test/paginate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
defmodule AshGraphql.PaginateTest do
use ExUnit.Case, async: false

require Ash.Query

setup do
on_exit(fn ->
AshGraphql.TestHelpers.stop_ets()
Expand Down
1 change: 0 additions & 1 deletion test/plug_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
defmodule AshGraphql.PlugTest do
@moduledoc false
use ExUnit.Case, async: false
require Ash.Query
import Plug.Conn

@moduletag capture_log: true
Expand Down
2 changes: 0 additions & 2 deletions test/read_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
defmodule AshGraphql.ReadTest do
use ExUnit.Case, async: false

require Ash.Query

setup do
on_exit(fn ->
AshGraphql.TestHelpers.stop_ets()
Expand Down
2 changes: 0 additions & 2 deletions test/relationship_pagination_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
defmodule AshGraphql.RelationshipPaginationTest do
use ExUnit.Case, async: false

require Ash.Query

setup do
on_exit(fn ->
AshGraphql.TestHelpers.stop_ets()
Expand Down
2 changes: 0 additions & 2 deletions test/relay_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
defmodule AshGraphql.RelayTest do
use ExUnit.Case, async: false

require Ash.Query

setup do
on_exit(fn ->
AshGraphql.TestHelpers.stop_ets()
Expand Down
3 changes: 0 additions & 3 deletions test/support/gf/attendee.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ defmodule GF.Attendee do
extensions: [AshGraphql.Resource],
authorizers: [Ash.Policy.Authorizer]

require Ash.Query
require Ash.Sort

alias GF.Member

actions do
Expand Down
2 changes: 0 additions & 2 deletions test/support/gf/event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ defmodule GF.Event do
data_layer: Ash.DataLayer.Ets,
extensions: [AshGraphql.Resource]

require Ash.Query

alias GF.Attendee

attributes do
Expand Down
5 changes: 2 additions & 3 deletions test/support/gf/member.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

defmodule GF.Member do
@moduledoc false
require Logger

use Ash.Resource,
domain: GF.Domain,
data_layer: Ash.DataLayer.Ets,
extensions: [AshGraphql.Resource],
authorizers: [Ash.Policy.Authorizer]

require Ash.Query
require Logger

alias GF.ActiveMemberPolicy
alias GF.Group
alias GF.Types.MemberStatus
Expand Down
2 changes: 0 additions & 2 deletions test/support/relay_ids/resources/post.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ defmodule AshGraphql.Test.RelayIds.Post do
data_layer: Ash.DataLayer.Ets,
extensions: [AshGraphql.Resource]

require Ash.Query

graphql do
type :post

Expand Down
2 changes: 0 additions & 2 deletions test/support/resources/channel/channel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ defmodule AshGraphql.Test.Channel do
data_layer: Ash.DataLayer.Ets,
extensions: [AshGraphql.Resource]

require Ash.Query

graphql do
type :channel

Expand Down
2 changes: 0 additions & 2 deletions test/support/resources/domain_level_pubsub_resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ defmodule AshGraphql.Test.DomainLevelPubsubResource do
authorizers: [Ash.Policy.Authorizer],
extensions: [AshGraphql.Resource]

require Ash.Query

graphql do
type :domain_level_pubsub_resource

Expand Down
4 changes: 4 additions & 0 deletions test/support/resources/no_graphql.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ defmodule AshGraphql.Test.NoGraphql do
domain: AshGraphql.Test.Domain,
data_layer: Ash.DataLayer.Ets

actions do
defaults([:read])
end

attributes do
uuid_primary_key(:id)

Expand Down
2 changes: 0 additions & 2 deletions test/support/resources/product.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ defmodule AshGraphql.Test.Product do
data_layer: Ash.DataLayer.Ets,
extensions: [AshGraphql.Resource]

require Ash.Query

graphql do
type :product

Expand Down
2 changes: 0 additions & 2 deletions test/support/resources/relay_subscribable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ defmodule AshGraphql.Test.RelaySubscribable do
authorizers: [Ash.Policy.Authorizer],
extensions: [AshGraphql.Resource]

require Ash.Query

graphql do
type :relay_subscribable

Expand Down
2 changes: 0 additions & 2 deletions test/support/resources/resource_level_pubsub_resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ defmodule AshGraphql.Test.ResourceLevelPubsubResource do
authorizers: [Ash.Policy.Authorizer],
extensions: [AshGraphql.Resource]

require Ash.Query

graphql do
type :resource_level_pubsub_resource

Expand Down
2 changes: 0 additions & 2 deletions test/support/resources/resource_with_typed_struct.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ defmodule AshGraphql.Test.ResourceWithTypedStruct do
data_layer: Ash.DataLayer.Ets,
extensions: [AshGraphql.Resource]

require Ash.Query

graphql do
type :resource_with_typed_struct

Expand Down
2 changes: 0 additions & 2 deletions test/support/resources/subscribable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ defmodule AshGraphql.Test.Subscribable do
authorizers: [Ash.Policy.Authorizer],
extensions: [AshGraphql.Resource]

require Ash.Query

graphql do
type :subscribable

Expand Down
8 changes: 8 additions & 0 deletions test/support/simple_domain/simple_resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ defmodule AshGraphql.Test.SimpleResource do
use Ash.Resource,
extensions: [AshGraphql.Resource],
domain: AshGraphql.Test.SimpleDomain

attributes do
uuid_primary_key(:id)
end

actions do
defaults([:read])
end
end
Loading