emkore library

:emko core | A Clean Architecture-inspired Dart library by :emko

Classes

Actor
Represents a user or system that can perform actions.
ApiDefinition
A structured, machine-readable definition of a use case, intended for consumption by an LLM for function calling.
AuditLogInterceptor<Input, Output>
Example interceptor that demonstrates using context for audit logging.
AuthorizationInterceptor<Input, Output>
Global interceptor that handles authorization checking for all usecases.
Entity<T extends Entity<T>>
Base class that all domain entities should extend. Enforces system audit fields (id, timestamps) while allowing custom implementations in consuming packages. Entities may include methods for internal state management and validation. Typically contains business logic for value validation, invariant checking, and constraint enforcement.
Interceptor<Input, Output>
An interceptor that can hook into the lifecycle of a use case execution.
InterceptorContext
Context information provided to interceptors during usecase execution.
JSON
JSON class with serialization capabilities
LlmParameter
A class that defines a single parameter for an LLM-callable function.
LlmReturnValue
A class that defines the return value of an LLM-callable function.
LoggerInterceptor
Money
Immutable value object representing monetary amounts in cents.
NoRetryPolicy
PerformanceInterceptor<Input, Output>
Example interceptor that measures usecase execution performance.
Permission
Represents a permission with an action, a resource, and optional constraints.
ResourceConstraints
Defines constraints for a permission.
RetryPolicy
SimpleRetryPolicy
UnitOfWork
UnitOfWorkFactory
Usecase<Input, Output>
The base class for all use cases in the application.
ValidationError
Represents a single validation error with field context
ValidationResult
ValidatorBuilder
A fluent validation builder that supports both validation and schema generation

Enums

ResourceScope
Represents the scope of a resource a permission applies to.

Functions

isCommonAction(String action) bool
Checks if a given action is one of the common CRUD actions.

Typedefs

CommonAction = String
Type alias for common actions for better readability.
UsecaseName = (String, String)
A tuple representing the name of a use case: (action, resource).

Exceptions / Errors

AuthorizationException
Exception thrown when an actor lacks required permissions for an operation.
DatabaseException
EntityAlreadyExistsException
EntityNotFoundException
NetworkException
RepositoryException
ValidationException