Stone.js API
    Preparing search index...

    Hierarchy

    • IncomingEvent
      • IncomingHttpEvent
    Index
    _headers: Headers

    The headers of the request.

    accepts: Accepts

    The content negotiation handler for the request.

    body: Record<string, unknown>

    The body of the request.

    The cookies included in the request.

    files: Record<string, UploadedFile[]>

    The files included in the request.

    ip: string

    The IP address of the client making the request.

    ips: string[]

    The list of IP addresses, typically for proxies.

    locale: string

    The locale of the event.

    metadata: Record<string, unknown>

    The metadata associated with the event.

    method: HttpMethods

    The HTTP method of the request.

    protocol: string

    The protocol used for the request (e.g., http or https).

    query: URLSearchParams

    The query parameters of the request.

    queryString?: string

    The query string of the request.

    routeResolver?: () => IRoute
    source: IncomingEventSource

    The source of the event.

    timeStamp: number

    The timestamp of the event creation.

    type: string

    The type of the event.

    url: URL

    The URL of the request.

    userResolver?: () => unknown
    INCOMING_HTTP_EVENT: "stonejs@incoming_http_event" = 'stonejs@incoming_http_event'
    • get charset(): string

      Returns string

      The charset specified in the content-type header.

    • get charsets(): string[]

      Returns string[]

      An array of acceptable character sets for the request.

    • get contentType(): string

      Returns string

      The content type specified in the headers.

    • get decodedPathname(): string

      Returns string

      The decoded pathname of the URL.

    • get encodings(): string[]

      Returns string[]

      An array of acceptable encodings for the request.

    • get etag(): string

      Returns string

      The ETag of the request, if present.

    • get hash(): string

      Returns string

      The hash part of the URL.

    • get headers(): Record<string, string>

      Returns Record<string, string>

      The headers of the request.

    • get host(): string

      Returns string

      The host of the URL (hostname:port).

    • get hostname(): string

      Returns string

      The hostname of the URL.

    • get isAjax(): boolean

      Returns boolean

      Whether the request is an AJAX request.

    • get isPrefetch(): boolean

      Returns boolean

      Whether the request was prefetch.

    • get isSecure(): boolean

      Returns boolean

      Whether the request was made over a secure connection.

    • get isXhr(): boolean

      Returns boolean

      Whether the request is an XMLHttpRequest.

    • get languages(): string[]

      Returns string[]

      An array of acceptable languages for the request.

    • get params(): Record<string, unknown>

      Returns Record<string, unknown>

      The route parameters.

    • get path(): string

      Returns string

      The full path including pathname and search query.

    • get pathname(): string

      Returns string

      The pathname of the URL.

    • get platform(): string | symbol

      Get the platform of the event source.

      Returns string | symbol

      The platform of the event source.

    • get scheme(): string

      Returns string

      The protocol of the URL (e.g., "http" or "https").

    • get segments(): string[]

      Returns string[]

      The URL segments split by '/'.

    • get types(): string[]

      Returns string[]

      An array of acceptable content types for the request.

    • get uri(): string

      Returns string

      The full URL as a string.

    • get userAgent(): string

      Returns string

      The user agent of the request.

    • Return the first accepted charset.

      Parameters

      • ...values: string[]

        The charsets to check.

      Returns NegotiationResult

      The first accepted charset, or false if none are accepted.

    • Return the first accepted encoding.

      Parameters

      • ...values: string[]

        The encodings to check.

      Returns NegotiationResult

      The first accepted encoding, or false if none are accepted.

    • Return the first accepted language.

      Parameters

      • ...values: string[]

        The languages to check.

      Returns NegotiationResult

      The first accepted language, or false if none are accepted.

    • Return the first accepted content type.

      Parameters

      • ...values: string[]

        The content types to check.

      Returns NegotiationResult

      The first accepted type, or false if none are accepted.

    • Return a cloned instance.

      The metadata container is deep-copied (plain objects and arrays are recreated, special values kept by reference) so that mutating the clone's metadata — e.g. via middleware — never leaks back into the original event. This is what makes the Kernel's originalEvent snapshot a faithful pre-middleware copy.

      Returns this

      A cloned instance of the current class.

    • Filter and return files based on their names.

      Parameters

      • files: string[]

        The array of file names to filter.

      Returns Record<string, UploadedFile[]>

      An object containing the filtered files.

    • Generate a unique fingerprint for the event.

      Parameters

      • Optionalfull: boolean

        Whether to include the user agent and IP address in the fingerprint.

      Returns string

      The generated fingerprint as a base64 string.

    • Get request DATA by key (route params → body → query → metadata).

      SECURITY: does NOT read headers or cookies — use getHeader/getCookie.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to look for.

      Returns TReturn

      The value of the key, or undefined.

    • Get request DATA by key with a fallback (route params → body → query → metadata).

      SECURITY: does NOT read headers or cookies — use getHeader/getCookie.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to look for.

      • fallback: TReturn

        A fallback value if the key is not found.

      Returns TReturn

      The value of the key or the fallback.

    • Get the body of the request.

      Type Parameters

      • TReturn = unknown

      Returns TReturn

      The body of the request or the fallback.

    • Get the body of the request.

      Type Parameters

      • TReturn = unknown

      Parameters

      • fallback: TReturn

        The fallback value if the body is not found.

      Returns TReturn

      The body of the request or the fallback.

    • Get a cookie value.

      Type Parameters

      Parameters

      • name: string

        The cookie name.

      Returns TReturn

      The cookie value or the fallback.

    • Get a cookie value.

      Type Parameters

      Parameters

      • name: string

        The cookie name.

      • fallback: TReturn

        A fallback value if the cookie is not found.

      Returns TReturn

      The cookie value or the fallback.

    • Get a file by its name.

      Parameters

      • name: string

        The name of the file.

      Returns UploadedFile[]

      The file if it exists, otherwise undefined.

    • Get file extension for a given MIME type.

      Parameters

      • mimeType: string

        The MIME type.

      Returns string

      The corresponding file extension, or undefined if not found.

    • Get a header value.

      Type Parameters

      • TReturn = string

      Parameters

      • name: string

        The header name.

      Returns TReturn

      The header value or the fallback value.

      If the header name is not a valid string.

    • Get a header value.

      Type Parameters

      • TReturn = string

      Parameters

      • name: string

        The header name.

      • fallback: TReturn

        A fallback value if the header is not found.

      Returns TReturn

      The header value or the fallback value.

      If the header name is not a valid string.

    • Get data from metadata.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to retrieve from metadata.

      Returns TReturn

      The value associated with the key or the fallback.

    • Get data from metadata.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to retrieve from metadata.

      • fallback: TReturn

        The fallback value if the key is not found.

      Returns TReturn

      The value associated with the key or the fallback.

    • Get MIME type for a given file path or extension.

      Parameters

      • format: string

        The file path or extension.

      Returns string

      The corresponding MIME type, or undefined if not found.

    • Retrieve a parameter from the route if it exists.

      Type Parameters

      • TReturn = unknown

      Parameters

      • name: string

        The name of the parameter to retrieve.

      Returns TReturn

      The value of the parameter if it exists, otherwise undefined.

    • Retrieve a parameter from the route if it exists.

      Type Parameters

      • TReturn = unknown

      Parameters

      • name: string

        The name of the parameter to retrieve.

      • fallback: TReturn

        The fallback value if the parameter does not exist.

      Returns TReturn

      The value of the parameter if it exists, otherwise undefined.

    • Get the route resolver function.

      Returns () => IRoute

      The route resolver function.

    • Get the URI with or without the domain.

      Parameters

      • withDomain: boolean = false

        Whether to include the domain in the URI.

      Returns string

      The URI with or without the domain.

    • Get the user instance.

      Type Parameters

      • T = undefined

      Returns T

      The user object, resolved through a user resolver function if available.

    • Get the user resolver function.

      Returns () => unknown

      The user resolver function.

    • Check if a cookie exists.

      Parameters

      • name: string

        The cookie name to check.

      Returns boolean

      True if the cookie exists, otherwise false.

    • Check if a file exists by its name.

      Parameters

      • name: string

        The name of the file.

      Returns boolean

      True if the file exists, otherwise false.

    • Check if a header exists.

      Parameters

      • name: string

        The header name to check.

      Returns boolean

      True if the header exists, otherwise false.

    • Check if a key exists in the JSON body.

      Parameters

      • key: string

        The key to check for.

      Returns boolean

      True if the key exists, otherwise false.

    • Check if the given value is equal to the specified value.

      Parameters

      • key: string

        The key to check.

      • value: unknown

        The value to compare against.

      Returns boolean

      True if the key's value is equal to the specified value, false otherwise.

    • Determine if the response cache is fresh.

      Parameters

      Returns boolean

      True if the cache is fresh, otherwise false.

    • Check if the current event method matches the given method.

      Parameters

      • method: string

        The method to check.

      Returns boolean

      True if the event method matches, otherwise false.

    • Check if the current event method is cacheable.

      Returns boolean

      True if the method is cacheable, otherwise false.

    • Check if the current event method is considered safe.

      Returns boolean

      True if the method is safe, otherwise false.

    • Check if the event source is from a platform.

      Parameters

      • platform: string | symbol

        The platform to check.

      Returns boolean

      True if the event source is from the platform, false otherwise.

    • Determine if the response cache is stale.

      Parameters

      Returns boolean

      True if the cache is stale, otherwise false.

    • Check if the request matches one of the given content types.

      Parameters

      • ...types: string[]

        The content types to check.

      Returns string | false

      The best match, or false if no match is found.

    • Get a value from the JSON body.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to look for in the JSON body.

      Returns TReturn

      The value of the key or the fallback.

    • Get a value from the JSON body.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to look for in the JSON body.

      • fallback: TReturn

        A fallback value if the key is not found.

      Returns TReturn

      The value of the key or the fallback.

    • Determines the preferred response type based on content negotiation. Uses Accept, Content-Type, User-Agent, and AJAX detection.

      Parameters

      • types: string[] = ...

        Allowed response types, in priority order.

      • defaultType: string = 'json'

        Default type if none match.

      Returns string

      The best response type as a string.

    • Get request range.

      Parameters

      • size: number

        The maximum size of the resource.

      • combine: boolean = false

        Specifies if overlapping & adjacent ranges should be combined.

      Returns Result | Ranges

      The parsed range, or undefined if not applicable.

    • Add data to metadata.

      Parameters

      • key: string | Record<string, unknown>

        The key or object to add to metadata.

      • Optionalvalue: unknown

        The value to associate with the key.

      Returns this

      This Event instance.

    • Set the route resolver function.

      Type Parameters

      Parameters

      • resolver: () => RouteType

        The route resolver function.

      Returns this

      The current instance for method chaining.

    • Set the user resolver function.

      Parameters

      • resolver: () => unknown

        The user resolver function.

      Returns this

      The current instance for method chaining.

    • Generate a full URL for the given path.

      Parameters

      • path: string

        The path to append to the base URL.

      Returns string

      The full URL for the given path.

    INCOMING_EVENT: string

    INCOMING_EVENT Event name, fires on platform message.

    IncomingEvent#INCOMING_EVENT