Skip to content

Commit

Permalink
hide irrelevant information from users
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin67 committed Nov 28, 2023
1 parent c37cc76 commit d997476
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 56 deletions.
10 changes: 4 additions & 6 deletions lib/inngest/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ defmodule Inngest.Client do
end
end

@doc """
Retrieves the registration information from the Dev server.
"""
# Retrieves the registration information from the Dev server.
@doc false
def dev_info() do
client = httpclient(:inngest)

Expand All @@ -51,9 +50,8 @@ defmodule Inngest.Client do
end
end

@doc """
Returns an HTTP client for making requests against Inngest.
"""
# Returns an HTTP client for making requests against Inngest.
@doc false
@spec httpclient(atom(), Keyword.t()) :: Tesla.Client.t()
def httpclient(type, opts \\ [])

Expand Down
12 changes: 6 additions & 6 deletions lib/inngest/config.ex
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
defmodule Inngest.Config do
@moduledoc """
Configuration settings for Inngest. Order of configuration to be read:
@moduledoc false

# Configuration settings for Inngest. Order of configuration to be read:
# 1. Environment variables
# 2. Application configs
# 3. Default values

1. Environment variables
2. Application configs
3. Default values
"""
@event_url "https://inn.gs"
@inngest_url "https://app.inngest.com"
@api_url "https://api.inngest.com"
Expand Down
19 changes: 6 additions & 13 deletions lib/inngest/event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,27 @@ defmodule Inngest.Event do
id: "",
name: "event/awesome",
data: { "hello": "world" },
user: { "external_id": 10000 },
ts: 1690156151,
v: "2023.04.14.1"
}
#### `id` - string (optional)
#### id - `string` optional
The `id` field in an event payload is used for deduplication. Setting this field will make sure that only one of the events (the first one) with a similar `id` is processed.
#### `name` - string (required)
#### name - `string` required
The name of the event. We recommend using lowercase dot notation for names, prepending `<prefixes>/` with a slash for organization.
#### `data` - map (required)
#### data - `map` required
Any data to associate with the event. Will be serialized as JSON.
#### `user` - map (optional)
Any relevant user identifying data or attributes associated with the event. **This data is encrypted at rest**. Use the `external_id` as the identifier. A common example is the `user_id` in your system.
#### `ts` - integer (optional)
#### ts - `integer` optional
A timestamp integer representing the unix time (in milliseconds) at which the event occurred. Defaults to the time the Inngest receives the event if not provided.
#### `v` - string (optional)
#### v - `string` optional
A version identifier for a particular event payload. e.g. `2023-04-14.1`
"""
Expand All @@ -46,15 +41,13 @@ defmodule Inngest.Event do
:ts,
:datetime,
:v,
id: "",
user: %{}
id: ""
]

@type t() :: %__MODULE__{
id: binary() | nil,
name: binary(),
data: any(),
user: map() | nil,
v: binary() | nil,
ts: number() | nil,
datetime: DateTime.t() | nil
Expand Down
23 changes: 8 additions & 15 deletions lib/inngest/function.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,13 @@ defmodule Inngest.Function do
## Function Options
The `Inngest.FnOpts` accepts the following attributes.
#### `id` - `string` (required)
A unique identifier for your function to override the default name.
Also known in technical terms, a `slug`.
#### `name` - `string` (required)
A unique name for your function. This will be used to create a unique
slug id by default if `id` is not provided.
Assign `Inngest.FnOpts` to `@func` to configure the function. See `Inngest.FnOpts`
to see what options are available.
## Trigger
A trigger is exactly what the name says. It's the thing that triggers a function
to run. One of the following is required, and they're mutually exclusive.
A trigger is causes a function to run. One of the following is required, and
they're mutually exclusive.
#### `event` - `string` and/or `expression` - `string`
Expand Down Expand Up @@ -72,7 +62,9 @@ defmodule Inngest.Function do
@callback trigger() :: Trigger.t()

@doc """
The method to be called when the Inngest function starts execution
The method to be called when the Inngest function starts execution.
Only this method needs to be provided.
"""
@callback exec(Context.t(), Input.t()) :: {:ok, any()} | {:error, any()}

Expand Down Expand Up @@ -215,6 +207,7 @@ defmodule Inngest.Function do
end
end

@doc false
@spec validate_datetime(any()) :: {:ok, binary()} | {:error, binary()}
def validate_datetime(%DateTime{} = datetime),
do: Timex.format(datetime, "{YYYY}-{0M}-{0D}T{h24}:{m}:{s}Z")
Expand Down
7 changes: 6 additions & 1 deletion lib/inngest/function/config.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
defmodule Inngest.FnOpts do
@moduledoc """
Function configuration options
Function configuration options.
See the typespec for all available options.
"""

defstruct [
Expand Down Expand Up @@ -124,6 +126,9 @@ defmodule Inngest.FnOpts do
* Rate limit per customer id: `event.data.customer_id`
* Rate limit per account and email address: `event.data.account_id + "-" + event.user.email`
### Note
This option cannot be used with `cancel_on` and `rate_limit`.
"""
@type rate_limit() ::
%{
Expand Down
4 changes: 1 addition & 3 deletions lib/inngest/function/step.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
defmodule Inngest.Function.Step do
@moduledoc """
A struct representing a function step
"""
@moduledoc false

@derive Jason.Encoder
defstruct [
Expand Down
4 changes: 1 addition & 3 deletions lib/inngest/headers.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
defmodule Inngest.Headers do
@moduledoc """
Header values used by the SDK
"""
@moduledoc false

def env, do: "x-inngest-env"
# def framework, do: "x-inngest-framework"
Expand Down
4 changes: 1 addition & 3 deletions lib/inngest/response.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
defmodule Inngest.SdkResponse do
@moduledoc """
Represents an SDK response to the executor when ran
"""
@moduledoc false

defstruct [
:status,
Expand Down
4 changes: 1 addition & 3 deletions lib/inngest/util.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
defmodule Inngest.Util do
@moduledoc """
Utility functions
"""
@moduledoc false

@doc """
Parse string duration that Inngest understands into seconds
Expand Down
3 changes: 0 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ defmodule Inngest.MixProject do
Inngest.Router.Plug,
Inngest.Signature
],
Config: [
Inngest.Config
],
Helper: [
Inngest.CacheBodyReader
]
Expand Down

0 comments on commit d997476

Please sign in to comment.