import { StandardSchemaV1 } from "@standard-schema/spec";
//#region src/status.d.ts
/**
* Enum containing all HTTP status codes.
*/
declare enum HttpStatus {
Continue = 100,
SwitchingProtocols = 101,
ProcessingDeprecated = 102,
EarlyHints = 103,
Ok = 200,
Created = 201,
Accepted = 202,
NonAuthoritativeInformation = 203,
NoContent = 204,
ResetContent = 205,
PartialContent = 206,
MultiStatus = 207,
AlreadyReported = 208,
ImUsed = 226,
MultipleChoices = 300,
MovedPermanently = 301,
Found = 302,
SeeOther = 303,
NotModified = 304,
UseProxyDeprecated = 305,
Unused = 306,
TemporaryRedirect = 307,
PermanentRedirect = 308,
BadRequest = 400,
Unauthorized = 401,
PaymentRequired = 402,
Forbidden = 403,
NotFound = 404,
MethodNotAllowed = 405,
NotAcceptable = 406,
ProxyAuthenticationRequired = 407,
RequestTimeout = 408,
Conflict = 409,
Gone = 410,
LengthRequired = 411,
PreconditionFailed = 412,
ContentTooLarge = 413,
UriTooLong = 414,
UnsupportedMediaType = 415,
RangeNotSatisfiable = 416,
ExpectationFailed = 417,
ImATeapot = 418,
MisdirectedRequest = 421,
UnprocessableEntity = 422,
Locked = 423,
FailedDependency = 424,
TooEarly = 425,
UpgradeRequired = 426,
PreconditionRequired = 428,
TooManyRequests = 429,
RequestHeaderFieldsTooLarge = 431,
UnavailableForLegalReasons = 451,
InternalServerError = 500,
NotImplemented = 501,
BadGateway = 502,
ServiceUnavailable = 503,
GatewayTimeout = 504,
HttpVersionNotSupported = 505,
VariantAlsoNegotiates = 506,
InsufficientStorage = 507,
LoopDetected = 508,
NotExtended = 510,
NetworkAuthenticationRequired = 511
}
/**
* Returns the name of the HTTP status code (200 -> "OK").
* @param status The HTTP status code.
* @returns The name of the HTTP status code or `undefined` if the status code is not recognized.
*/
declare function getHttpStatusName(status: number): string | undefined;
//#endregion
//#region src/schema.d.ts
type ZetaSchema = StandardSchemaV1 & {
"~zeta": {
type: string;
meta: Record;
};
toJsonSchema?(): any;
meta(meta?: Record): ZetaSchema;
};
/**
* A schema for an error response. Use when defining additional status codes
* that an operation might return with:
*
* ```ts
* import { ErrorResponse } from '@aklinker/zeta';
*
* app.get(
* "/api/item/:itemId",
* {
* responses: {
* 200: Item.optional(),
* 404: ErrorResponse,
* }
* },
* () => {
* // ...
* }
* );
* ```
*/
declare const ErrorResponse: ZetaSchema;
declare function isZetaSchema(schema: any): schema is ZetaSchema;
/**
* The actual type an error response conforms to.
*/
type ErrorResponse = {
[additionalInfo: string]: any;
name: string;
message: string;
status: HttpStatus;
stack?: string[];
cause?: ErrorResponse;
};
declare const ErrorResponseJsonSchema: {
type: "object";
properties: {
status: {
type: "number";
description: string;
example: number;
};
name: {
type: "string";
description: string;
example: string;
};
message: {
type: "string";
description: string;
example: string;
};
};
required: string[];
};
/**
* A schema for when you want to not return a response. Use when defining
* additional status codes that an operation might return with:
*
* ```ts
* import { NoResponse } from '@aklinker/zeta';
*
* app.get(
* "/api/item/:itemId",
* {
* responses: {
* [HttpStatus.Accepted]: NoResponse,
* }
* },
* () => {
* // ...
* }
* );
* ```
*/
declare const NoResponse: ZetaSchema;
declare const FormDataBody: ZetaSchema;
declare const UploadFileBody: ZetaSchema;
declare const UploadFilesBody: ZetaSchema;
//#endregion
export { UploadFileBody as a, isZetaSchema as c, NoResponse as i, HttpStatus as l, ErrorResponseJsonSchema as n, UploadFilesBody as o, FormDataBody as r, ZetaSchema as s, ErrorResponse as t, getHttpStatusName as u };