improvement: upgrade to ash 2.0

This commit is contained in:
Zach Daniel 2022-08-19 12:35:07 -04:00
parent 0cb29388d8
commit 480d80273c
17 changed files with 119 additions and 132 deletions

View file

@ -215,9 +215,10 @@ defmodule AshHq.Accounts.User do
end end
relationships do relationships do
has_one :token, AshHq.Accounts.UserToken, has_one :token, AshHq.Accounts.UserToken do
destination_field: :user_id, destination_attribute :user_id
private?: true private? true
end
end end
resource do resource do

View file

@ -3,7 +3,7 @@ defmodule AshHq.Docs.Extensions.RenderMarkdown do
Sets up markdown text attributes to be transformed to html (in another column). Sets up markdown text attributes to be transformed to html (in another column).
""" """
@render_markdown %Ash.Dsl.Section{ @render_markdown %Spark.Dsl.Section{
name: :render_markdown, name: :render_markdown,
schema: [ schema: [
render_attributes: [ render_attributes: [
@ -20,16 +20,16 @@ defmodule AshHq.Docs.Extensions.RenderMarkdown do
] ]
} }
use Ash.Dsl.Extension, use Spark.Dsl.Extension,
sections: [@render_markdown], sections: [@render_markdown],
transformers: [AshHq.Docs.Extensions.RenderMarkdown.Transformers.AddRenderMarkdownStructure] transformers: [AshHq.Docs.Extensions.RenderMarkdown.Transformers.AddRenderMarkdownStructure]
def render_attributes(resource) do def render_attributes(resource) do
Ash.Dsl.Extension.get_opt(resource, [:render_markdown], :render_attributes, []) Spark.Dsl.Extension.get_opt(resource, [:render_markdown], :render_attributes, [])
end end
def header_ids?(resource) do def header_ids?(resource) do
Ash.Dsl.Extension.get_opt(resource, [:render_markdown], :header_ids?, []) Spark.Dsl.Extension.get_opt(resource, [:render_markdown], :header_ids?, [])
end end
def render!(%resource{} = record, key, on_demand? \\ false) do def render!(%resource{} = record, key, on_demand? \\ false) do

View file

@ -6,16 +6,16 @@ defmodule AshHq.Docs.Extensions.RenderMarkdown.Transformers.AddRenderMarkdownStr
attributes to the `allow_nil_input` of each action, since it will be adding them automatically. attributes to the `allow_nil_input` of each action, since it will be adding them automatically.
""" """
use Ash.Dsl.Transformer use Spark.Dsl.Transformer
alias Ash.Dsl.Transformer alias Spark.Dsl.Transformer
def transform(resource, dsl) do def transform(dsl) do
resource dsl
|> AshHq.Docs.Extensions.RenderMarkdown.render_attributes() |> Transformer.get_option([:render_markdown], :render_attributes, [])
|> Enum.reduce({:ok, dsl}, fn {source, destination}, {:ok, dsl} -> |> Enum.reduce({:ok, dsl}, fn {source, destination}, {:ok, dsl} ->
{:ok, {:ok,
dsl dsl
|> allow_nil_input(resource, destination) |> allow_nil_input(destination)
|> Transformer.add_entity( |> Transformer.add_entity(
[:changes], [:changes],
Transformer.build_entity!(Ash.Resource.Dsl, [:changes], :change, Transformer.build_entity!(Ash.Resource.Dsl, [:changes], :change,
@ -27,9 +27,9 @@ defmodule AshHq.Docs.Extensions.RenderMarkdown.Transformers.AddRenderMarkdownStr
end) end)
end end
defp allow_nil_input(dsl, resource, destination) do defp allow_nil_input(dsl, destination) do
resource dsl
|> Ash.Resource.Info.actions() |> Transformer.get_entities([:actions])
|> Enum.filter(&(&1.type == :create)) |> Enum.filter(&(&1.type == :create))
|> Enum.reduce(dsl, fn action, dsl -> |> Enum.reduce(dsl, fn action, dsl ->
Transformer.replace_entity( Transformer.replace_entity(

View file

@ -5,9 +5,9 @@ defmodule AshHq.Docs.Extensions.Search do
This generally involves ensuring that there is a url safe name attribute to be used in routing, This generally involves ensuring that there is a url safe name attribute to be used in routing,
and configuring how the item will be searched for. and configuring how the item will be searched for.
""" """
alias Ash.Dsl.Extension alias Spark.Dsl.Extension
@search %Ash.Dsl.Section{ @search %Spark.Dsl.Section{
name: :search, name: :search,
schema: [ schema: [
type: [ type: [
@ -63,7 +63,7 @@ defmodule AshHq.Docs.Extensions.Search do
] ]
] ]
} }
use Ash.Dsl.Extension, use Spark.Dsl.Extension,
sections: [@search], sections: [@search],
transformers: [AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure] transformers: [AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure]

View file

@ -13,22 +13,28 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do
* Adds a search action * Adds a search action
* Adds a code interface for the search action * Adds a code interface for the search action
""" """
use Ash.Dsl.Transformer use Spark.Dsl.Transformer
import Ash.Filter.TemplateHelpers import Ash.Filter.TemplateHelpers
require Ash.Query require Ash.Query
alias Ash.Dsl.Transformer alias Spark.Dsl.Transformer
def transform(resource, dsl_state) do def transform(dsl_state) do
name_attribute = AshHq.Docs.Extensions.Search.name_attribute(resource) name_attribute = Transformer.get_option(dsl_state, [:search], :name_attribute) || :name
sanitized_name_attribute =
Transformer.get_option(dsl_state, [:search], :sanitized_name_attribute) ||
:"sanitized_#{name_attribute}"
config = %{ config = %{
resource: resource,
name_attribute: name_attribute, name_attribute: name_attribute,
doc_attribute: AshHq.Docs.Extensions.Search.doc_attribute(resource), doc_attribute: Transformer.get_option(dsl_state, [:search], :doc_attribute),
library_version_attribute: AshHq.Docs.Extensions.Search.library_version_attribute(resource), library_version_attribute:
table: AshPostgres.table(resource), Transformer.get_option(dsl_state, [:search], :library_version_attribute) ||
sanitized_name_attribute: AshHq.Docs.Extensions.Search.sanitized_name_attribute(resource), :library_version_id,
show_docs_on: AshHq.Docs.Extensions.Search.show_docs_on(resource) table: Transformer.get_option(dsl_state, [:postgres], :table),
sanitized_name_attribute: sanitized_name_attribute,
show_docs_on:
Transformer.get_option(dsl_state, [:search], :show_docs_on) || sanitized_name_attribute
} }
{:ok, {:ok,
@ -70,7 +76,10 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do
defp add_sanitized_name(dsl_state, config) do defp add_sanitized_name(dsl_state, config) do
dsl_state = dsl_state =
if Ash.Resource.Info.attribute(config.resource, config.sanitized_name_attribute) do if Enum.find(
Transformer.get_entities(dsl_state, [:attributes]),
&(&1.name == config.sanitized_name_attribute)
) do
dsl_state dsl_state
else else
Transformer.add_entity( Transformer.add_entity(
@ -87,7 +96,7 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do
) )
end end
if AshHq.Docs.Extensions.Search.auto_sanitize_name_attribute?(config.resource) do if Transformer.get_option(dsl_state, [:search], :auto_sanitize_name_attribute?, true) do
Transformer.add_entity( Transformer.add_entity(
dsl_state, dsl_state,
[:changes], [:changes],
@ -96,7 +105,7 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do
{AshHq.Docs.Extensions.Search.Changes.SanitizeName, {AshHq.Docs.Extensions.Search.Changes.SanitizeName,
source: config.name_attribute, source: config.name_attribute,
destination: config.sanitized_name_attribute, destination: config.sanitized_name_attribute,
use_path_for_name?: AshHq.Docs.Extensions.Search.use_path_for_name?(config.resource)} use_path_for_name?: Transformer.get_option(dsl_state, [:search], :use_path_for_name?)}
) )
) )
else else

View file

@ -4,10 +4,8 @@ defmodule AshHq.Docs.Extensions.Search.Types do
""" """
@search_types AshHq.Docs.Registry @search_types AshHq.Docs.Registry
|> Ash.Registry.entries() |> Ash.Registry.Info.entries()
|> Enum.filter( |> Enum.filter(&(AshHq.Docs.Extensions.Search in Spark.extensions(&1)))
&(AshHq.Docs.Extensions.Search in Ash.Resource.Info.extensions(&1))
)
|> Enum.map(&AshHq.Docs.Extensions.Search.type/1) |> Enum.map(&AshHq.Docs.Extensions.Search.type/1)
|> Enum.uniq() |> Enum.uniq()

View file

@ -42,16 +42,11 @@ defmodule AshHq.Docs.Library do
attribute :display_name, :string do attribute :display_name, :string do
allow_nil? false allow_nil? false
end end
attribute :track_branches, {:array, :string} do
default []
end
end end
aggregates do aggregates do
first :latest_version, :versions, :version do first :latest_version, :versions, :version do
sort version: :desc sort version: :desc
filter expr(contains(version, "."))
end end
end end

View file

@ -107,11 +107,6 @@ defmodule AshHq.Docs.LibraryVersion do
allow_nil? false allow_nil? false
end end
attribute :branch, :boolean do
allow_nil? false
default false
end
attribute :default_guide, :string attribute :default_guide, :string
end end

View file

@ -153,7 +153,7 @@ defmodule AshHqWeb.Components.DocSidebar do
libraries libraries
|> Enum.flat_map(fn library -> |> Enum.flat_map(fn library ->
library.versions library.versions
|> Enum.find(&Ash.Resource.Info.loaded?(&1, :modules)) |> Enum.find(&Ash.Resource.loaded?(&1, :modules))
|> case do |> case do
nil -> nil ->
[] []
@ -256,7 +256,7 @@ defmodule AshHqWeb.Components.DocSidebar do
libraries libraries
|> Enum.flat_map(fn library -> |> Enum.flat_map(fn library ->
library.versions library.versions
|> Enum.find(&Ash.Resource.Info.loaded?(&1, :guides)) |> Enum.find(&Ash.Resource.loaded?(&1, :guides))
|> case do |> case do
nil -> nil ->
[] []
@ -277,7 +277,7 @@ defmodule AshHqWeb.Components.DocSidebar do
defp get_extensions(libraries) do defp get_extensions(libraries) do
Enum.flat_map(libraries, fn library -> Enum.flat_map(libraries, fn library ->
library.versions library.versions
|> Enum.find(&Ash.Resource.Info.loaded?(&1, :extensions)) |> Enum.find(&Ash.Resource.loaded?(&1, :extensions))
|> case do |> case do
nil -> nil ->
[] []

View file

@ -43,7 +43,6 @@ defmodule AshHqWeb.Components.Search do
<Form for={:search} change="search" submit="go-to-doc" class="w-full"> <Form for={:search} change="search" submit="go-to-doc" class="w-full">
<input <input
id="search-input" id="search-input"
phx-debounce="150"
name="search" name="search"
value={@search} value={@search}
class="text-lg dark:bg-primary-black grow ring-0 outline-none w-full" class="text-lg dark:bg-primary-black grow ring-0 outline-none w-full"

View file

@ -2,8 +2,6 @@ defmodule AshHqWeb.Helpers do
@moduledoc "Simple helpers for doc liveviews" @moduledoc "Simple helpers for doc liveviews"
def latest_version(library) do def latest_version(library) do
Enum.find(library.versions, fn version -> Enum.at(library.versions, 0)
!version.branch
end) || Enum.at(library.versions, 0)
end end
end end

View file

@ -407,10 +407,11 @@ defmodule AshHqWeb.Pages.Docs do
end end
defp render_mix_deps(docs, assigns) do defp render_mix_deps(docs, assigns) do
String.replace(docs, ~r/^(?!\<\/code\>){{mix_dep:.*}}/, fn text -> String.replace(docs, ~r/{{mix_dep:.*}}/, fn text ->
try do try do
"{{mix_dep:" <> library = String.trim_trailing(text, "}}") "{{mix_dep:" <> library = String.trim_trailing(text, "}}")
render_mix_dep(assigns, library, text)
"<pre><code>#{render_mix_dep(assigns, library, text)}</code></pre>"
rescue rescue
e -> e ->
Logger.error("Invalid link #{inspect(e)}") Logger.error("Invalid link #{inspect(e)}")
@ -439,16 +440,12 @@ defmodule AshHqWeb.Pages.Docs do
end end
end end
if version.branch do case Version.parse(version.version) do
~s({:#{library.name}, github: "ash-project/#{library.name}", branch: "#{version}"}) {:ok, %{major: major, minor: minor, patch: 0}} ->
else ~s({:#{library.name}, "~> #{major}.#{minor}"})
case Version.parse(version) do
{:ok, %{major: major, minor: minor, patch: 0}} ->
~s({:#{library.name}, "~> #{major}.#{minor}"})
{:ok, version} -> {:ok, version} ->
~s({:#{library.name}, "~> #{version}"}) ~s({:#{library.name}, "~> #{version}"})
end
end end
end end
@ -456,8 +453,8 @@ defmodule AshHqWeb.Pages.Docs do
String.replace(docs, ~r/(?!<code>){{link:.*}}(?!<\/code>)/, fn text -> String.replace(docs, ~r/(?!<code>){{link:.*}}(?!<\/code>)/, fn text ->
try do try do
"{{link:" <> rest = String.trim_trailing(text, "}}") "{{link:" <> rest = String.trim_trailing(text, "}}")
[library, type, item] = String.split(rest, ":") [library, type, item | rest] = String.split(rest, ":")
render_link(assigns, library, type, item, text) render_link(assigns, library, type, item, text, rest)
rescue rescue
e -> e ->
Logger.error("Invalid link #{inspect(e)}") Logger.error("Invalid link #{inspect(e)}")
@ -466,7 +463,7 @@ defmodule AshHqWeb.Pages.Docs do
end) end)
end end
defp render_link(assigns, library, type, item, source) do defp render_link(assigns, library, type, item, source, rest) do
library = library =
Enum.find(assigns[:libraries], &(&1.name == library)) || Enum.find(assigns[:libraries], &(&1.name == library)) ||
raise "No such library in link: #{source}" raise "No such library in link: #{source}"
@ -496,8 +493,10 @@ defmodule AshHqWeb.Pages.Docs do
Enum.find(version.guides, &(&1.name == item)) || Enum.find(version.guides, &(&1.name == item)) ||
raise "No such guide in link: #{source}" raise "No such guide in link: #{source}"
text = Enum.at(rest, 0) || item
""" """
<a href="#{DocRoutes.doc_link(guide, assigns[:selected_versions])}">#{item}</a> <a href="#{DocRoutes.doc_link(guide, assigns[:selected_versions])}">#{text}</a>
""" """
"dsl" -> "dsl" ->
@ -507,17 +506,17 @@ defmodule AshHqWeb.Pages.Docs do
|> Enum.join(".") |> Enum.join(".")
""" """
<a href="/docs/dsl/#{library.name}/#{version.sanitized_version}/#{item}">#{name}</a> <a href="/docs/dsl/#{library.name}/#{version.version}/#{item}">#{name}</a>
""" """
"module" -> "module" ->
""" """
<a href="/docs/module/#{library.name}/#{DocRoutes.sanitize_name(version.version)}/#{DocRoutes.sanitize_name(item)}">#{item}</a> <a href="/docs/module/#{library.name}/#{version.version}/#{DocRoutes.sanitize_name(item)}">#{item}</a>
""" """
"extension" -> "extension" ->
""" """
<a href="/docs/dsl/#{library.name}/#{version.sanitized_version}/#{DocRoutes.sanitize_name(item)}">#{item}</a> <a href="/docs/dsl/#{library.name}/#{version.version}/#{DocRoutes.sanitize_name(item)}">#{item}</a>
""" """
type -> type ->

View file

@ -10,24 +10,24 @@ defmodule AshHqWeb.AppViewLive do
alias Surface.Components.{Link, LiveRedirect} alias Surface.Components.{Link, LiveRedirect}
require Ash.Query require Ash.Query
data configured_theme, :string, default: :system data(configured_theme, :string, default: :system)
data searching, :boolean, default: false data(searching, :boolean, default: false)
data selected_versions, :map, default: %{} data(selected_versions, :map, default: %{})
data libraries, :list, default: [] data(libraries, :list, default: [])
data selected_types, :map, default: %{} data(selected_types, :map, default: %{})
data sidebar_state, :map, default: %{} data(sidebar_state, :map, default: %{})
data current_user, :map data(current_user, :map)
data library, :any, default: nil data(library, :any, default: nil)
data extension, :any, default: nil data(extension, :any, default: nil)
data docs, :any, default: nil data(docs, :any, default: nil)
data library_version, :any, default: nil data(library_version, :any, default: nil)
data guide, :any, default: nil data(guide, :any, default: nil)
data doc_path, :list, default: [] data(doc_path, :list, default: [])
data dsls, :list, default: [] data(dsls, :list, default: [])
data dsl, :any, default: nil data(dsl, :any, default: nil)
data options, :list, default: [] data(options, :list, default: [])
data module, :any, default: nil data(module, :any, default: nil)
def render(assigns) do def render(assigns) do
~F""" ~F"""
@ -70,13 +70,13 @@ defmodule AshHqWeb.AppViewLive do
{/if} {/if}
<div class="flex flex-row align-middle items-center space-x-2"> <div class="flex flex-row align-middle items-center space-x-2">
<a <a
href="/docs/guides/ash/main/tutorials/quick-start.md" href="/docs/guides/ash/latest/tutorials/getting-started.md"
target="_blank" target="_blank"
class="dark:text-gray-400 dark:hover:text-gray-200 hover:text-gray-600" class="dark:text-gray-400 dark:hover:text-gray-200 hover:text-gray-600"
>Quick Start</a> >Get Started</a>
<div>|</div> <div>|</div>
<a <a
href="/docs/guides/ash/main/topics/overview.md" href="/docs/guides/ash/latest/topics/overview.md"
target="_blank" target="_blank"
class="dark:text-gray-400 dark:hover:text-gray-200 hover:text-gray-600" class="dark:text-gray-400 dark:hover:text-gray-200 hover:text-gray-600"
>Docs</a> >Docs</a>
@ -444,19 +444,8 @@ defmodule AshHqWeb.AppViewLive do
libraries = AshHq.Docs.Library.read!(load: [versions: versions_query]) libraries = AshHq.Docs.Library.read!(load: [versions: versions_query])
selected_versions = selected_versions =
Enum.reduce(libraries, %{}, fn library, acc -> Enum.reduce(libraries, configured_library_versions, fn library, acc ->
# for now we only assume that ash will always appear in the docs Map.put_new(acc, library.id, "latest")
if library.name == "ash" do
case AshHqWeb.Helpers.latest_version(library) do
nil ->
acc
version ->
Map.put_new(acc, library.id, version.id)
end
else
acc
end
end) end)
{:ok, {:ok,
@ -470,7 +459,7 @@ defmodule AshHqWeb.AppViewLive do
:selected_types, :selected_types,
selected_types selected_types
) )
|> assign(:selected_versions, configured_library_versions) |> assign(:selected_versions, selected_versions)
|> assign(configured_theme: configured_theme, sidebar_state: sidebar_state) |> assign(configured_theme: configured_theme, sidebar_state: sidebar_state)
|> push_event("selected-versions", selected_versions) |> push_event("selected-versions", selected_versions)
|> push_event("selected_types", %{types: selected_types})} |> push_event("selected_types", %{types: selected_types})}
@ -685,7 +674,7 @@ defmodule AshHqWeb.AppViewLive do
version -> version ->
Enum.find( Enum.find(
library.versions, library.versions,
&(&1.sanitized_version == version) &(&1.version == version)
) )
end end
@ -696,9 +685,10 @@ defmodule AshHqWeb.AppViewLive do
library_version: library_version library_version: library_version
) )
if !socket.assigns[:library] || if socket.assigns.params["version"] != "latest" &&
socket.assigns.params["library"] != (!socket.assigns[:library] ||
socket.assigns.library.name do socket.assigns.params["library"] !=
socket.assigns.library.name) do
new_selected_versions = new_selected_versions =
Map.put(socket.assigns.selected_versions, library.id, library_version.id) Map.put(socket.assigns.selected_versions, library.id, library_version.id)

View file

@ -34,13 +34,14 @@ defmodule AshHq.MixProject do
defp deps do defp deps do
[ [
# {:ash, "~> 1.53"}, # {:ash, "~> 1.53"},
{:ash, github: "ash-project/ash", override: true}, {:ash, github: "ash-project/ash", override: true, branch: "2.0"},
# {:ash, path: "../ash", override: true}, # {:ash, path: "../ash", override: true},
# {:ash_postgres, "~> 0.42.0-rc.5"}, # {:ash_postgres, "~> 0.42.0-rc.5"},
{:ash_postgres, github: "ash-project/ash_postgres"}, {:ash_postgres, github: "ash-project/ash_postgres", branch: "ash-2.0"},
# {:ash_postgres, path: "../ash_postgres"}, # {:ash_postgres, path: "../ash_postgres"},
{:ash_phoenix, github: "ash-project/ash_phoenix", override: true}, {:ash_phoenix, github: "ash-project/ash_phoenix", branch: "ash-2.0", override: true},
# {:ash_livebook, path: "../ash_livebook", only: [:dev]}, # {:ash_livebook, path: "../ash_livebook", only: [:dev]},
{:spark, path: "../spark", override: true},
{:earmark, "~> 1.5.0-pre1", override: true}, {:earmark, "~> 1.5.0-pre1", override: true},
{:surface, "~> 0.7.3"}, {:surface, "~> 0.7.3"},
{:surface_heroicons, "~> 0.6.0"}, {:surface_heroicons, "~> 0.6.0"},

View file

@ -1,7 +1,7 @@
%{ %{
"ash": {:git, "https://github.com/ash-project/ash.git", "c21c5e6ae74877827f8ad93619efecd54112dba3", []}, "ash": {:git, "https://github.com/ash-project/ash.git", "f91c26f093bb3a9561ef93e84cc24b2dad0e231b", [branch: "2.0"]},
"ash_phoenix": {:git, "https://github.com/ash-project/ash_phoenix.git", "f5390fb8dd44399b14e4027a2f97ea70a07e62ed", []}, "ash_phoenix": {:git, "https://github.com/ash-project/ash_phoenix.git", "72988a991a5ae00eb695f88e81448f1478cee79a", [branch: "ash-2.0"]},
"ash_postgres": {:git, "https://github.com/ash-project/ash_postgres.git", "b561c4f8d4216ae57503d2f320bcc67d64a29d63", []}, "ash_postgres": {:git, "https://github.com/ash-project/ash_postgres.git", "763638757c92c64dbb424e34d0ba459644bb6726", [branch: "ash-2.0"]},
"bcrypt_elixir": {:hex, :bcrypt_elixir, "3.0.1", "9be815469e6bfefec40fa74658ecbbe6897acfb57614df1416eeccd4903f602c", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "486bb95efb645d1efc6794c1ddd776a186a9a713abf06f45708a6ce324fb96cf"}, "bcrypt_elixir": {:hex, :bcrypt_elixir, "3.0.1", "9be815469e6bfefec40fa74658ecbbe6897acfb57614df1416eeccd4903f602c", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "486bb95efb645d1efc6794c1ddd776a186a9a713abf06f45708a6ce324fb96cf"},
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"castore": {:hex, :castore, "0.1.17", "ba672681de4e51ed8ec1f74ed624d104c0db72742ea1a5e74edbc770c815182f", [:mix], [], "hexpm", "d9844227ed52d26e7519224525cb6868650c272d4a3d327ce3ca5570c12163f9"}, "castore": {:hex, :castore, "0.1.17", "ba672681de4e51ed8ec1f74ed624d104c0db72742ea1a5e74edbc770c815182f", [:mix], [], "hexpm", "d9844227ed52d26e7519224525cb6868650c272d4a3d327ce3ca5570c12163f9"},
@ -42,6 +42,7 @@
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"}, "html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"},
"libgraph": {:hex, :libgraph, "0.13.3", "20732b7bafb933dcf7351c479e03076ebd14a85fd3202c67a1c197f4f7c2466b", [:mix], [], "hexpm", "78f2576eef615440b46f10060b1de1c86640441422832052686df53dc3c148c6"},
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
"makeup_eex": {:hex, :makeup_eex, "0.1.1", "89352d5da318d97ae27bbcc87201f274504d2b71ede58ca366af6a5fbed9508d", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.16", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_html, "~> 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d111a0994eaaab09ef1a4b3b313ef806513bb4652152c26c0d7ca2be8402a964"}, "makeup_eex": {:hex, :makeup_eex, "0.1.1", "89352d5da318d97ae27bbcc87201f274504d2b71ede58ca366af6a5fbed9508d", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.16", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_html, "~> 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d111a0994eaaab09ef1a4b3b313ef806513bb4652152c26c0d7ca2be8402a964"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
@ -76,7 +77,8 @@
"providers": {:hex, :providers, "1.8.1", "70b4197869514344a8a60e2b2a4ef41ca03def43cfb1712ecf076a0f3c62f083", [:rebar3], [{:getopt, "1.0.1", [hex: :getopt, repo: "hexpm", optional: false]}], "hexpm", "e45745ade9c476a9a469ea0840e418ab19360dc44f01a233304e118a44486ba0"}, "providers": {:hex, :providers, "1.8.1", "70b4197869514344a8a60e2b2a4ef41ca03def43cfb1712ecf076a0f3c62f083", [:rebar3], [{:getopt, "1.0.1", [hex: :getopt, repo: "hexpm", optional: false]}], "hexpm", "e45745ade9c476a9a469ea0840e418ab19360dc44f01a233304e118a44486ba0"},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"sobelow": {:hex, :sobelow, "0.11.1", "23438964486f8112b41e743bbfd402da3e5b296fdc9eacab29914b79c48916dd", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "9897363a7eff96f4809304a90aad819e2ad5e5d24db547af502885146746a53c"}, "sobelow": {:hex, :sobelow, "0.11.1", "23438964486f8112b41e743bbfd402da3e5b296fdc9eacab29914b79c48916dd", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "9897363a7eff96f4809304a90aad819e2ad5e5d24db547af502885146746a53c"},
"sourceror": {:hex, :sourceror, "0.11.1", "1b80efe84330beefb6b3da95b75c1e1cdefe9dc785bf4c5064fae251a8af615c", [:mix], [], "hexpm", "22b6828ee5572f6cec75cc6357f3ca6c730a02954cef0302c428b3dba31e5e74"}, "sourceror": {:hex, :sourceror, "0.11.2", "549ce48be666421ac60cfb7f59c8752e0d393baa0b14d06271d3f6a8c1b027ab", [:mix], [], "hexpm", "9ab659118896a36be6eec68ff7b0674cba372fc8e210b1e9dc8cf2b55bb70dfb"},
"spark": {:hex, :spark, "0.1.12", "e25d1386087981e60982258ac0614babf5456d43511081ded2b5a47644a2c2ed", [:mix], [{:libgraph, "~> 0.13.3", [hex: :libgraph, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:sourceror, "~> 0.1", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "f1591ba83d81a08bc9d0313259384c390e74e0c14f2ad7f38609d573ac0f1f9f"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
"stream_data": {:hex, :stream_data, "0.5.0", "b27641e58941685c75b353577dc602c9d2c12292dd84babf506c2033cd97893e", [:mix], [], "hexpm", "012bd2eec069ada4db3411f9115ccafa38540a3c78c4c0349f151fc761b9e271"}, "stream_data": {:hex, :stream_data, "0.5.0", "b27641e58941685c75b353577dc602c9d2c12292dd84babf506c2033cd97893e", [:mix], [], "hexpm", "012bd2eec069ada4db3411f9115ccafa38540a3c78c4c0349f151fc761b9e271"},
"surface": {:hex, :surface, "0.7.4", "ce9cf98a11e6572008d82b6dd1dd25fd90966d69cc72a06d69058ef3e7063df8", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.17.4", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:sourceror, "~> 0.9", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "052c2a9a35e260339ec0f9bbc667224993e7e2805c36409736f673ffe7d486ac"}, "surface": {:hex, :surface, "0.7.4", "ce9cf98a11e6572008d82b6dd1dd25fd90966d69cc72a06d69058ef3e7063df8", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.17.4", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:sourceror, "~> 0.9", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "052c2a9a35e260339ec0f9bbc667224993e7e2805c36409736f673ffe7d486ac"},

View file

@ -10,16 +10,15 @@
# We recommend using the bang functions (`insert!`, `update!` # We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong. # and so on) as they will fail if something goes wrong.
AshHq.Docs.Library.create!(%{name: "ash", display_name: "Ash", track_branches: ["main"]}) AshHq.Docs.Library.create!(%{name: "ash", display_name: "Ash"})
AshHq.Docs.Library.create!(%{name: "spark", display_name: "Spark"})
AshHq.Docs.Library.create!(%{ # AshHq.Docs.Library.create!(%{
name: "ash_archival", # name: "ash_archival",
display_name: "AshArchival", # display_name: "AshArchival"
track_branches: ["main"] # })
})
AshHq.Docs.Library.create!(%{ # AshHq.Docs.Library.create!(%{
name: "ash_postgres", # name: "ash_postgres",
display_name: "AshPostgres", # display_name: "AshPostgres"
track_branches: ["main"] # })
})

View file

@ -197,11 +197,10 @@ defmodule Utils do
defp remove_shared_root(_, remaining), do: remaining defp remove_shared_root(_, remaining), do: remaining
defp type({:behaviour, mod}), do: Module.split(mod) |> List.last() defp type({:behaviour, mod}), do: Module.split(mod) |> List.last()
defp type({:ash_behaviour, mod}), do: Module.split(mod) |> List.last() defp type({:spark, mod}), do: Module.split(mod) |> List.last()
defp type({:ash_behaviour, mod, _builtins}), do: Module.split(mod) |> List.last() defp type({:spark_behaviour, mod}), do: Module.split(mod) |> List.last()
defp type({:spark_behaviour, mod, _builtins}), do: Module.split(mod) |> List.last()
defp type({:custom, _, _, _}), do: "any" defp type({:custom, _, _, _}), do: "any"
defp type(:ash_type), do: "Type"
defp type(:ash_resource), do: "Resource"
defp type(:any), do: "any" defp type(:any), do: "any"
defp type(:keyword_list), do: "Keyword List" defp type(:keyword_list), do: "Keyword List"
defp type({:keyword_list, _schema}), do: "Keyword List" defp type({:keyword_list, _schema}), do: "Keyword List"
@ -225,9 +224,11 @@ defmodule Utils do
defp type({:mfa_or_fun, arity}), do: "MFA | function/#{arity}" defp type({:mfa_or_fun, arity}), do: "MFA | function/#{arity}"
defp type(:literal), do: "any literal" defp type(:literal), do: "any literal"
defp type({:tagged_tuple, tag, type}), do: "{:#{tag}, #{type(type)}}" defp type({:tagged_tuple, tag, type}), do: "{:#{tag}, #{type(type)}}"
defp type({:spark_type, type, _}), do: inspect(type)
defp type({:spark_type, type, _, _}), do: inspect(type)
def doc_index?(module) do def doc_index?(module) do
Ash.Helpers.implements_behaviour?(module, Ash.DocIndex) && module.for_library() == Application.get_env(:dsl, :name) Ash.Helpers.implements_behaviour?(module, Spark.DocIndex) && module.for_library() == Application.get_env(:dsl, :name)
end end
end end