Caravela.Schema.Domain (Caravela v0.7.0)

Copy Markdown View Source

A whole domain: the top-level IR produced by compilation.

Summary

Functions

The first entity that declares an authenticatable block, or nil if none do. Caravela currently supports a single authenticatable entity per domain.

True if the domain has an authenticatable entity.

Lookup an entity by its DSL name.

Does the domain declare a hook for action on entity?

Is the domain multi-tenant (row-level scoped by tenant_id)?

Policy entry for entity, or nil if none was declared.

Explicit API version declared via version "v1" in the DSL. Returns the raw string (e.g. "v1") or nil when no version was declared.

Camelized version segment usable as a module name suffix ("v1""V1"). Returns nil when no version is declared.

Types

t()

@type t() :: %Caravela.Schema.Domain{
  entities: [Caravela.Schema.Entity.t()],
  hooks: [Caravela.Schema.Hook.t()],
  module: module(),
  opts: keyword(),
  policies: [Caravela.Policy.Entry.t()],
  relations: [Caravela.Schema.Relation.t()]
}

Functions

auth_entity(domain)

The first entity that declares an authenticatable block, or nil if none do. Caravela currently supports a single authenticatable entity per domain.

authenticated?(d)

True if the domain has an authenticatable entity.

fetch_entity(domain, name)

Lookup an entity by its DSL name.

has_hook?(domain, action, entity)

Does the domain declare a hook for action on entity?

multi_tenant?(domain)

Is the domain multi-tenant (row-level scoped by tenant_id)?

policy_for(domain, entity)

Policy entry for entity, or nil if none was declared.

version(domain)

Explicit API version declared via version "v1" in the DSL. Returns the raw string (e.g. "v1") or nil when no version was declared.

version_segment(domain)

Camelized version segment usable as a module name suffix ("v1""V1"). Returns nil when no version is declared.