contracts library

Classes

CacheDriver
An abstract class that defines the interface for cache drivers.
CommandHandler<T extends KhademCommand>
Handler interface for processing commands.
ConfigInterface
Defines the contract for a configuration management system.
ContainerInterface
Interface for a Dependency Injection (DI) container.
DatabaseConnection
Abstract interface for managing a database connection.
DatabaseResponse
Represents a response from a database query.
DeadLetterQueue
Dead Letter Queue interface for handling permanently failed jobs
Dispatcher
EnvInterface
Contract for accessing and managing environment variables.
Event
Base class for all application events.
EventSubscriberInterface
Interface for classes that want to subscribe to events using handler methods.
EventSystemInterface
Core event system contract for managing listeners, emitting events, and groups.
ExceptionHandlerContract
Contract for handling exceptions in the application.
FailedJob
Represents a failed job stored in the Dead Letter Queue
FailedJobHandlerContract
Interface for handling failed jobs and retry logic
FieldName
Wrapper type to indicate that a message parameter is a reference to another field name.
ICacheConfigLoader
Interface for cache configuration loading. Defines the contract for loading and parsing cache configuration.
ICacheDriverRegistry
Interface for cache driver registry management. Defines the contract for registering and retrieving cache drivers.
ICacheManager
Interface for the main cache facade. Defines the contract for the unified cache API.
ICacheStatisticsManager
Interface for cache statistics management. Defines the contract for tracking and reporting cache performance metrics.
ICacheTagManager
Interface for cache tag management. Defines the contract for managing cache tags and group invalidation.
ICacheValidator
Interface for cache validation. Defines the contract for validating cache operations and inputs.
IQueueConfigLoader
Interface for queue configuration loading. Defines the contract for loading and parsing queue configuration.
IQueueDriverRegistry
Interface for queue driver registry management. Defines the contract for registering and retrieving queue drivers.
ISessionDriverRegistry
Session driver registry interface. Defines the contract for managing session drivers.
ISessionManager
Session manager interface. Defines the contract for session management operations.
JobDefinition
A factory wrapper that defines how to create scheduled job instances from config.
KhademCommand
Base class for all CLI commands in Khadem.
LangProvider
LangProvider contract that defines the interface for a language provider.
Listener<T extends Event>
Base class for event listeners.
LoggerContract
Interface for the logger system
LogHandler
Interface for log handlers.
Middleware
Class representing a named and prioritized middleware instance.
MigrationFile
Contract representing a database migration file.
QueryBuilderInterface<T>
A generic interface for building SQL-like queries dynamically. Supports both raw Map responses or strongly-typed KhademModel instances.
QueueDriver
Defines the core interface for any queue driver implementation.
QueueJob
Represents a job that can be queued and processed asynchronously.
QueueJobContext
Context passed through the middleware pipeline
QueueMetricsContract
Interface for queue metrics collection
QueueMiddleware
Middleware interface for queue jobs
QueueMonitor
Interface for queue monitoring and metrics collection.
ResponseContract
A minimal response contract that can be backed by HTTP or Socket responses.
RouteGroupContract
Contract that defines route group behavior such as prefix and attached middleware.
Rule
Base class for creating validation rules.
RuleMessageParametersProvider
Optional contract for rules that want to provide extra localization parameters for their error messages.
ScheduledJob
Represents a job that can be scheduled for execution at a specific time or interval.
Scheduler
Scheduler interface for managing and executing scheduled tasks.
SchedulerEngineContract
Contract for the Scheduler Engine
SchemaBuilder
Interface for building or modifying database schemas.
Seeder
Represents a single data seeder class.
ServiceProvider
Base class for creating service providers.
SessionDriver
Session storage driver interface. Defines the contract for session storage implementations.
SessionDriverRegistry
Session driver registry implementation. Manages registration and retrieval of session storage drivers.
ShouldBroadcast
Interface for events that should be broadcasted to external clients (e.g., via WebSockets).
ShouldQueue
Interface for listeners that should be executed in the background queue.
SocketAdapter
Abstract adapter for managing socket state (clients, rooms, broadcasts).
StoppableEvent
Interface for events that can be stopped from propagating.
StorageDisk
A simple contract for a file storage system.
Subscriber
Interface for event subscribers.
TaskStats
Statistics for a scheduled task
ValidationContext
Context object containing all information needed for validation.
ViewDirective

Enums

EventPriority
Defines levels of event listener priority for execution order.
LogLevel
Represents different levels of logging.
MiddlewarePriority
Priority levels for middleware execution.
TaskStatus
Status of a scheduled task

Typedefs

EventListener = FutureOr<void> Function(dynamic payload)
A function type for event listeners that handle event payloads.
MiddlewareHandler = FutureOr<void> Function(Request request, ResponseContract response, NextFunction next)
Signature of a middleware function.
Next = Future<void> Function()
Next function type for middleware chain
NextFunction = FutureOr<void> Function()
Signature for "next" callback in middleware chain.
SocketEventHandler = FutureOr<void> Function(SocketContext context)

Exceptions / Errors

AppException
Base class for custom application exceptions.