chore: more extension docs for new docs site

This commit is contained in:
Zach Daniel 2022-03-24 00:27:21 -04:00
parent 27df3f0ba8
commit 7b02117531
9 changed files with 45 additions and 1 deletions

View file

@ -112,4 +112,8 @@ defmodule Ash.Api.Dsl do
"""
use Ash.Dsl.Extension, sections: @sections
def name, do: "Api"
def target, do: "Ash.Api"
def default_for_target?, do: true
end

View file

@ -27,8 +27,16 @@ defmodule Ash.DataLayer.Ets do
]
]
}
use Ash.Dsl.Extension, sections: [@ets]
@impl true
def name, do: "Ets"
@impl true
def target, do: "Ash.Resource"
@impl true
def type, do: "DataLayer"
alias Ash.Actions.Sort
alias Ash.Dsl.Extension

View file

@ -34,6 +34,13 @@ defmodule Ash.DataLayer.Mnesia do
use Ash.Dsl.Extension, sections: [@mnesia]
@impl true
def name, do: "Mnesia"
@impl true
def target, do: "Ash.Resource"
@impl true
def type, do: "DataLayer"
alias Ash.Actions.Sort
alias Ash.Dsl.Extension
alias :mnesia, as: Mnesia

View file

@ -8,6 +8,8 @@ defmodule Ash.DataLayer.Simple do
use Ash.Dsl.Extension, transformers: [], sections: []
def show_in_docs?, do: false
def can?(_, :create), do: true
def can?(_, :update), do: true
def can?(_, :destroy), do: true

View file

@ -113,7 +113,15 @@ defmodule Ash.Dsl.Extension do
@callback name() :: String.t()
@callback target() :: String.t()
@callback default_for_target?() :: boolean
@optional_callbacks [name: 0, target: 0, default_for_target?: 0]
@callback show_in_docs?() :: boolean
@callback type() :: String.t()
@optional_callbacks [
name: 0,
target: 0,
default_for_target?: 0,
show_in_docs?: 0,
type: 0
]
defp dsl!(resource) do
Code.ensure_compiled!(resource)

View file

@ -287,4 +287,8 @@ defmodule Ash.Flow.Dsl do
use Ash.Dsl.Extension,
sections: @sections,
transformers: @transformers
def name, do: "Flow"
def target, do: "Ash.Flow"
def default_for_target?, do: true
end

View file

@ -136,6 +136,10 @@ defmodule Ash.Notifier.PubSub do
use Ash.Dsl.Extension, sections: @sections
def name, do: "PubSub"
def target, do: "Ash.Resource"
def type, do: "Notifier"
def publications(resource) do
Ash.Dsl.Extension.get_entities(resource, [:pub_sub])
end

View file

@ -8,4 +8,7 @@ defmodule Ash.Registry.ResourceValidations do
]
use Ash.Dsl.Extension, transformers: @transformers
def name, do: "Resource Validations"
def target, do: "Ash.Registry"
end

View file

@ -25,6 +25,10 @@ defmodule Ash.Registry do
alias Ash.Dsl.Extension
def name, do: "Registry"
def target, do: "Ash.Registry"
def default_for_target?, do: true
@spec entries(t()) :: list(module)
def entries(registry) do
case registry |> Extension.get_entities([:entries]) |> Enum.map(& &1.entry) do