Core libraries for Aqueduct applications.

The library contains behavior for building REST server applications. Some of the functionality includes routing requests to controllers, OAuth 2.0 and an ORM.

Please see documentation guides at https://aqueduct.io/docs/.

See the tutorial at https://aqueduct.io/docs/tut/getting-started/.

An example Aqueduct application:

  class Sink extends RequestSink {
    Sink(ApplicationConfiguration config) : super(config);

    @override
    void setupRouter(Router router) {
      router
        .route("/ok")
        .listen((req) async {
          return new Response.ok(null);
        });
    }
  }

Constants

cannotBeReused → _RequiresInstantion

Metadata for a RequestController subclass that requires it must be instantiated for each request.

const _RequiresInstantion()
httpDelete HTTPMethod

Binds an HTTPController responder method to HTTP DELETE.

const HTTPMethod("delete")
httpGet HTTPMethod

Binds an HTTPController responder method to HTTP GET.

const HTTPMethod("get")
httpPost HTTPMethod

Binds an HTTPController responder method to HTTP POST.

const HTTPMethod("post")
httpPut HTTPMethod

Binds an HTTPController responder method to HTTP PUT.

const HTTPMethod("put")
managedPrimaryKey ManagedColumnAttributes

Marks a property as a primary key, database type big integer, and autoincrementing. The corresponding property type must be int. It is assumed that the underlying database indexes and uniques the backing column.

const ManagedColumnAttributes(primaryKey: true, databaseType: ManagedPropertyType.bigInteger, autoincrement: true)
managedTransientAttribute ManagedTransientAttribute

Metadata for a subclass of ManagedObject that allows the property to be used in ManagedObject.readFromMap and ManagedObject.asMap, but is not persisted in the underlying database.

const ManagedTransientAttribute(availableAsInput: true, availableAsOutput: true)
managedTransientInputAttribute ManagedTransientAttribute

Metadata for a subclass of ManagedObject that indicates it can be used in ManagedObject.readFromMap, but is not persisted in the underlying database.

const ManagedTransientAttribute(availableAsInput: true, availableAsOutput: false)
managedTransientOutputAttribute ManagedTransientAttribute

Metadata for a subclass of ManagedObject that indicates it can be used in ManagedObject.asMap, but is not persisted in the underlying database.

const ManagedTransientAttribute(availableAsInput: false, availableAsOutput: true)
optionalConfiguration ConfigurationItemAttribute

A ConfigurationItemAttribute for optional properties.

requiredConfiguration ConfigurationItemAttribute

A ConfigurationItemAttribute for required properties.

requiredHTTPParameter HTTPRequiredParameter

Marks an HTTPController property binding as required.

whereNotNull → dynamic

Matcher for matching everything but null when using Query.where.

const NullMatcherExpression(false)
whereNull → dynamic

Matcher for matching null value when using Query.where.

const NullMatcherExpression(true)

Typedefs

LoggerHandler(LogRecord) → void

Handler callback to process log entries as they are added to a Logger.

PostgreSQLConnectionFunction() → Future<PostgreSQLConnection>

A function that will create an opened instance of PostgreSQLConnection when executed.

Properties

hierarchicalLoggingEnabled → bool

Whether to allow fine-grain logging and configuration of loggers in a hierarchy.

read / write
recordStackTraceAtLevel Level

Automatically record stack traces for any message of this level or above.

read / write

Functions

whereBeginsWith(String value, { bool caseSensitive: true }) → dynamic

Matcher for matching string properties that start with value when using Query.where.

whereBetween(lhs, rhs) → dynamic

Matcher for matching column values where lhs <= value <= rhs when using Query.where.

whereContainsString(String value, { bool caseSensitive: true }) → dynamic

Matcher for matching string properties that contain value when using Query.where.

whereDoesNotBeginWith(String value, { bool caseSensitive: true }) → dynamic

Matcher for matching string properties that do not start with value when using Query.where.

whereDoesNotContain(String value, { bool caseSensitive: true }) → dynamic

Matcher for matching string properties that do not contain value when using Query.where.

whereDoesNotEndWith(String value, { bool caseSensitive: true }) → dynamic

Matcher for matching string properties that do not end with value when using Query.where.

whereEndsWith(String value, { bool caseSensitive: true }) → dynamic

Matcher for matching string properties that end with value when using Query.where.

whereEqualTo(value, { bool caseSensitive: true }) → dynamic

Matcher for exactly matching a column value when using Query.where.

whereGreaterThan(value) → dynamic

Matcher for matching a column value greater than the argument when using Query.where.

whereGreaterThanEqualTo(value) → dynamic

Matcher for matching a column value greater than or equal to the argument when using Query.where.

whereIn(Iterable values) → dynamic

Matcher for matching values that are within the list of values when using Query.where.

whereLessThan(value) → dynamic

Matcher for matching a column value less than the argument when using Query.where.

whereLessThanEqualTo(value) → dynamic

Matcher for matching a column value less than or equal to the argument when using Query.where.

whereNotEqualTo(value, { bool caseSensitive: true }) → dynamic

Matcher for matching all column values other than argument when using Query.where.

whereOutsideOf(lhs, rhs) → dynamic

Matcher for matching column values where matched value is less than lhs or greater than rhs when using Query.where.

whereRelatedByValue(foreignKeyValue) → dynamic

Matcher for matching ManagedRelationship property when using Query.where.

Enums

APIHeaderType

Represents a header type in the OpenAPI specification.

APIParameterLocation

Represents a parameter location in the OpenAPI specification.

APISecuritySchemeFlow

Represents a OAuth 2.0 security scheme flow in the OpenAPI specification.

AuthorizationParserExceptionReason

The reason either AuthorizationBearerParser or AuthorizationBasicParser failed.

AuthRequestError

The possible errors as defined by the OAuth 2.0 specification.

AuthStrategy

The type of authorization strategy to use for an Authorizer.

ConfigurationItemAttributeType

Possible options for a configuration item property's optionality.

ManagedPropertyType

Possible data types for ManagedEntity attributes.

ManagedRelationshipDeleteRule

Possible values for a delete rule in a ManagedRelationship.

ManagedRelationshipType

The different types of relationships for ManagedRelationship instances declared in ManagedObject persistent types.

PersistentStoreQueryReturnType

QueryExceptionEvent

Categorizations of query failures for QueryException.

QuerySortOrder

Order value for Query.pageBy and Query.sortBy.

ValidateOperation

Types of operations ManagedValidators will be triggered for.

Classes

APIConfiguration

A ConfigurationItem to represent an external HTTP API.

APIContact

Represents contact information in the OpenAPI specification.

APIDocument

Represents an OpenAPI specification.

APIDocumentable

An object that can be documented into a OpenAPI specification.

APIHeader

Represents a header in the OpenAPI specification.

APIHost

Represents a web server host in the OpenAPI specification.

APIInfo

Represents a metadata for an API in the OpenAPI specification.

APILicense

Represents a copyright/open source license in the OpenAPI specification.

APIOperation

Represents a HTTP operation (a path/method pair) in the OpenAPI specification.

APIParameter

Represents a parameter in the OpenAPI specification.

APIPath

Represents a path (also known as a route) in the OpenAPI specification.

APIRequestBody

Represents a request body in the OpenAPI specification.

APIResponse

Represents an HTTP response in the OpenAPI specification.

APISchemaObject

Represents a schema object in the OpenAPI specification.

APISecurityDefinition

Represents a security definition in the OpenAPI specification.

APISecurityRequirement

Represents a security requirement in the OpenAPI specification.

APISecurityScheme

Represents a security scheme in the OpenAPI specification.

APISecurityScope

Represents a security scope in the OpenAPI specification.

Application

A container for web server applications.

ApplicationConfiguration

A set of values to configure an instance of Application.

ApplicationMessageHub

Sends and receives messages from other isolates started by an Application.

ApplicationServer

Manages listening for HTTP requests and delivering them to RequestSink instances.

AuthBasicCredentials

A structure to hold Basic authorization credentials.

AuthClient

Represents an OAuth 2.0 client ID and secret pair.

AuthCode

Represents an OAuth 2.0 authorization code.

AuthCodeController

HTTPController for issuing OAuth 2.0 authorization codes.

AuthController

HTTPController for issuing and refreshing OAuth 2.0 access tokens.

Authenticatable

An interface for implementing an OAuth 2.0 resource owner.

Authorization

Authorization information for a Request after it has passed through an Authorizer.

AuthorizationBasicParser

Parses a Basic Authorization header.

AuthorizationBearerParser

Parses a Bearer token from an Authorization header.

Authorizer

A RequestController that will authorize further passage in a RequestController chain when a request has valid credentials.

AuthScope

Instances represent OAuth 2.0 scope.

AuthServer

A storage-agnostic OAuth 2.0 authorization 'server'.

AuthStorage

An interface for implementing storage behavior for an AuthServer.

AuthToken

Represents an OAuth 2.0 token.

AuthUtility

Exposes static utility methods for password, salt and API credential generation.

AuthValidator

Instances that implement this type can be used by an Authorizer to determine authorization of a request.

ConfigurationException

Thrown when ConfigurationItems encounter an error.

ConfigurationItem

Subclasses of ConfigurationItem read YAML strings and files, assigning values from the YAML to properties of the subclass.

ConfigurationItemAttribute

ConfigurationItem properties may be attributed with these.

CORSPolicy

Describes a CORS policy for a RequestController.

DatabaseConnectionConfiguration

A ConfigurationItem to represent a database connection configuration.

HTTPBody

Binds an HTTP request body to an HTTPController property or responder method argument.

HTTPCachePolicy

Instances of this type provide configuration for the 'Cache-Control' header.

HTTPCodecRepository

Provides encoding and decoding services based on the ContentType of a Request or Response.

HTTPController

Base class for grouping response logic for a group of endpoints.

HTTPFileController

Serves files from a directory on the filesystem.

HTTPHeader

Binds an HTTP request header to an HTTPController property or responder method argument.

HTTPMethod

Binds an HTTPController responder method to an HTTP Method (e.g., GET, POST)

HTTPPath

Binds a route variable from HTTPRequestPath.variables to an HTTPController responder method argument.

HTTPQuery

Binds an HTTP query parameter to an HTTPController property or responder method argument.

HTTPRequestBody

Instances of this class decode HTTP request bodies according to their content type.

HTTPRequestPath

The HTTP request path decomposed into variables and segments based on a RouteSpecification.

HTTPRequiredParameter

See requiredHTTPParameter.

HTTPSerializable

Interface for serializable instances to be decoded from an HTTP request body and encoded to an HTTP response body.

Level

Levels to control logging output. Logging can be enabled to include all levels above certain Level. Levels are ordered using an integer value Level.value. The predefined Level constants below are sorted as follows (in descending order): Level.SHOUT, Level.SEVERE, Level.WARNING, Level.INFO, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, and Level.ALL.

Logger

Use a Logger to log debug messages.

LogRecord

A log entry representation used to propagate information from Logger to individual Handlers.

ManagedAttributeDescription

Stores the specifics of database columns in ManagedObjects as indicated by ManagedColumnAttributes.

ManagedBacking

Instances of this class provide storage for ManagedObjects.

ManagedColumnAttributes

Metadata to describe the behavior of the underlying database column of a persistent property in ManagedObject subclasses.

ManagedContext

The target for database queries and coordinator of Querys.

ManagedDataModel

Instances of this class contain descriptions and metadata for mapping ManagedObjects to database rows.

ManagedEntity

Mapping information between a table in a database and a ManagedObject object.

ManagedObject

An object that represents a database row.

ManagedObjectController

A RequestController that implements basic CRUD operations for a ManagedObject.

ManagedPropertyDescription

Contains database column information and metadata for a property of a ManagedObject object.

ManagedRelationship

Metadata for a ManagedObject property that requests the property be backed by a foreign key column in a database.

ManagedRelationshipDescription

Contains information for a relationship property of a ManagedObject.

ManagedSet

Instances of this type contain zero or more instances of ManagedObject and represent has-many relationships.

ManagedTransientAttribute

See managedTransientAttribute, managedTransientInputAttribute and managedTransientOutputAttribute.

ManagedValidator

Validates properties of ManagedObject before an insert or update Query.

Migration

The base class for migration instructions.

MigrationBuilder

PackagePathResolver

Utility to find source files.

PersistentStore

An interface for implementing persistent storage.

PostgreSQLErrorCode

Commonly used error codes from PostgreSQL.

PostgreSQLPersistentStore

The database layer responsible for carrying out Querys against PostgreSQL databases.

Query

Instances of this type configure and execute database commands.

QueryController

A partial class for implementing an HTTPController that has a few conveniences for executing Querys.

QueryPredicate

A predicate contains instructions for filtering rows when performing a Query.

QueryReduceOperation

Executes aggregate functions like average, count, sum, etc.

Request

A single HTTP request.

RequestController

RequestControllers respond to, modify or forward HTTP requests.

RequestOrResponse

The unifying protocol for Request and Response classes.

RequestSink

Instances of this type are the root of an Aqueduct application.

ResourceRegistry

Mechanism to release port-consuming resources like database connections and streams.

Response

Represents the information in an HTTP response.

RouteController

A RequestController for routes in a Router.

Router

A router to split requests based on their URI path.

RouteSpecification

Specifies a matchable route path.

Schema

Represents a database and its tables.

SchemaBuilder

Used during migration to modify a schema.

SchemaColumn

Represents a database column for a SchemaTable.

SchemaColumnDifference

SchemaDifference

SchemaTable

Represents a database table for a Schema.

SchemaTableDifference

Validate

Add as metadata to persistent properties to validate their values before insertion or updating.

Exceptions / Errors

ApplicationStartupException

Thrown when an application encounters an exception during startup.

AuthorizationParserException

An exception indicating why Authorization parsing failed.

AuthServerException

An exception thrown by AuthServer.

AuthUtilityException

HTTPBodyDecoderException

Thrown when HTTPRequestBody encounters an exception.

HTTPCodecException

Thrown when HTTPCodecRepository encounters an exception.

HTTPResponseException

An exception for early-exiting a RequestController to respond to a request.

HTTPStreamingException

ManagedDataModelException

Thrown when a ManagedDataModel encounters an error.

MigrationException

Thrown when Migration encounters an error.

QueryException

An exception describing an issue with a query.

QueryPredicateException

Thrown when a QueryPredicate is malformed.

RequestControllerException

Thrown when RequestController throws an exception.

RouterException

Thrown when a Router encounters an exception.

SchemaException

Thrown when a Schema encounters an error.