diff --git a/lib/ash_hq/accounts/resources/user/user.ex b/lib/ash_hq/accounts/resources/user/user.ex index 430d36d..37c27da 100644 --- a/lib/ash_hq/accounts/resources/user/user.ex +++ b/lib/ash_hq/accounts/resources/user/user.ex @@ -215,9 +215,10 @@ defmodule AshHq.Accounts.User do end relationships do - has_one :token, AshHq.Accounts.UserToken, - destination_field: :user_id, - private?: true + has_one :token, AshHq.Accounts.UserToken do + destination_attribute :user_id + private? true + end end resource do diff --git a/lib/ash_hq/docs/extensions/render_markdown/render_markdown.ex b/lib/ash_hq/docs/extensions/render_markdown/render_markdown.ex index 8d383ea..8708ca6 100644 --- a/lib/ash_hq/docs/extensions/render_markdown/render_markdown.ex +++ b/lib/ash_hq/docs/extensions/render_markdown/render_markdown.ex @@ -3,7 +3,7 @@ defmodule AshHq.Docs.Extensions.RenderMarkdown do 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, schema: [ render_attributes: [ @@ -20,16 +20,16 @@ defmodule AshHq.Docs.Extensions.RenderMarkdown do ] } - use Ash.Dsl.Extension, + use Spark.Dsl.Extension, sections: [@render_markdown], transformers: [AshHq.Docs.Extensions.RenderMarkdown.Transformers.AddRenderMarkdownStructure] 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 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 def render!(%resource{} = record, key, on_demand? \\ false) do diff --git a/lib/ash_hq/docs/extensions/render_markdown/transformers/add_render_markdown_structure.ex b/lib/ash_hq/docs/extensions/render_markdown/transformers/add_render_markdown_structure.ex index 26a53e1..80637ba 100644 --- a/lib/ash_hq/docs/extensions/render_markdown/transformers/add_render_markdown_structure.ex +++ b/lib/ash_hq/docs/extensions/render_markdown/transformers/add_render_markdown_structure.ex @@ -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. """ - use Ash.Dsl.Transformer - alias Ash.Dsl.Transformer + use Spark.Dsl.Transformer + alias Spark.Dsl.Transformer - def transform(resource, dsl) do - resource - |> AshHq.Docs.Extensions.RenderMarkdown.render_attributes() + def transform(dsl) do + dsl + |> Transformer.get_option([:render_markdown], :render_attributes, []) |> Enum.reduce({:ok, dsl}, fn {source, destination}, {:ok, dsl} -> {:ok, dsl - |> allow_nil_input(resource, destination) + |> allow_nil_input(destination) |> Transformer.add_entity( [:changes], Transformer.build_entity!(Ash.Resource.Dsl, [:changes], :change, @@ -27,9 +27,9 @@ defmodule AshHq.Docs.Extensions.RenderMarkdown.Transformers.AddRenderMarkdownStr end) end - defp allow_nil_input(dsl, resource, destination) do - resource - |> Ash.Resource.Info.actions() + defp allow_nil_input(dsl, destination) do + dsl + |> Transformer.get_entities([:actions]) |> Enum.filter(&(&1.type == :create)) |> Enum.reduce(dsl, fn action, dsl -> Transformer.replace_entity( diff --git a/lib/ash_hq/docs/extensions/search/search.ex b/lib/ash_hq/docs/extensions/search/search.ex index c8abdd7..7f200e1 100644 --- a/lib/ash_hq/docs/extensions/search/search.ex +++ b/lib/ash_hq/docs/extensions/search/search.ex @@ -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, 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, schema: [ type: [ @@ -63,7 +63,7 @@ defmodule AshHq.Docs.Extensions.Search do ] ] } - use Ash.Dsl.Extension, + use Spark.Dsl.Extension, sections: [@search], transformers: [AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure] diff --git a/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex b/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex index d85fd0e..bfacca4 100644 --- a/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex +++ b/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex @@ -13,22 +13,28 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do * Adds a search action * Adds a code interface for the search action """ - use Ash.Dsl.Transformer + use Spark.Dsl.Transformer import Ash.Filter.TemplateHelpers require Ash.Query - alias Ash.Dsl.Transformer + alias Spark.Dsl.Transformer - def transform(resource, dsl_state) do - name_attribute = AshHq.Docs.Extensions.Search.name_attribute(resource) + def transform(dsl_state) do + 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 = %{ - resource: resource, name_attribute: name_attribute, - doc_attribute: AshHq.Docs.Extensions.Search.doc_attribute(resource), - library_version_attribute: AshHq.Docs.Extensions.Search.library_version_attribute(resource), - table: AshPostgres.table(resource), - sanitized_name_attribute: AshHq.Docs.Extensions.Search.sanitized_name_attribute(resource), - show_docs_on: AshHq.Docs.Extensions.Search.show_docs_on(resource) + doc_attribute: Transformer.get_option(dsl_state, [:search], :doc_attribute), + library_version_attribute: + Transformer.get_option(dsl_state, [:search], :library_version_attribute) || + :library_version_id, + 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, @@ -70,7 +76,10 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do defp add_sanitized_name(dsl_state, config) do 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 else Transformer.add_entity( @@ -87,7 +96,7 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do ) 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( dsl_state, [:changes], @@ -96,7 +105,7 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do {AshHq.Docs.Extensions.Search.Changes.SanitizeName, source: config.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 diff --git a/lib/ash_hq/docs/extensions/search/types.ex b/lib/ash_hq/docs/extensions/search/types.ex index 4977e16..85ee079 100644 --- a/lib/ash_hq/docs/extensions/search/types.ex +++ b/lib/ash_hq/docs/extensions/search/types.ex @@ -4,10 +4,8 @@ defmodule AshHq.Docs.Extensions.Search.Types do """ @search_types AshHq.Docs.Registry - |> Ash.Registry.entries() - |> Enum.filter( - &(AshHq.Docs.Extensions.Search in Ash.Resource.Info.extensions(&1)) - ) + |> Ash.Registry.Info.entries() + |> Enum.filter(&(AshHq.Docs.Extensions.Search in Spark.extensions(&1))) |> Enum.map(&AshHq.Docs.Extensions.Search.type/1) |> Enum.uniq() diff --git a/lib/ash_hq/docs/resources/library/library.ex b/lib/ash_hq/docs/resources/library/library.ex index 1632ab2..a50b226 100644 --- a/lib/ash_hq/docs/resources/library/library.ex +++ b/lib/ash_hq/docs/resources/library/library.ex @@ -42,16 +42,11 @@ defmodule AshHq.Docs.Library do attribute :display_name, :string do allow_nil? false end - - attribute :track_branches, {:array, :string} do - default [] - end end aggregates do first :latest_version, :versions, :version do sort version: :desc - filter expr(contains(version, ".")) end end diff --git a/lib/ash_hq/docs/resources/library_version/library_version.ex b/lib/ash_hq/docs/resources/library_version/library_version.ex index 4dbc4d4..a07e9bf 100644 --- a/lib/ash_hq/docs/resources/library_version/library_version.ex +++ b/lib/ash_hq/docs/resources/library_version/library_version.ex @@ -107,11 +107,6 @@ defmodule AshHq.Docs.LibraryVersion do allow_nil? false end - attribute :branch, :boolean do - allow_nil? false - default false - end - attribute :default_guide, :string end diff --git a/lib/ash_hq_web/components/doc_sidebar.ex b/lib/ash_hq_web/components/doc_sidebar.ex index bac8107..0340e93 100644 --- a/lib/ash_hq_web/components/doc_sidebar.ex +++ b/lib/ash_hq_web/components/doc_sidebar.ex @@ -153,7 +153,7 @@ defmodule AshHqWeb.Components.DocSidebar do libraries |> Enum.flat_map(fn library -> library.versions - |> Enum.find(&Ash.Resource.Info.loaded?(&1, :modules)) + |> Enum.find(&Ash.Resource.loaded?(&1, :modules)) |> case do nil -> [] @@ -256,7 +256,7 @@ defmodule AshHqWeb.Components.DocSidebar do libraries |> Enum.flat_map(fn library -> library.versions - |> Enum.find(&Ash.Resource.Info.loaded?(&1, :guides)) + |> Enum.find(&Ash.Resource.loaded?(&1, :guides)) |> case do nil -> [] @@ -277,7 +277,7 @@ defmodule AshHqWeb.Components.DocSidebar do defp get_extensions(libraries) do Enum.flat_map(libraries, fn library -> library.versions - |> Enum.find(&Ash.Resource.Info.loaded?(&1, :extensions)) + |> Enum.find(&Ash.Resource.loaded?(&1, :extensions)) |> case do nil -> [] diff --git a/lib/ash_hq_web/components/search.ex b/lib/ash_hq_web/components/search.ex index 74de65e..ba85e6c 100644 --- a/lib/ash_hq_web/components/search.ex +++ b/lib/ash_hq_web/components/search.ex @@ -43,7 +43,6 @@ defmodule AshHqWeb.Components.Search do
- !version.branch - end) || Enum.at(library.versions, 0) + Enum.at(library.versions, 0) end end diff --git a/lib/ash_hq_web/pages/docs.ex b/lib/ash_hq_web/pages/docs.ex index 5dbd328..24076c5 100644 --- a/lib/ash_hq_web/pages/docs.ex +++ b/lib/ash_hq_web/pages/docs.ex @@ -407,10 +407,11 @@ defmodule AshHqWeb.Pages.Docs do end 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 "{{mix_dep:" <> library = String.trim_trailing(text, "}}") - render_mix_dep(assigns, library, text) + + "
#{render_mix_dep(assigns, library, text)}
" rescue e -> Logger.error("Invalid link #{inspect(e)}") @@ -439,16 +440,12 @@ defmodule AshHqWeb.Pages.Docs do end end - if version.branch do - ~s({:#{library.name}, github: "ash-project/#{library.name}", branch: "#{version}"}) - else - case Version.parse(version) do - {:ok, %{major: major, minor: minor, patch: 0}} -> - ~s({:#{library.name}, "~> #{major}.#{minor}"}) + case Version.parse(version.version) do + {:ok, %{major: major, minor: minor, patch: 0}} -> + ~s({:#{library.name}, "~> #{major}.#{minor}"}) - {:ok, version} -> - ~s({:#{library.name}, "~> #{version}"}) - end + {:ok, version} -> + ~s({:#{library.name}, "~> #{version}"}) end end @@ -456,8 +453,8 @@ defmodule AshHqWeb.Pages.Docs do String.replace(docs, ~r/(?!){{link:.*}}(?!<\/code>)/, fn text -> try do "{{link:" <> rest = String.trim_trailing(text, "}}") - [library, type, item] = String.split(rest, ":") - render_link(assigns, library, type, item, text) + [library, type, item | rest] = String.split(rest, ":") + render_link(assigns, library, type, item, text, rest) rescue e -> Logger.error("Invalid link #{inspect(e)}") @@ -466,7 +463,7 @@ defmodule AshHqWeb.Pages.Docs do end) end - defp render_link(assigns, library, type, item, source) do + defp render_link(assigns, library, type, item, source, rest) do library = Enum.find(assigns[:libraries], &(&1.name == library)) || raise "No such library in link: #{source}" @@ -496,8 +493,10 @@ defmodule AshHqWeb.Pages.Docs do Enum.find(version.guides, &(&1.name == item)) || raise "No such guide in link: #{source}" + text = Enum.at(rest, 0) || item + """ - #{item} + #{text} """ "dsl" -> @@ -507,17 +506,17 @@ defmodule AshHqWeb.Pages.Docs do |> Enum.join(".") """ - #{name} + #{name} """ "module" -> """ - #{item} + #{item} """ "extension" -> """ - #{item} + #{item} """ type -> diff --git a/lib/ash_hq_web/views/app_view_live.ex b/lib/ash_hq_web/views/app_view_live.ex index ff65178..9b3d581 100644 --- a/lib/ash_hq_web/views/app_view_live.ex +++ b/lib/ash_hq_web/views/app_view_live.ex @@ -10,24 +10,24 @@ defmodule AshHqWeb.AppViewLive do alias Surface.Components.{Link, LiveRedirect} require Ash.Query - data configured_theme, :string, default: :system - data searching, :boolean, default: false - data selected_versions, :map, default: %{} - data libraries, :list, default: [] - data selected_types, :map, default: %{} - data sidebar_state, :map, default: %{} - data current_user, :map + data(configured_theme, :string, default: :system) + data(searching, :boolean, default: false) + data(selected_versions, :map, default: %{}) + data(libraries, :list, default: []) + data(selected_types, :map, default: %{}) + data(sidebar_state, :map, default: %{}) + data(current_user, :map) - data library, :any, default: nil - data extension, :any, default: nil - data docs, :any, default: nil - data library_version, :any, default: nil - data guide, :any, default: nil - data doc_path, :list, default: [] - data dsls, :list, default: [] - data dsl, :any, default: nil - data options, :list, default: [] - data module, :any, default: nil + data(library, :any, default: nil) + data(extension, :any, default: nil) + data(docs, :any, default: nil) + data(library_version, :any, default: nil) + data(guide, :any, default: nil) + data(doc_path, :list, default: []) + data(dsls, :list, default: []) + data(dsl, :any, default: nil) + data(options, :list, default: []) + data(module, :any, default: nil) def render(assigns) do ~F""" @@ -70,13 +70,13 @@ defmodule AshHqWeb.AppViewLive do {/if}
Quick Start + >Get Started
|
Docs @@ -444,19 +444,8 @@ defmodule AshHqWeb.AppViewLive do libraries = AshHq.Docs.Library.read!(load: [versions: versions_query]) selected_versions = - Enum.reduce(libraries, %{}, fn library, acc -> - # for now we only assume that ash will always appear in the docs - 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 + Enum.reduce(libraries, configured_library_versions, fn library, acc -> + Map.put_new(acc, library.id, "latest") end) {:ok, @@ -470,7 +459,7 @@ defmodule AshHqWeb.AppViewLive do :selected_types, selected_types ) - |> assign(:selected_versions, configured_library_versions) + |> assign(:selected_versions, selected_versions) |> assign(configured_theme: configured_theme, sidebar_state: sidebar_state) |> push_event("selected-versions", selected_versions) |> push_event("selected_types", %{types: selected_types})} @@ -685,7 +674,7 @@ defmodule AshHqWeb.AppViewLive do version -> Enum.find( library.versions, - &(&1.sanitized_version == version) + &(&1.version == version) ) end @@ -696,9 +685,10 @@ defmodule AshHqWeb.AppViewLive do library_version: library_version ) - if !socket.assigns[:library] || - socket.assigns.params["library"] != - socket.assigns.library.name do + if socket.assigns.params["version"] != "latest" && + (!socket.assigns[:library] || + socket.assigns.params["library"] != + socket.assigns.library.name) do new_selected_versions = Map.put(socket.assigns.selected_versions, library.id, library_version.id) diff --git a/mix.exs b/mix.exs index 91a09f0..f3e57f3 100644 --- a/mix.exs +++ b/mix.exs @@ -34,13 +34,14 @@ defmodule AshHq.MixProject do defp deps do [ # {: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_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_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]}, + {:spark, path: "../spark", override: true}, {:earmark, "~> 1.5.0-pre1", override: true}, {:surface, "~> 0.7.3"}, {:surface_heroicons, "~> 0.6.0"}, diff --git a/mix.lock b/mix.lock index da8ec2f..8077732 100644 --- a/mix.lock +++ b/mix.lock @@ -1,7 +1,7 @@ %{ - "ash": {:git, "https://github.com/ash-project/ash.git", "c21c5e6ae74877827f8ad93619efecd54112dba3", []}, - "ash_phoenix": {:git, "https://github.com/ash-project/ash_phoenix.git", "f5390fb8dd44399b14e4027a2f97ea70a07e62ed", []}, - "ash_postgres": {:git, "https://github.com/ash-project/ash_postgres.git", "b561c4f8d4216ae57503d2f320bcc67d64a29d63", []}, + "ash": {:git, "https://github.com/ash-project/ash.git", "f91c26f093bb3a9561ef93e84cc24b2dad0e231b", [branch: "2.0"]}, + "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", "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"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "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"}, "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"}, + "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_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"}, @@ -76,7 +77,8 @@ "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"}, "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"}, "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"}, diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs index 08cf089..7c6139e 100644 --- a/priv/repo/seeds.exs +++ b/priv/repo/seeds.exs @@ -10,16 +10,15 @@ # We recommend using the bang functions (`insert!`, `update!` # 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!(%{ - name: "ash_archival", - display_name: "AshArchival", - track_branches: ["main"] -}) +# AshHq.Docs.Library.create!(%{ +# name: "ash_archival", +# display_name: "AshArchival" +# }) -AshHq.Docs.Library.create!(%{ - name: "ash_postgres", - display_name: "AshPostgres", - track_branches: ["main"] -}) +# AshHq.Docs.Library.create!(%{ +# name: "ash_postgres", +# display_name: "AshPostgres" +# }) diff --git a/priv/scripts/build_dsl_docs.exs b/priv/scripts/build_dsl_docs.exs index 91e4a68..474d4cb 100644 --- a/priv/scripts/build_dsl_docs.exs +++ b/priv/scripts/build_dsl_docs.exs @@ -197,11 +197,10 @@ defmodule Utils do defp remove_shared_root(_, remaining), do: remaining defp type({:behaviour, mod}), do: Module.split(mod) |> List.last() - defp type({:ash_behaviour, mod}), do: Module.split(mod) |> List.last() - defp type({:ash_behaviour, mod, _builtins}), do: Module.split(mod) |> List.last() + defp type({:spark, mod}), 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(:ash_type), do: "Type" - defp type(:ash_resource), do: "Resource" defp type(:any), do: "any" defp type(:keyword_list), 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(:literal), do: "any literal" 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 - 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