Alumna
--- Solving a circular dependency --- RuleContext needs App and Service as types, but App/Service need Rule. Forward-declare them so context can compile.
Constants
VERSION = "0.9.1"
Class methods
cache(cache : Cache, ttl : Time::Span, skip_providers : Array(String) = CacheRule::DEFAULT_SKIP) : Rule
Sourcecors(origins : Array(String) = ["*"], methods : Array(String) = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"] of ::String, headers : Array(String) = ["Content-Type", "Authorization", "Accept"] of ::String, credentials : Bool = false, max_age : Int32 = 86400) : Rule
Sourcejwt(secret : String | Bytes, store_key : String = "jwt", header : String = "Authorization", scheme : String = "Bearer", required : Bool = true, skip_providers : Array(String) = Session::DEFAULT_SKIP, leeway : Time::Span = Time::Span.zero, iss : String | Nil = nil, aud : String | Nil = nil) : Rule
Sourcerate_limit(limit : Int32 = 100, window_seconds : Int32 = 60, key : Proc(RuleContext, String) = ->(ctx : RuleContext) do
ctx.remote_ip
end, store : RateLimitStore | Nil = nil) : Rule
Fixed-window rate limiter. Default store is MemoryRateLimitStore. Pass store: to inject another RateLimitStore (for example Redis). window_seconds sets the memory store window when store: is omitted.
session(store : SessionStore, cookie : String = Session::DEFAULT_COOKIE, store_key : String = Session::DEFAULT_STORE_KEY, required : Bool = true, skip_providers : Array(String) = Session::DEFAULT_SKIP, http_only : Bool = true, secure : Bool = false, same_site : Symbol = :lax, path : String = "/", domain : String | Nil = nil) : Rule
SourceInjects the current UTC timestamp into the specified fields of ctx.data.
Designed to be used with explicit method scopes (e.g., on: :create or on: :write).
DX Helper: Auto-cast common types to their AnyData equivalents
to_any(v : AnyData) : AnyData
Sourcevalidate(schema : Schema) : Rule
SourceMacros
hash
Helper macro to cleanly instantiate a Hash(String, AnyData)
without the of String => AnyData generic friction.
Nested types
- Alumna::AnyData
- Alumna::App
- Alumna::Cache
- Alumna::Connections
- Alumna::FieldDescriptor
- Alumna::FieldError
- Alumna::FieldType
- Alumna::Formats
- Alumna::Http
- Alumna::HttpOverrides
- Alumna::IndexDef
- Alumna::JWT
- Alumna::JsonHelper
- Alumna::MemoryAdapter
- Alumna::MemoryCache
- Alumna::MemoryConnections
- Alumna::MemoryRateLimitStore
- Alumna::MemorySessionStore
- Alumna::Orchestrator
- Alumna::PushSocket
- Alumna::Query
- Alumna::RateLimitStore
- Alumna::Rule
- Alumna::RuleContext
- Alumna::RulePhase
- Alumna::Ruleable
- Alumna::Schema
- Alumna::Service
- Alumna::ServiceError
- Alumna::ServiceMethod
- Alumna::ServiceResult
- Alumna::Session
- Alumna::SessionStore
- Alumna::StoreType
- Alumna::Storeable
- Alumna::Testing
- Alumna::Unprovided