Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify some aliases #74

Merged
merged 2 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ macro.
``` elixir
defmodule MyApp.AwesomeFunction do
use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "awesome-fn", name: "Awesome Function"} # The id and name of the function
@trigger %Trigger{event: "func/awesome"} # The event this function will react to
Expand All @@ -81,7 +80,6 @@ look at a more complicated version. Which should provide you an idea what is cap
``` elixir
defmodule MyApp.AwesomeFunction do
use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "awesome-fn", name: "Awesome Function"} # The id and name of the function
@trigger %Trigger{event: "func/awesome"} # The event this function will react to
Expand Down
1 change: 0 additions & 1 deletion docs/references/failure_handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ To handle the error event, you can add a method in your `Inngest.Function` modul
```
defmodule MyApp.Inngest.SomeJob do
use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "my-func", name: "some job"}
@trigger %Trigger{event: "job/foobar"}
Expand Down
7 changes: 3 additions & 4 deletions lib/inngest/function.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
Optional timezone prefix, e.g. `TZ=Europe/Paris 0 12 * * 5`.
"""
alias Inngest.{Config, Trigger}
alias Inngest.Function.{Context, Input, Step}

Check warning on line 57 in lib/inngest/function.ex

View workflow job for this annotation

GitHub Actions / Dialyzer

unused alias Step

Check warning on line 57 in lib/inngest/function.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.14 / OTP 24.3)

unused alias Step

Check warning on line 57 in lib/inngest/function.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.14 / OTP 25.3)

unused alias Step

Check warning on line 57 in lib/inngest/function.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.15 / OTP 24.3)

unused alias Step

Check warning on line 57 in lib/inngest/function.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.15 / OTP 24.3)

unused alias Step

Check warning on line 57 in lib/inngest/function.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.15 / OTP 25.3)

unused alias Step

Check warning on line 57 in lib/inngest/function.ex

View workflow job for this annotation

GitHub Actions / Test (Elixir 1.15 / OTP 25.3)

unused alias Step

@doc """
Returns the function's human-readable ID, such as "sign-up-flow"
Expand All @@ -80,8 +80,7 @@

defmacro __using__(_opts) do
quote location: :keep do
alias Inngest.{Client, Trigger}
alias Inngest.Function.Step
alias Inngest.{Client, FnOpts, Trigger}

Enum.each(
[:func, :trigger],
Expand Down Expand Up @@ -132,7 +131,7 @@
}
],
steps: %{
step: %Step{
step: %Inngest.Function.Step{
id: :step,
name: "step",
runtime: %{
Expand All @@ -156,7 +155,7 @@
name: name(),
triggers: [trigger()],
steps: %{
step: %Step{
step: %Inngest.Function.Step{
id: :step,
name: "step",
runtime: %{
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/batching_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.BatchFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{
id: "batch-fn",
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/cancel_on_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.CancelOnFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{
id: "cancelon-fn",
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/concurrency_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.ConcurrencyFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{
id: "concurrency-fn",
Expand Down
2 changes: 0 additions & 2 deletions test/support/cases/debounce_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.DebounceFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{
id: "debounce-fn",
Expand All @@ -25,7 +24,6 @@ defmodule Inngest.Test.Case.DebounceWithKeyFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{
id: "debounce-fn-with-key",
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/idempotent_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.IdempotentFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{
id: "idempotent-fn",
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/no_step_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.NoStepFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "no-step-fn", name: "No Step Function"}
@trigger %Trigger{event: "test/plug.no-step"}
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/non_retriable_error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.NonRetriableError do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "non-retry-fn", name: "Non Retriable Function"}
@trigger %Trigger{event: "test/plug.no-retry"}
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/rate_limit_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.RateLimitFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{
id: "ratelimit-fn",
Expand Down
2 changes: 1 addition & 1 deletion test/support/cases/retriable_error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Inngest.Test.Case.RetriableError do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger, RetryAfterError}
alias Inngest.RetryAfterError

@func %FnOpts{id: "retriable-fn", name: "Retriable Function", retries: 2}
@trigger %Trigger{event: "test/plug.retriable"}
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/send_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.SendFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "send-fn", name: "Send Function"}
@trigger %Trigger{event: "test/plug.send"}
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/sleep_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.SleepFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "sleep-fn", name: "Sleep Function"}
@trigger %Trigger{event: "test/plug.sleep"}
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/sleep_until_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.SleepUntilFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "sleep-until-fn", name: "Sleep Function"}
@trigger %Trigger{event: "test/plug.sleep_until"}
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/step_fn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.StepFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "step-fn", name: "Step Function"}
@trigger %Trigger{event: "test/plug.step"}
Expand Down
1 change: 0 additions & 1 deletion test/support/cases/wait_for_event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.Test.Case.WaitForEventFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "wait-for-event-fn", name: "Wait for Event Function"}
@trigger %Trigger{event: "test/plug.wait-for-event"}
Expand Down
2 changes: 0 additions & 2 deletions test/support/funcs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Inngest.TestEventFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "test-event", name: "App / Email: Awesome Event Func"}
@trigger %Trigger{event: "my/awesome.event"}
Expand Down Expand Up @@ -91,7 +90,6 @@ defmodule Inngest.TestCronFn do
@moduledoc false

use Inngest.Function
alias Inngest.{FnOpts, Trigger}

@func %FnOpts{id: "test-cron", name: "Awesome Cron Func"}
@trigger %Trigger{cron: "TZ=America/Los_Angeles * * * * *"}
Expand Down
Loading