Home / File/ reply.d.ts — fastify Source File

reply.d.ts — fastify Source File

Architecture documentation for reply.d.ts, a typescript file in the fastify codebase. 8 imports, 0 dependents.

File typescript CoreKernel InstanceFactory 8 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  e2509c3c_a7f2_309f_c87e_d5cb03a76c5a["reply.d.ts"]
  531c9fc1_aab6_113a_24da_d449700fa629["./instance"]
  e2509c3c_a7f2_309f_c87e_d5cb03a76c5a --> 531c9fc1_aab6_113a_24da_d449700fa629
  ee998eba_0ed8_8b67_66d6_d2f80d980a41["./logger"]
  e2509c3c_a7f2_309f_c87e_d5cb03a76c5a --> ee998eba_0ed8_8b67_66d6_d2f80d980a41
  4285dbb5_245d_95e1_f339_579e1aa1d358["./request"]
  e2509c3c_a7f2_309f_c87e_d5cb03a76c5a --> 4285dbb5_245d_95e1_f339_579e1aa1d358
  6a6fa08e_3d60_0520_25ea_dea35398fc8f["./route"]
  e2509c3c_a7f2_309f_c87e_d5cb03a76c5a --> 6a6fa08e_3d60_0520_25ea_dea35398fc8f
  79072a34_3222_2b87_85da_7f07094af121["./schema"]
  e2509c3c_a7f2_309f_c87e_d5cb03a76c5a --> 79072a34_3222_2b87_85da_7f07094af121
  0ec7ea98_0ca5_a578_7447_eb9a7fa7cc31["./type-provider"]
  e2509c3c_a7f2_309f_c87e_d5cb03a76c5a --> 0ec7ea98_0ca5_a578_7447_eb9a7fa7cc31
  36d8862b_caf4_88a2_ba4d_4f7ed0738291["./utils"]
  e2509c3c_a7f2_309f_c87e_d5cb03a76c5a --> 36d8862b_caf4_88a2_ba4d_4f7ed0738291
  d3593968_9619_ceab_faa9_45d4da061133["node:buffer"]
  e2509c3c_a7f2_309f_c87e_d5cb03a76c5a --> d3593968_9619_ceab_faa9_45d4da061133
  style e2509c3c_a7f2_309f_c87e_d5cb03a76c5a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { Buffer } from 'node:buffer'
import { FastifyInstance } from './instance'
import { FastifyBaseLogger } from './logger'
import { FastifyRequest, RequestRouteOptions } from './request'
import { RouteGenericInterface } from './route'
import { FastifySchema } from './schema'
import { CallSerializerTypeProvider, FastifyReplyType, FastifyTypeProvider, FastifyTypeProviderDefault, ResolveFastifyReplyType, SendArgs } from './type-provider'
import { CodeToReplyKey, ContextConfigDefault, HttpHeader, HttpKeys, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerBase, RawServerDefault, ReplyDefault, ReplyKeysToCodes } from './utils'

export interface ReplyGenericInterface {
  Reply?: ReplyDefault;
}

type HttpCodesReplyType = Partial<Record<HttpKeys, unknown>>

type ReplyTypeConstrainer<RouteGenericReply, Code extends ReplyKeysToCodes<keyof RouteGenericReply>> =
  RouteGenericReply extends HttpCodesReplyType & Record<Exclude<keyof RouteGenericReply, keyof HttpCodesReplyType>, never> ?
    Code extends keyof RouteGenericReply ? RouteGenericReply[Code] :
      CodeToReplyKey<Code> extends keyof RouteGenericReply ? RouteGenericReply[CodeToReplyKey<Code>] : unknown :
    RouteGenericReply

export type ResolveReplyTypeWithRouteGeneric<RouteGenericReply, Code extends ReplyKeysToCodes<keyof RouteGenericReply>,
  SchemaCompiler extends FastifySchema = FastifySchema,
  TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault> =
  Code extends keyof SchemaCompiler['response'] ?
    CallSerializerTypeProvider<TypeProvider, SchemaCompiler['response'][Code]> :
    ResolveFastifyReplyType<TypeProvider, SchemaCompiler, { Reply: ReplyTypeConstrainer<RouteGenericReply, Code> }>
/**
 * FastifyReply is an instance of the standard http or http2 reply types.
 * It defaults to http.ServerResponse, and it also extends the relative reply object.
 */
export interface FastifyReply<
  RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
  RawServer extends RawServerBase = RawServerDefault,
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
  ContextConfig = ContextConfigDefault,
  SchemaCompiler extends FastifySchema = FastifySchema,
  TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault,
  ReplyType extends FastifyReplyType = ResolveFastifyReplyType<TypeProvider, SchemaCompiler, RouteGeneric>
> {
  readonly routeOptions: Readonly<RequestRouteOptions<ContextConfig, SchemaCompiler>>

  raw: RawReply;
  elapsedTime: number;
  log: FastifyBaseLogger;
  request: FastifyRequest<RouteGeneric, RawServer, RawRequest, SchemaCompiler, TypeProvider>;
  server: FastifyInstance;
  code<Code extends keyof SchemaCompiler['response'] extends never ? ReplyKeysToCodes<keyof RouteGeneric['Reply']> : keyof SchemaCompiler['response'] extends ReplyKeysToCodes<keyof RouteGeneric['Reply']> ? keyof SchemaCompiler['response'] : ReplyKeysToCodes<keyof RouteGeneric['Reply']>>(statusCode: Code): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider, ResolveReplyTypeWithRouteGeneric<RouteGeneric['Reply'], Code, SchemaCompiler, TypeProvider>>;
  status<Code extends keyof SchemaCompiler['response'] extends never ? ReplyKeysToCodes<keyof RouteGeneric['Reply']> : keyof SchemaCompiler['response'] extends ReplyKeysToCodes<keyof RouteGeneric['Reply']> ? keyof SchemaCompiler['response'] : ReplyKeysToCodes<keyof RouteGeneric['Reply']>>(statusCode: Code): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider, ResolveReplyTypeWithRouteGeneric<RouteGeneric['Reply'], Code, SchemaCompiler, TypeProvider>>;
  statusCode: number;
  sent: boolean;
  send(...args: SendArgs<ReplyType>): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  header(key: HttpHeader, value: any): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  headers(values: Partial<Record<HttpHeader, number | string | string[] | undefined>>): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  getHeader(key: HttpHeader): number | string | string[] | undefined;
  getHeaders(): Record<HttpHeader, number | string | string[] | undefined>;
  removeHeader(key: HttpHeader): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  hasHeader(key: HttpHeader): boolean;
  redirect(url: string, statusCode?: number): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  writeEarlyHints(hints: Record<string, string | string[]>, callback?: () => void): void;
  hijack(): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  callNotFound(): void;
  type(contentType: string): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  serializer(fn: (payload: any) => string): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  serialize(payload: any): string | ArrayBuffer | Buffer;
  // Serialization Methods
  getSerializationFunction(httpStatus: string, contentType?: string): ((payload: { [key: string]: unknown }) => string) | undefined;
  getSerializationFunction(schema: { [key: string]: unknown }): ((payload: { [key: string]: unknown }) => string) | undefined;
  compileSerializationSchema(schema: { [key: string]: unknown }, httpStatus?: string, contentType?: string): (payload: { [key: string]: unknown }) => string;
  serializeInput(input: { [key: string]: unknown }, schema: { [key: string]: unknown }, httpStatus?: string, contentType?: string): string;
  serializeInput(input: { [key: string]: unknown }, httpStatus: string, contentType?: string): unknown;
  then(fulfilled: () => void, rejected: (err: Error) => void): void;
  trailer: (
    key: string,
    fn: ((reply: FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>, payload: string | Buffer | null) => Promise<string>) | ((reply: FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>, payload: string | Buffer | null, done: (err: Error | null, value?: string) => void) => void)
  ) => FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  hasTrailer(key: string): boolean;
  removeTrailer(key: string): FastifyReply<RouteGeneric, RawServer, RawRequest, RawReply, ContextConfig, SchemaCompiler, TypeProvider>;
  getDecorator<T>(name: string | symbol): T;
}

Domain

Subdomains

Functions

Dependencies

  • ./instance
  • ./logger
  • ./request
  • ./route
  • ./schema
  • ./type-provider
  • ./utils
  • node:buffer

Frequently Asked Questions

What does reply.d.ts do?
reply.d.ts is a source file in the fastify codebase, written in typescript. It belongs to the CoreKernel domain, InstanceFactory subdomain.
What functions are defined in reply.d.ts?
reply.d.ts defines 1 function(s): key.
What does reply.d.ts depend on?
reply.d.ts imports 8 module(s): ./instance, ./logger, ./request, ./route, ./schema, ./type-provider, ./utils, node:buffer.
Where is reply.d.ts in the architecture?
reply.d.ts is located at types/reply.d.ts (domain: CoreKernel, subdomain: InstanceFactory, directory: types).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free