View Source API Reference ash v2.15.17
Modules
General purpose tools for working with Ash.
Input for a custom action
Execute a read action.
Generates a fake result, as the flow has to actually return something.
An Api allows you to interact with your resources, and holds non-resource-specific configuration.
Apis are the entrypoints for working with your resources.
A resource reference in an api
Introspection tools for Ash.Api
Generate Mermaid diagrams from a specified API.
Generate a Livebook from a specified API.
Ensures that all resources for a given registry are not embeds.
Ensures that all resources for a given api are compiled.
Ensures that all related resources are included in an API.
The interface for an ash authorizer
The return value for bulk actions.
The behaviour for a calculation module
Changesets are used to create and update data in Ash.
Tools for introspecting managed relationships.
Represents a case insensitive string
Used to define the functions of a code interface for a resource.
The interface for being an ash data layer.
An ETS (Erlang Term Storage) backed Ash Datalayer, for testing and lightweight usage.
Introspection helpers for the Ets data layer
An Mnesia backed Ash Datalayer.
Introspection helpers for Ash.DataLayer.Mnesia
A data layer that returns structs.
Ensures that all identities have a pre_check_with
configured, or raises.
The Ash engine handles the parallelization/running of requests to Ash.
Represents an individual request to be processed by the engine.
Represents an unresolved field to be resolved by the engine.
Tools and utilities used by Ash to manage and conform errors
Used when an invalid value is provided for an action argument
Used when options validation fails for an internal function call
Used when an invalid value is provided for an action argument
Used when an invalid value is provided for an attribute change
Used when a change is provided that covers multiple attributes/relationships
Used when an invalid value is provided for a relationship change
Used when a change is provided for an attribute that does not exist
Used when a change is provided for an relationship that does not exist
Used when an attribute or relationship is required
Used when a stale record is attempted to be updated or deleted
Used when the Ash engine has an internal error
Tooling for creating an Ash exception
Used when a flow has been halted for some reason
Used when authorization for an action fails
Used when an api that has require_actor? true
is provided no actor
Used when a create action would be filtered
Raised in cases where access to a specific field was prevented
Used when unreachable code/conditions are reached in the framework
Raised when policy authorization for an action fails
Used when an unknown/generic framework error occurs
Used when unreachable code/conditions are reached in the framework
Used when unreachable code/conditions are reached in the framework
Used when a callback returns an invalid type
Used when the sycnrhonous engine cannot proceed
The top level invalid error
Used when atomics for the given action type are not not supported by the data layer, but one is used.
Used when multiple requests with the same path are passed to the internal engine
Used when a request expresses a dependency on another request that doesn't exist
Used when an invalid primary key is given to an Api's get
Used when no limit is provided, pagination is required, and no default page size is configured
Used when multiple requests with the same path are passed to the internal engine
Used when an action name is provided that doesn't exist
Used when an action name is provided that doesn't exist
Used when a resource or alias is provided that doesn't exist
Used when Api.stream is used with an action that does not support keyset pagination
Used when page option is passed but pagination is not enabled.
Used when page: false
is provided but pagination is required
Used when a resource or alias is provided that cannot be used with the given api
Used when a tenant is not specified
Used when a request to the api times out.
Used when timeouts are not supported by the data layer, but one is set
Used when a given resource is unavailable.
Used when an invalid query is provided in a load
Used when attempting to load a relationship that does not exist
Used when a value is provided for a keyset that cannot be Base64 decoded.
Used when the data_layer does not support aggregates, or filtering/sorting them
Used when the data_layer does not support calculations, or filtering/sorting them
Used when an invalid value is provided for an action argument
Used when an invalid value is provided for a calculation argument
Used when an invalid expression is used in a filter
Used when an invalid reference is used in a filter
Used when an invalid value is provided for a filter
Used when an invalid limit is provided
Used when an invalid load is provided
Used when an invalid offset is provided
A generic error that can be used to add an error to a query for a specific field
Used when an invalid sort order is provided
Used when the data_layer does not support a given lock type
Due to the filter-based implementation of keyset pagination, it cannot be used with sorts on calculations.
Used when a resource would be read but has no read action
Used when an attribute that doesn't exist is used in a query
Used when a key in a filter contains something that is neither an attribute or a relationship
Used when a filter predicate that does not exist is referenced
Used when an function that doesn't exist is used in a query
Used when an operator that doesn't exist is used in a query
Used when an relationship that doesn't exist is used in a query
Used when an entity that not exist is referenced
Used when a relationship is filtered and the destination does not have a default read action
Used when an actor is referenced in a filter template, but no actor exists
Used when a filter or argument is required in a query
Used when attempting to sort on a field that cannot be used for sorting
Used when the data_layer does not support a provided predicate
Used when no data was provided to the simple data layer
A placeholder for a stacktrace so that we can avoid printing it everywhere
The top level unknown error container
Used when an unknown error occurs
Tools to build Ash expressions
The representation of a filter in Ash.
Represents a predicate which can be simplified and/or compared with other predicates
Checks a record to see if it matches a filter statement.
Represents a simplified filter, with a simple list of predicates
A negated predicate
Helpers for building filter templates
Feature flagging support for Ash internals.
A flow is a static definition of a set of steps to be run.
An argument to a flow
Tools to render an Ash.Flow as a mermaid chart.
The built in flow DSL.
A flow executor runs a given flow module
Executes the requests using the Ash engine, which can parallelize individual steps when possible.
Flow introspection functions.
The result of running a flow.
A behaviour for implementing a custom step in a flow.
Represents a branching set of steps in an Ash.Flow
Represents a create action step in an Ash.Flow
Represents a custom step in an Ash.Flow
Represents a debug step in an Ash.Flow
Represents a destroy action step in an Ash.Flow
Represents a map grouping of steps in an Ash.Flow
Represents a read action step in an Ash.Flow
Represents a nested flow step in an Ash.Flow
Represents steps grouped into a transaction in an Ash.Flow
Represents an update action step in an Ash.Flow
Template functions available while declaring steps.
Helpers for working with Ash.Flow templates.
Sets the api on the steps of a flow to the default api, unless an api is set explicitly.
Validates that no nested steps contain no steps
Validates that steps have unique names.
Ensures that all steps in a return statement are returnable
Represents a field that was hidden due to authorization rules.
Tools for generating input to Ash resource actions, as well as for seeds.
Helpers for Ash Mix tasks.
Used when an aggregate or relationship hasn't been loaded.
A notifier is an extension that receives various events
Represents a notification that will be handled by a resource's notifiers
A pubsub notifier extension.
Introspection helpers for Ash.Notifier.PubSub
Represents a configured publication from the pubsub notifier on an Ash.Resource
Helpers for working with nimble options
Types for Ash pages
A page of results from keyset
based pagination.
A page of results from offset
based pagination.
Helpers for working with the Plug connection.
An authorization extension for ash resources.
Adds field policies for any missing fields
Cache field policies for each field
Generates policy mermaid charts
A behaviour for declaring checks, which can be used to easily construct authorization rules.
The global authorization checks built into ash
The check module used for expr
s in policies
Represents a field policy in an Ash.Resource
A type of check that is represented by a filter statement
A type of check that is represented by a filter statement, and has access to the context.
An authorization extension for ash resources.
Represents a policy on an Ash.Resource
A type of check that operates only on request context, never on the data
Utilities around constructing/manipulating ash queries.
Represents an aggregated association value
Represents a boolean expression
Represents a calculated attribute requested on a query
Represents a function call/AST node in an Ash query expression
true if the provided field is nil Used to access values from the "source" of a given expression.
Determines if a given related entity exists.
A function is a predicate with an arguments list.
Subtracts the given interval from the current time in UTC.
Gets an element in the list by index
Returns true if the first string contains the second.
Adds the given interval to the current time in UTC
Adds the given interval to the current time in UTC
Adds the given interval from the current time in UTC.
Gets the value at the provided path in the value, which must be a map or embed.
If predicate is truthy, then the second argument is returned, otherwise the third.
true if the provided field is nil
Returns the length of a list attribute defined by the composite type {:array, Type}
.
Multiplies the value by negative one
Returns the current datetime
Rounds a float, decimal or integer to the given number of points
Joins a list of values.
Split a string into a list of strings
Returns the current datetime
Casts the value to a given type. Can also be used to provide type hints to data layers, where appropriate.
Represents the negation of the contained expression
An operator is a predicate with a left
and a right
left == right
left > right
left >= right
left in [1, 2, 3]
left is_nil true/false
left < right
left <= right
left != right
true if the provided field is nil Used to access values from the "source" of a given expression.
Represents a relation/attribute reference
A registry allows you to separate your resources from your api
module, to reduce improve compile times and reduce compile time dependencies.
A small DSL for declaring an Ash.Registry
. Not generally necessary any longer.
Represents an entry in an Ash.Registry
Introspection helpers for Ash.Registry
Adds some top level validations of resources present in a registry
Ensures that all resources for a given registry are not embeds.
Ensures that all resources for a given registry are compiled.
Ensures that all related resources are included in an API.
Warns if a registry has no entries in it
A resource is a static definition of an entity in your system.
Types for Ash actions
Represents a custom action on a resource.
Represents an argument to an action
Represents a create action on a resource.
Represents a destroy action on a resource.
An implementation of a generic action.
Represents metadata from an action
Represents a read action on a resource.
Represents the pagination configuration of a read action
Represents a update action on a resource.
Represents a named aggregate on the resource that can be loaded
The root behavior for a custom aggregate.
Represents an attribute on a resource
Helpers for building attributes
Tools for transforming resources in DSL Transformers.
Represents a named calculation on a resource
An argument to a calculation
Built in calculations that are automatically imported in the calculations section
Loads an attribute as a calculation.
Loads a relationship as a calculation.
Represents a function that evaluates a calculation in a resource's code interface
The behaviour for an action-specific resource change.
Built in changes that are available to all resources
Refetches the record being updated or destroyed, and locks it with the given type.
Refetches the record being updated or destroyed, and locks it for update.
Increments an attribute's value by the amount specified, which defaults to 1.
Performs an optimistic lock on the changeset.
Represents a unique constraint on a resource
Introspection for resources
Represents a function in a resource's code interface
A module to implement manual create actions.
A module to implement manual destroy actions.
A module to implement manual read actions.
A module to implement manual relationships.
A module to implement manual update actions.
The behaviour for an action-specific query preparation.
Builtin query preparations
Types Ash relationships
Represents a belongs_to relationship on a resource
Represents a has_many relationship on a resource
Represents a has_one relationship on a resource
Represents a many_to_many relationship on a resource
Creates the attribute for belongs_to relationships that have define_attribute?: true
Validates and caches the primary key of a resource
Creates an automatically named has_many
relationship for each many_to_many.
Sets the default accept
for each action
Creates the default primary key if one applies.
Transform any read actions which contain a get_by
option.
Guesses the destination_attribute
for has many and has one relationships unless provided
Ensures that all actions have unique names.
Confirms that a resource does not have multiple fields(attributes, calculations, aggregates, and relationships) with the same name.
Sets the source
key on relationships to be the resource they were defined on
Validates the primary action configuration
Represents a validation in Ash.
Validates that the action is the specified action.
Built in validations that are available to all resources
Ensures that countable paginated actions do not exist for resources that are not countable
Ensures that the field at the end of the path is an attribute or calculation.
Confirms that a resource does not use reserved names for field names.
Validates that accept and reject lists only contain valid attributes
Confirms that all action types declared on a resource are supported by its data layer
Confirms that all aggregates are supported by the data layer
Confirms that eager identities are not declared on a resource with no primary read.
Confirms that all action types declared on a resource are supported by its data layer
Ensures that the multitenancy configuration is valid for the given resource
Validates and caches the primary key of a resource
Validates that all relationships point to valid fields
Shows a warning on potentially incompatible relationship attributes.
Raises an error on potentially incompatible identity attributes.
Verifies that standard context keys are not used as calculation arguments
Tools for working with the satsolver that drives filter subset checking (for authorization)
Helpers for seeding data, useful for quickly creating lots of data either for database seeding or testing.
Utilities and types for sorting.
Testing helpers for Ash.
A behaviour for implementing tracing for an Ash application.
A simple tracer that can send traces to the current process or call a module with the trace.
A span produced by Ash.Tracer.Simple
Stores an atom as a string in the database
Represents a binary.
Represents a boolean.
Stores a case insensitive string in the database
Helpers for working with Comparable
Represents a date in the database
Represents a datetime, with configurable precision and timezone.
Represents a decimal.
An interval of time, primarily meant to be used in expression functions
A type for abstracting enums into a single type.
Represents a float (floating point number)
Represents a function.
Represents a simple integer
Represents a keyword list, stored as a :map
in the database.
Represents a map stored in the database.
Stores a module as a string in the database.
Represents a Naive datetime
Allows defining a new type that is the combination of an existing type and custom constraints
Stores a string in the database.
Represents a struct.
Represents a raw elixir term in the database
Represents a time in the database
Represents a UUID.
A union between multiple types, distinguished with a tag or by attempting to validate.
Represents a binary that attempts to decode input strings as a url encoded base64 string.
Represents a utc datetime. A wrapper around :datetime
for backwards compatibility.
Represents a utc datetime with nanosecond
precision. A wrapper around :datetime
for backwards compatibility.
Represents a vector.
Helpers for working with UUIDs
A wrapper for values that are sourced from Ash.Type.Union
.
A vector struct for Ash.
Mermaid Diagram helper functions.
Mix Tasks
Runs all codegen tasks for any extension on any resource/api in your application.
Generates a Mermaid Flow Chart for each Ash.Flow
alongside the flow.
Generates a Livebook for each Ash API.
Generates a Mermaid Flow Chart for a given resource's policies.
Generates a Mermaid Resource Diagram for each Ash API.
Runs all migration tasks for any extension on any resource/api in your application.
Runs all tear down tasks for any extension on any resource/api in your application, followed by setup tasks.
Runs all setup tasks for any extension on any resource/api in your application.
Runs all tear down tasks for any extension on any resource/api in your application.