Skip to content

Commit

Permalink
renamed the project
Browse files Browse the repository at this point in the history
  • Loading branch information
trbngr committed Feb 24, 2022
1 parent 06c29a0 commit 96cfefc
Show file tree
Hide file tree
Showing 30 changed files with 84 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ locals_without_parens = [
[
locals_without_parens: locals_without_parens,
line_length: 120,
import_deps: [:absinthe, :cqrs_tools, :ecto],
import_deps: [:absinthe, :blunt, :ecto],
export: [
locals_without_parens: locals_without_parens
],
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ erl_crash.dump
*.ez

# Ignore package tarball (built via "mix hex.build").
cqrs_absinthe-*.tar
blunt_absinthe-*.tar

# Temporary files, for example, from tests.
/tmp/
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# CqrsAbsinthe
# BluntAbsinthe

**TODO: Add description**

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `cqrs_absinthe` to your list of dependencies in `mix.exs`:
by adding `blunt_absinthe` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:cqrs_tools_absinthe, "~> 0.1.0"}
{:blunt_absinthe, "~> 0.1.0"}
]
end
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at <https://hexdocs.pm/cqrs_absinthe>.
be found at <https://hexdocs.pm/blunt_absinthe>.

2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Config

config :cqrs_tools, :context_shipper, Cqrs.Absinthe.Test.DispatchContextShipper
config :blunt, :context_shipper, Blunt.Absinthe.Test.DispatchContextShipper

config :logger, :console, format: "[$level] $message\n", level: :warning
10 changes: 5 additions & 5 deletions lib/cqrs/absinthe.ex → lib/blunt/absinthe.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Cqrs.Absinthe do
alias Cqrs.Absinthe.{Message, Mutation, Query}
alias Cqrs.Absinthe.Enum, as: AbsintheEnum
defmodule Blunt.Absinthe do
alias Blunt.Absinthe.{Message, Mutation, Query}
alias Blunt.Absinthe.Enum, as: AbsintheEnum

defmodule Error do
defexception [:message]
Expand All @@ -12,9 +12,9 @@ defmodule Cqrs.Absinthe do
Module.register_attribute(__MODULE__, :mutations, accumulate: true)

# use Absinthe.Schema
import Cqrs.Absinthe, only: :macros
import Blunt.Absinthe, only: :macros

@after_compile Cqrs.Absinthe
@after_compile Blunt.Absinthe
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Cqrs.Absinthe.AbsintheErrors do
alias Cqrs.DispatchContext
defmodule Blunt.Absinthe.AbsintheErrors do
alias Blunt.DispatchContext

@type context :: Cqrs.DispatchContext.t()
@type context :: Blunt.DispatchContext.t()

@spec from_dispatch_context(context()) :: list

Expand Down
6 changes: 3 additions & 3 deletions lib/cqrs/absinthe/args.ex → lib/blunt/absinthe/args.ex
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
defmodule Cqrs.Absinthe.Args do
defmodule Blunt.Absinthe.Args do
@moduledoc false

# TODO: Document parent_mappings and arg_transforms

alias Cqrs.Message.Metadata
alias Cqrs.Absinthe.{Log, Type}
alias Blunt.Message.Metadata
alias Blunt.Absinthe.{Log, Type}

@type message_module :: atom()
@spec from_message_fields(message_module, keyword) :: list
Expand Down
4 changes: 2 additions & 2 deletions lib/cqrs/absinthe/enum.ex → lib/blunt/absinthe/enum.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Cqrs.Absinthe.Enum do
alias Cqrs.Absinthe.Error
defmodule Blunt.Absinthe.Enum do
alias Blunt.Absinthe.Error

def generate_type(enum_name, {enum_source_module, field_name}) do
values =
Expand Down
8 changes: 4 additions & 4 deletions lib/cqrs/absinthe/field.ex → lib/blunt/absinthe/field.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Cqrs.Absinthe.Field do
alias Cqrs.DispatchContext, as: Context
alias Cqrs.Absinthe.{AbsintheErrors, Args, Field, Log, Middleware}
defmodule Blunt.Absinthe.Field do
alias Blunt.DispatchContext, as: Context
alias Blunt.Absinthe.{AbsintheErrors, Args, Field, Log, Middleware}

@type message_module :: atom()

Expand Down Expand Up @@ -31,7 +31,7 @@ defmodule Cqrs.Absinthe.Field do
description = description(message_module)
{before_resolve, after_resolve} = middleware(opts)

Cqrs.Message.Compilation.log(message_module, "regenerated #{operation} #{field_name}")
Blunt.Message.Compilation.log(message_module, "regenerated #{operation} #{field_name}")

quote do
unquote_splicing(args)
Expand Down
8 changes: 4 additions & 4 deletions lib/cqrs/absinthe/log.ex → lib/blunt/absinthe/log.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Cqrs.Absinthe.Log do
defmodule Blunt.Absinthe.Log do
@spec debug(any) :: any()
@spec warning(any) :: any()
@spec error(any) :: any()
Expand All @@ -10,9 +10,9 @@ defmodule Cqrs.Absinthe.Log do
def info(entry), do: put({:info, entry})

defp put({level, entry}) do
logs = Process.get(:cqrs_logs, [])
logs = Process.get(:blunt_logs, [])
logs = [%{level: level, date: DateTime.utc_now(), message: entry} | logs]
Process.put(:cqrs_logs, logs)
Process.put(:blunt_logs, logs)
entry
end

Expand All @@ -21,7 +21,7 @@ defmodule Cqrs.Absinthe.Log do
@spec dump :: :ok

def dump do
:cqrs_logs
:blunt_logs
|> Process.get([])
|> Enum.sort_by(& &1.date)
|> Enum.each(fn %{level: level, message: message} ->
Expand Down
10 changes: 5 additions & 5 deletions lib/cqrs/absinthe/message.ex → lib/blunt/absinthe/message.ex
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
defmodule Cqrs.Absinthe.Message do
defmodule Blunt.Absinthe.Message do
@moduledoc false

alias Cqrs.Absinthe.Error
alias Cqrs.Message.Metadata
alias Blunt.Absinthe.Error
alias Blunt.Message.Metadata

def validate!(:command, module) do
error = "#{inspect(module)} is not a valid #{inspect(Cqrs.Command)}"
error = "#{inspect(module)} is not a valid #{inspect(Blunt.Command)}"
do_validate!(module, :command, error)
end

def validate!(:query, module) do
error = "#{inspect(module)} is not a valid #{inspect(Cqrs.Query)}"
error = "#{inspect(module)} is not a valid #{inspect(Blunt.Query)}"
do_validate!(module, :query, error)
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Cqrs.Absinthe.Middleware do
alias Cqrs.Absinthe.Middleware
defmodule Blunt.Absinthe.Middleware do
alias Blunt.Absinthe.Middleware

def middleware(opts) do
before_resolve = Keyword.get(opts, :before_resolve, &Middleware.identity/2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Cqrs.Absinthe.Mutation do
defmodule Blunt.Absinthe.Mutation do
@moduledoc false

alias Cqrs.Absinthe.Field
alias Blunt.Absinthe.Field

@spec generate_field(atom, any, keyword) :: {:field, [], [...]}
def generate_field(command_module, return_type, opts) do
Expand Down
4 changes: 2 additions & 2 deletions lib/cqrs/absinthe/query.ex → lib/blunt/absinthe/query.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Cqrs.Absinthe.Query do
defmodule Blunt.Absinthe.Query do
@moduledoc false

alias Cqrs.Absinthe.Field
alias Blunt.Absinthe.Field

@spec generate_field(atom, any, keyword) :: {:field, [], [...]}
def generate_field(query_module, return_type, opts) do
Expand Down
8 changes: 4 additions & 4 deletions lib/cqrs/absinthe/type.ex → lib/blunt/absinthe/type.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Cqrs.Absinthe.Type do
defmodule Blunt.Absinthe.Type do
@moduledoc false

def from_message_field(message_module, {name, :map, _field_opts}, opts) do
Expand All @@ -10,7 +10,7 @@ defmodule Cqrs.Absinthe.Type do

option_configured_type_mapping(name, opts) ||
app_configured_type_mapping(:map) ||
raise Cqrs.Absinthe.Error, message: error_message
raise Blunt.Absinthe.Error, message: error_message
end

def from_message_field(message_module, {name, {:array, type}, _field_opts}, opts) do
Expand All @@ -29,7 +29,7 @@ defmodule Cqrs.Absinthe.Type do
error_message =
"#{operation} field '#{field_name}' -- from module '#{inspect(message_module)}' -- requires an arg_types mapping for the argument '#{name}'"

enum_type = option_configured_type_mapping(name, opts) || raise Cqrs.Absinthe.Error, message: error_message
enum_type = option_configured_type_mapping(name, opts) || raise Blunt.Absinthe.Error, message: error_message

quote do: unquote(enum_type)
end
Expand All @@ -47,7 +47,7 @@ defmodule Cqrs.Absinthe.Type do
end

defp app_configured_type_mapping(type) do
:cqrs_tools
:blunt
|> Application.get_env(:absinthe, [])
|> Keyword.get(:type_mappings, [])
|> Keyword.get(type)
Expand Down
14 changes: 7 additions & 7 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
defmodule CqrsAbsinthe.MixProject do
defmodule BluntAbsinthe.MixProject do
use Mix.Project

def project do
[
app: :cqrs_tools_absinthe,
app: :blunt_absinthe,
version: "0.1.0",
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
deps: deps(),
source_url: "https://github.com/elixir-cqrs/cqrs_tools_absinthe",
source_url: "https://github.com/elixir-blunt/blunt_absinthe",
package: [
description: "Absinthe macros for `cqrs_tools` commands and queries",
description: "Absinthe macros for `blunt` commands and queries",
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/elixir-cqrs/cqrs_tools_absinthe"}
links: %{"GitHub" => "https://github.com/elixir-blunt/blunt_absinthe"}
],
elixirc_paths: elixirc_paths(Mix.env())
]
Expand All @@ -32,8 +32,8 @@ defmodule CqrsAbsinthe.MixProject do
defp deps do
[
{:absinthe, "~> 1.7"},
# {:cqrs_tools, path: "../cqrs_tools", override: true},
{:cqrs_tools, github: "elixir-cqrs/cqrs_tools"},
# {:blunt, path: "../blunt", override: true},
{:blunt, github: "blunt-elixir/blunt"},
#
# test and dev deps
{:etso, "~> 0.1.6", only: [:test]},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%{
"absinthe": {:hex, :absinthe, "1.7.0", "36819e7b1fd5046c9c734f27fe7e564aed3bda59f0354c37cd2df88fd32dd014", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0 or ~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "566a5b5519afc9b29c4d367f0c6768162de3ec03e9bf9916f9dc2bcbe7c09643"},
"cqrs_tools": {:git, "https://github.com/elixir-cqrs/cqrs_tools.git", "eed3664ce519f45afffc384a426e9503b650b7f1", []},
"blunt": {:git, "https://github.com/blunt-elixir/blunt.git", "2394f8bcb3d27911535c72808fe47191b35b3e4d", []},
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
"ecto": {:hex, :ecto, "3.7.1", "a20598862351b29f80f285b21ec5297da1181c0442687f9b8329f0445d228892", [:mix], [{:decimal, "~> 1.6 or ~> 2.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", "d36e5b39fc479e654cffd4dbe1865d9716e4a9b6311faff799b6f90ab81b8638"},
Expand Down
4 changes: 2 additions & 2 deletions test/cqrs/absinthe/enum_test.exs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule Cqrs.Absinthe.EnumTest do
defmodule Blunt.Absinthe.EnumTest do
use ExUnit.Case, async: true

alias Absinthe.Type.Enum
alias Cqrs.Absinthe.Test.Schema
alias Blunt.Absinthe.Test.Schema

test "enum is defined" do
assert %Enum{values: values} = Absinthe.Schema.lookup_type(Schema, :gender)
Expand Down
4 changes: 2 additions & 2 deletions test/cqrs/absinthe/mutation_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Cqrs.Absinthe.MutationTest do
defmodule Blunt.Absinthe.MutationTest do
use ExUnit.Case
alias Cqrs.Absinthe.Test.Schema
alias Blunt.Absinthe.Test.Schema

setup do
%{
Expand Down
8 changes: 4 additions & 4 deletions test/cqrs/absinthe/query_test.exs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
defmodule Cqrs.Absinthe.QueryTest do
defmodule Blunt.Absinthe.QueryTest do
use ExUnit.Case

alias Cqrs.Repo
alias Cqrs.Absinthe.Test.Schema
alias Cqrs.Absinthe.Test.ReadModel.Person
alias Blunt.Repo
alias Blunt.Absinthe.Test.Schema
alias Blunt.Absinthe.Test.ReadModel.Person

defp create_person(name) do
%{id: UUID.uuid4(), name: name}
Expand Down
6 changes: 3 additions & 3 deletions test/support/create_person.ex
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
defmodule Cqrs.Absinthe.Test.CreatePerson do
defmodule Blunt.Absinthe.Test.CreatePerson do
@moduledoc """
Creates's a person.
"""

use Cqrs.Command
alias Cqrs.Absinthe.Test.ReadModel.Person
use Blunt.Command
alias Blunt.Absinthe.Test.ReadModel.Person

field :name, :string
field :gender, :enum, values: Person.genders(), default: :not_sure
Expand Down
8 changes: 4 additions & 4 deletions test/support/create_person_pipeline.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule Cqrs.Absinthe.Test.CreatePersonPipeline do
use Cqrs.CommandPipeline
defmodule Blunt.Absinthe.Test.CreatePersonPipeline do
use Blunt.CommandPipeline

alias Cqrs.Repo
alias Cqrs.Absinthe.Test.ReadModel.Person
alias Blunt.Repo
alias Blunt.Absinthe.Test.ReadModel.Person

@impl true
def handle_dispatch(command, _context) do
Expand Down
4 changes: 2 additions & 2 deletions test/support/dispatch_context_shipper.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Cqrs.Absinthe.Test.DispatchContextShipper do
@behaviour Cqrs.DispatchContext.Shipper
defmodule Blunt.Absinthe.Test.DispatchContextShipper do
@behaviour Blunt.DispatchContext.Shipper

def ship(context) do
case System.get_env("CQRS_ABSINTHE_DEBUG") do
Expand Down
6 changes: 3 additions & 3 deletions test/support/get_person.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Cqrs.Absinthe.Test.GetPerson do
use Cqrs.Query
defmodule Blunt.Absinthe.Test.GetPerson do
use Blunt.Query

@moduledoc """
Get's a person.
Expand All @@ -9,5 +9,5 @@ defmodule Cqrs.Absinthe.Test.GetPerson do

field :error_out, :boolean, default: false

binding :person, CqrsToolsBoundedContext.QueryTest.ReadModel.Person
binding :person, BluntBoundedContext.QueryTest.ReadModel.Person
end
8 changes: 4 additions & 4 deletions test/support/get_person_pipeline.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule Cqrs.Absinthe.Test.GetPersonPipeline do
use Cqrs.QueryPipeline
defmodule Blunt.Absinthe.Test.GetPersonPipeline do
use Blunt.QueryPipeline

alias Cqrs.Repo
alias Cqrs.Absinthe.Test.ReadModel.Person
alias Blunt.Repo
alias Blunt.Absinthe.Test.ReadModel.Person

@impl true
def create_query(filters, _context) do
Expand Down
2 changes: 1 addition & 1 deletion test/support/read_model.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Cqrs.Absinthe.Test.ReadModel do
defmodule Blunt.Absinthe.Test.ReadModel do
defmodule Person do
use Ecto.Schema

Expand Down
4 changes: 2 additions & 2 deletions test/support/repo.ex
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
defmodule Cqrs.Repo do
use Ecto.Repo, otp_app: :cqrs_tools_bounded_context, adapter: Etso.Adapter
defmodule Blunt.Repo do
use Ecto.Repo, otp_app: :blunt_bounded_context, adapter: Etso.Adapter
end
4 changes: 2 additions & 2 deletions test/support/schema.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Cqrs.Absinthe.Test.Schema do
defmodule Blunt.Absinthe.Test.Schema do
use Absinthe.Schema
import_types Cqrs.Absinthe.Test.SchemaTypes
import_types Blunt.Absinthe.Test.SchemaTypes

query do
import_fields :person_queries
Expand Down
Loading

0 comments on commit 96cfefc

Please sign in to comment.