-
Notifications
You must be signed in to change notification settings - Fork 14
Home
Josh Wright edited this page Jan 14, 2021
·
11 revisions
Alchemy | Fusion | Papyrus |
---|---|---|
Types | Types | Types |
Protocols | Protocols | Protocols |
Global Typealiases | ||
Global Functions | ||
Global Variables |
-
PapyrusClientError:
An error that occurred when requesting a
Papyrus.Endpoint
. -
BasicAuthMiddleware:
A
Middleware
type configured to work withBasicAuthable
. This middleware will intercept requests and queries the table backingB
for a row matching the basic auth headers of the request. If a matching row is found, that value will be associated with the request. If there is noAuthentication: Basic ...
header, or the basic auth values don't match a row in the database, anHTTPError(.unauthorized)
will be thrown. -
TokenAuthMiddleware:
A
Middleware
type configured to work withTokenAuthable
. This middleware will intercept requests and queries the table backingT
for a row matching the token auth headers of the request. If a matching row is found, that value will be associated with the request. If there is noAuthentication: Token ...
header, or the token value isn't valid, anHTTPError(.unauthorized)
will be thrown. -
Env:
Handles any environment info of your application. Loads any
environment variables from the file a
.env
or.{APP_ENV}
ifAPP_ENV
is set in the current environment. - HTTPBody: The contents of an HTTP request or response.
- HTTPError: An HTTPError that can be thrown during routing. When intercepted, Alchemy will return an error response with the status code of this error and a body containing the message, if there is one.
-
MIMEType:
An HTTP Media Type. It has a
value: String
appropriate for putting intoContent-Type
headers. -
PathParameter:
Represents a dynamic parameter inside the URL. Parameter
placeholders should be prefaced with a colon (
:
) in the route string. Something like:user_id
in the path/v1/users/:user_id
. -
PathParameter.DecodingError:
An error encountered while decoding a path parameter value
string to a specific type such as
UUID
orInt
. -
HTTPAuth:
A type representing any auth that may be on an HTTP request.
Supports
Basic
andBearer
. -
HTTPAuth.Basic:
The basic auth of an Request. Corresponds to a header that
looks like
Authorization: Basic <base64-encoded-username-password>
. -
HTTPAuth.Bearer:
The bearer auth of an Request. Corresponds to a header that
looks like
Authorization: Bearer <token>
. - Request: A simplified Request type as you'll come across in many web frameworks
-
Response:
A type representing the response from an HTTP endpoint. This
response can be a failure or success case depending on the
status code in the
head
. - Launch: Command to launch a given application & either serve or migrate.
-
Log:
Convenience struct for logging logs of various levels to a default
Logger
. By default, this logger has labelAlchemy
. - Socket: A type representing a communication link between two programs running on a network. A server can bind to a socket when serving (i.e. this is where the server can be reached). Other network interfaces can also be reached via a socket, such as a database. Either an ip host & port or a unix socket path.
- WeekUnit: A week of time.
- DayUnit: A day of time.
- HourUnit: An hour of time.
- MinuteUnit: A minute of time.
- SecondUnit: A second of time.
- FrequencyTyped: A generic frequency for handling amounts of time.
- Weekday: A day of the week.
-
Scheduler:
Schedules
Job
s at recurring intervals, like a cron. -
Router:
An
Router
responds to HTTP requests from the client. Specifically, it takes anRequest
and routes it to a handler that returns anResponseConvertible
. - CORSMiddleware: The MIT License (MIT)
- CORSMiddleware.AllowOriginSetting: Option for the allow origin header in responses for CORS requests.
- CORSMiddleware.Configuration: Configuration used for populating headers in response for CORS requests.
- StaticFileMiddleware: Middleware for serving static files from a given directory.
-
ModelQuery:
A
ModelQuery
is just a subclass ofQuery
with some added typing and convenience functions for querying the table of a specificModel
. -
BelongsToRelationship:
The child of a 1 - M or a 1 - 1 relationship. Backed by an
identifier of the parent, when encoded to a database, this
type attempt to write that identifier to a column named
<property-name>_id
. -
HasManyRelationship:
Either side of a M - M relationship or the parent of a 1 - M
relationship. The details of this relationship are defined
in the initializers inherited from
HasRelationship
. -
HasOneRelationship:
Either side of a 1 - 1 relationship. The details of this
relationship are defined in the initializers inherited from
HasRelationship
. - HasRelationship: Contains shared behavior for "has" relationships, particularly around eager loading functionality.
- RuneError: Any general error that might occur when using the Rune ORM.
- DatabaseConfig: The information needed to connect to a database.
-
DatabaseError:
An error encountered when interacting with a
Database
. - DatabaseField: Represents a column & value pair in a database row.
- DatabaseKeyMappingStrategy: Represents the mapping between your type's property names and their corresponding database column.
- DatabaseValue: Represents the type / value combo of an SQL database field. These don't necessarily correspond to a specific SQL database's types; they just represent the types that Alchemy current supports.
- MySQLDatabase
-
PostgresDatabase:
A concrete
Database
for connecting to and querying a PostgreSQL database. - AlterTableBuilder: A builder for altering the columns of an existing table.
- CreateColumnBuilder: A builder for creating columns on a table in a relational database.
- SQLJSON: A type used to signify that a column on a database has a JSON type.
- CreateTableBuilder: A builder with useful functions for creating a table.
- CreateIndex: A type for keeping track of data associated with creating an index.
- CreateColumn: A type for keeping track of data associated with creating an column.
- Schema: Represents the schema of a table in a relational database.
- JoinType: The type of the join clause.
- JoinClause: A JOIN query builder.
- OrderClause: A clause for ordering rows by a certain column.
- OrderClause.Sort: A sorting direction.
- WhereBoolean
- WhereValue
- WhereColumn
- WhereNested
- WhereIn
- WhereIn.InType
- WhereRaw
- Grammar: Used for compiling query builders into raw SQL statements.
-
ColumnType:
An abstraction around various supported SQL column types.
Grammar
s will map theColumnType
to the backing dialect type string. - StringLength: The length of an SQL string column in characters.
- Query
- Operator
- SQL
-
Services:
Provides easy access to some commonly used services in Alchemy.
These services are Injected from the global
Container
. You can add your own services in extensions if you'd like. -
Thread:
A utility for running expensive CPU work on threads so as not to
block the current
EventLoop
. -
BCryptDigest:
Creates and verifies BCrypt hashes. Normally you will not need to initialize one of these classes and you will
use the global
BCrypt
convenience instead. - BcryptError
- OrderedDictionary: The MIT License (MIT)
- HTMLView: A protocol for defining HTML views to return to a client.
-
BasicAuthable:
A protocol for automatically authenticating incoming requests
based on their
Authentication: Basic ...
header. When the request is intercepted by theBasicAuthMiddleware<T>
, it will query the table ofT
inServices.db
for a row that has a matching username & validate the password. If the row exists & the password matches, the typeT
will beset
on the request. -
TokenAuthable:
A protocol for automatically authenticating incoming requests
based on their
Authentication: Bearer ...
header. When the request is intercepted by a relatedTokenAuthMiddleware<T>
, it will query the table ofT
inServices.db
for a row that has a matching token value. If the exists, the correlatingUser
type will be queried andset
on the request. -
Application:
The core type for an Alchemy application. Implement this & it's
setup
function, then callMyApplication.launch()
in yourmain.swift
. -
StringInitializable:
Protocol representing a type that can be created from a
String
. -
ResponseWriter:
An abstraction around writing data to a remote peer. Conform to
this protocol and inject it into the
Response
for responding to a remote peer at a later point in time. -
Frequency:
Represents a frequency that occurs at a
rate
and may have specific requirements for when it should start running, such as "every day at 9:30 am". - TimeUnit: A unit of time.
- Job: An abstract block of work to be run.
- Controller: Represents a type that adds handlers to a router. Used for organizing your app's handlers into smaller components.
-
Middleware:
A
Middleware
is used to intercept either incomingRequest
s or outgoingResponse
s. Using futures, they can do something with those, either synchronously or asynchronously. - ResponseConvertible: Represents any type that can be converted into a response & is thus returnable from a request handler.
- Model: An ActiveRecord-esque type used for modeling a table in a relational database. Contains many extensions for making database queries, supporting relationships & much more.
-
PrimaryKey:
Represents a type that may be a primary key in a database. Out of
the box
UUID
,String
andInt
are supported but you can easily support your own by conforming to this protocol. -
Relationship:
A protocol representing a relationship between two
Model
s. Contains only those two types and functionality for eager loading this relationship. -
ModelMaybeOptional:
Either a
Model
or aModel?
. -
Database:
A generic type to represent any database you might be interacting
with. Currently, the only two implementations are
PostgresDatabase
andMySQLDatabase
. The QueryBuilder and Rune ORM are built on top of this abstraction. - DatabaseRow: A row of data returned from a database. Various database packages can use this as an abstraction around their internal row types.
-
Migration:
A
Migration
provides functionality for adding and rolling back changes to the schema of a relational database. - Sequelizable: Something that can be turned into SQL.
- Column: Something convertible to a table column in an SQL database.
- Parameter
-
AnyOptional:
Represents a type erased
Optional
.
- Seconds: A frequency measured in a number of seconds.
- Minutes: A frequency measured in a number of minutes.
- Hours: A frequency measured in a number of hours.
- Days: A frequency measured in a number of days.
- Weeks: A frequency measured in a number of weeks.
-
ModelEnum:
A protocol to which enums on
Model
s should conform to. The enum will be modeled in the backing table by it's raw value. - WhereNestedClosure
- OrderedDictionarySlice: A view into an ordered dictionary whose indices are a subrange of the indices of the ordered dictionary.
- OrderedDictionaryKeys: A collection containing the keys of the ordered dictionary.
- OrderedDictionaryValues: A collection containing the values of the ordered dictionary.
- identifier(of:): Gives a unique identifier for a metatype.
- name(of:): Returns the string name of this type.
- Bcrypt: Creates and verifies BCrypt hashes.
- Container: A container from which services should be registered and resolved.
-
Inject:
Provides a convenient
@propertyWrapper
for injecting services to a type. By default, resolves services from the global container (Container.global
) but if the enclosing type conforms toContainerized
services are resolved fromEnclosingType.container
.
-
Containerized:
Conform a class to
Containerized
lets the@Inject
property wrapper know that there is a custom container from which services should be resolved.
-
Empty:
Represents an Empty request or response on an
Endpoint
. - RequestComponents: Represents the components needed to make an HTTP request.
-
ArrayEncoding:
Configures how
Array
parameters are encoded. -
BoolEncoding:
Configures how
Bool
parameters are encoded. -
Endpoint:
Endpoint
is an abstraction around making REST requests. It includes aRequest
type, representing the data needed to make the request, and aResponse
type, representing the expected response from the server. - BodyEncoding: Indicates the type of a request's body. The content type affects how and where the content is encoded.
-
EndpointGroup:
An
EndpointGroup
represents a collection of endpoints from the same host. -
EndpointMethod:
Represents the HTTP method, or verb, of a request. There are
static accessors for
GET
,POST
,PUT
,PATCH
, andDELETE
, but any custom one can be made with the public initializer. - PapyrusError: A Papyrus related error.
-
PapyrusValidationError:
An error related to decoding a type from a
DecodableRequest
. -
CUSTOM:
Represents an
Endpoint
with a custom HTTP method. -
DELETE:
Represents a DELETE
Endpoint
. -
GET:
Represents a GET
Endpoint
. -
PATCH:
Represents a PATCH
Endpoint
. -
POST:
Represents a POST
Endpoint
. -
PUT:
Represents a PUT
Endpoint
. -
AnyEncodable:
An erased
Encodable
. - Body: Represents the body of a request.
- Header: Represents an item in a request's headers.
- Path: Represents a path component value on an endpoint. This value will replace a path component with the name of the property this wraps.
- URLQuery: Represents a value in the query of an endpoint's URL.
-
DecodableRequest:
A type from which a
RequestAllowed
can be decoded. Conform your server's Request type to this for easy validation against aRequestAllowed
type. -
EndpointRequest:
A type that can be the
Request
type of anEndpoint
. - AnyBody: A type erased body of a request.
Generated at 2021-01-13T22:24:59-0800 using swift-doc 1.0.0-beta.5.
Alchemy
Types
- AlterTableBuilder
- BCryptDigest
- BasicAuthMiddleware
- BcryptError
- BelongsToRelationship
- CORSMiddleware
- CORSMiddleware.AllowOriginSetting
- CORSMiddleware.Configuration
- ColumnType
- CreateColumn
- CreateColumnBuilder
- CreateIndex
- CreateTableBuilder
- DatabaseConfig
- DatabaseError
- DatabaseField
- DatabaseKeyMappingStrategy
- DatabaseValue
- DayUnit
- Env
- FrequencyTyped
- Grammar
- HTTPAuth
- HTTPAuth.Basic
- HTTPAuth.Bearer
- HTTPBody
- HTTPError
- HasManyRelationship
- HasOneRelationship
- HasRelationship
- HourUnit
- JoinClause
- JoinType
- Launch
- Log
- MIMEType
- MinuteUnit
- ModelQuery
- MySQLDatabase
- Operator
- OrderClause
- OrderClause.Sort
- OrderedDictionary
- PapyrusClientError
- PathParameter
- PathParameter.DecodingError
- PostgresDatabase
- Query
- Request
- Response
- Router
- RuneError
- SQL
- SQLJSON
- Scheduler
- Schema
- SecondUnit
- Services
- Socket
- StaticFileMiddleware
- StringLength
- Thread
- TokenAuthMiddleware
- WeekUnit
- Weekday
- WhereBoolean
- WhereColumn
- WhereIn
- WhereIn.InType
- WhereNested
- WhereRaw
- WhereValue