Skip to content

Commit

Permalink
add slug and mod as backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin67 committed Nov 3, 2023
1 parent 6c86295 commit 0943ff5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
20 changes: 11 additions & 9 deletions lib/inngest/router/register.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ defmodule Inngest.Router.Register do
defp register(path, functions, opts) do
framework = Keyword.get(opts, :framework)

payload = %{
url: Config.app_host() <> path,
v: "1",
deployType: "ping",
sdk: Config.sdk_version(),
framework: framework,
appName: Config.app_name(),
functions: functions |> Enum.map(fn {_, v} -> v.mod.serve(path) end)
}
payload =
%{
url: Config.app_host() <> path,
v: "1",
deployType: "ping",
sdk: Config.sdk_version(),
framework: framework,
appName: Config.app_name(),
functions: functions |> Enum.map(fn {_, v} -> v.mod.serve(path) end)
}
|> IO.inspect()

Check warning on line 60 in lib/inngest/router/register.ex

View workflow job for this annotation

GitHub Actions / Linter

There should be no calls to IO.inspect/1.

key = Inngest.Signature.hashed_signing_key(Config.signing_key())
headers = if is_nil(key), do: [], else: [authorization: "Bearer " <> key]
Expand Down
8 changes: 7 additions & 1 deletion lib/inngest/v1/function.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ defmodule Inngest.V1.Function do

@callback id() :: binary()

@callback slug() :: binary()

@callback name() :: binary()

@callback trigger() :: Trigger.t()
Expand All @@ -28,6 +30,9 @@ defmodule Inngest.V1.Function do
|> Map.get(:id)
end

@impl true
def slug(), do: id()

@impl true
def name() do
case __MODULE__.__info__(:attributes)
Expand Down Expand Up @@ -63,7 +68,8 @@ defmodule Inngest.V1.Function do
id: id(),
name: name(),
triggers: [trigger()],
steps: step(path)
steps: step(path),
mod: __MODULE__
}
end
end
Expand Down

0 comments on commit 0943ff5

Please sign in to comment.