diff --git a/lib/ash/dsl/dsl.ex b/lib/ash/dsl/dsl.ex index 5fd9b08c..fb6b09d6 100644 --- a/lib/ash/dsl/dsl.ex +++ b/lib/ash/dsl/dsl.ex @@ -28,6 +28,10 @@ defmodule Ash.Dsl do ] ] + @type entity :: %Ash.Dsl.Entity{} + + @type section :: %Ash.Dsl.Section{} + @moduledoc """ The primary entry point for adding a DSL to a module. diff --git a/lib/ash/dsl/entity.ex b/lib/ash/dsl/entity.ex index 5e205f8b..f31ddc8f 100644 --- a/lib/ash/dsl/entity.ex +++ b/lib/ash/dsl/entity.ex @@ -46,19 +46,6 @@ defmodule Ash.Dsl.Entity do auto_set_fields: [] ] - @type t :: %__MODULE__{ - name: atom, - describe: String.t(), - target: module, - examples: [String.t()], - transform: mfa | nil, - args: [atom], - hide: [atom], - entities: Keyword.t(), - auto_set_fields: Keyword.t(), - schema: Ash.OptionsHelpers.schema() - } - def build( %{target: target, schema: schema, auto_set_fields: auto_set_fields, transform: transform}, opts, diff --git a/lib/ash/dsl/extension.ex b/lib/ash/dsl/extension.ex index 8c3b8f4d..36d47ac0 100644 --- a/lib/ash/dsl/extension.ex +++ b/lib/ash/dsl/extension.ex @@ -102,7 +102,7 @@ defmodule Ash.Dsl.Extension do See the documentation for `Ash.Dsl.Section` and `Ash.Dsl.Entity` for more information """ - @callback sections() :: [Ash.Dsl.Section.t()] + @callback sections() :: [Ash.Dsl.section()] @callback transformers() :: [module] @doc "Get the entities configured for a given section" diff --git a/lib/ash/dsl/section.ex b/lib/ash/dsl/section.ex index 28414808..39dcbbd4 100644 --- a/lib/ash/dsl/section.ex +++ b/lib/ash/dsl/section.ex @@ -30,13 +30,4 @@ defmodule Ash.Dsl.Section do entities: [], sections: [] ] - - @type t :: %__MODULE__{ - name: atom, - describe: String.t(), - examples: [String.t()], - entities: [Ash.Dsl.Entity.t()], - sections: [%__MODULE__{}], - schema: Ash.OptionsHelpers.schema() - } end diff --git a/lib/ash/helpers.ex b/lib/ash/helpers.ex index 09e68934..75204b19 100644 --- a/lib/ash/helpers.ex +++ b/lib/ash/helpers.ex @@ -22,18 +22,6 @@ defmodule Ash.Helpers do false end - # A restricted version of `:erlang.binary_to_term/2` that forbids - # *executable* terms, such as anonymous functions. - # The `opts` are given to the underlying `:erlang.binary_to_term/2` - # call, with an empty list as a default. - # By default this function does not restrict atoms, as an atom - # interned in one node may not yet have been interned on another - # (except for releases, which preload all code). - # If you want to avoid atoms from being created, then you can pass - # `[:safe]` as options, as that will also enable the safety mechanisms - # from `:erlang.binary_to_term/2` itself. - # Ripped from https://github.com/elixir-plug/plug_crypto/blob/v1.2.0/lib/plug/crypto.ex - # sobelow_skip ["Misc.BinToTerm"] def non_executable_binary_to_term(binary, opts \\ []) when is_binary(binary) do term = :erlang.binary_to_term(binary, opts) diff --git a/lib/ash/page/keyset.ex b/lib/ash/page/keyset.ex index 4ac00afd..df44e052 100644 --- a/lib/ash/page/keyset.ex +++ b/lib/ash/page/keyset.ex @@ -118,5 +118,18 @@ defmodule Ash.Page.Keyset do Enum.map(fields, &Map.get(record, &1)) end + @doc """ + A restricted version of `:erlang.binary_to_term/2` that forbids + *executable* terms, such as anonymous functions. + The `opts` are given to the underlying `:erlang.binary_to_term/2` + call, with an empty list as a default. + By default this function does not restrict atoms, as an atom + interned in one node may not yet have been interned on another + (except for releases, which preload all code). + If you want to avoid atoms from being created, then you can pass + `[:safe]` as options, as that will also enable the safety mechanisms + from `:erlang.binary_to_term/2` itself. + Ripped from https://github.com/elixir-plug/plug_crypto/blob/v1.2.0/lib/plug/crypto.ex + """ defdelegate non_executable_binary_to_term(binary, opts), to: Ash.Helpers end diff --git a/lib/ash/sort/sort.ex b/lib/ash/sort/sort.ex index 4e91db59..2b1f49f7 100644 --- a/lib/ash/sort/sort.ex +++ b/lib/ash/sort/sort.ex @@ -1,5 +1,7 @@ defmodule Ash.Sort do - @moduledoc false + @moduledoc """ + Utilities and types for sorting. + """ alias Ash.Error.Query.{InvalidSortOrder, NoSuchAttribute} diff --git a/lib/sat_solver.ex b/lib/sat_solver.ex index b5eb3771..75eb00d8 100644 --- a/lib/sat_solver.ex +++ b/lib/sat_solver.ex @@ -1,5 +1,7 @@ defmodule Ash.SatSolver do - @moduledoc false + @moduledoc """ + Tools for working with the satsolver that drives filter subset checking (for authorization) + """ alias Ash.Filter alias Ash.Query.{BooleanExpression, Not, Ref} diff --git a/mix.exs b/mix.exs index 5d336883..1e8e2faa 100644 --- a/mix.exs +++ b/mix.exs @@ -97,6 +97,10 @@ defmodule Ash.MixProject do Ash.Resource.Dsl, Ash.Api.Dsl ], + tools: [ + Ash.Filter, + Ash.Sort + ], validations: ~r/Ash.Resource.Validation/, changes: ~r/Ash.Resource.Change/, calculations: [ @@ -145,7 +149,8 @@ defmodule Ash.MixProject do Ash.UUID, Ash.NotLoaded, Ash.Query.Aggregate, - Ash.Query.Type + Ash.Query.Type, + Ash.SatSolver ], comparable: ~r/Comparable/ ]